Giter Club home page Giter Club logo

wundergraph / wunderbase Goto Github PK

View Code? Open in Web Editor NEW
514.0 6.0 23.0 81 KB

Serverless GraphQL Database built on top of Firecracker, SQLite and Prisma

Home Page: https://wundergraph.com/blog/wunderbase_serverless_graphql_database_on_top_of_sqlite_firecracker_and_prisma

License: Apache License 2.0

Dockerfile 5.06% JavaScript 3.14% Shell 5.14% Go 78.54% HTML 8.12%
database db firecracker firecracker-containerd firecracker-microvms firecracker-vm graphql prisma prisma2 serverless

wunderbase's Introduction

Size Limit logo by Anton Lovchikov

is a Serverless SQLite database exposed through GraphQL. It can sleep for days and wakes up in less than a second. During sleep, you only pay for storage. It is capable to serve a medium traffic website.

  • Firecracker (Fly.io Machines) Runs on top of the same technology as AWS Fargate.
  • Scale to zero. Cold starts in less than 600ms.
  • Fast. 10k reads / 2k writes requests per second.
  • Cheap Fly.io free tier allows your to run it almost for free.

Love the idea? ๐Ÿ’“ Read the announcement blog post to get more insights!

Getting Started

1. Install dependencies

  • Mac

    sh install-prisma-darwin.sh
    
  • Linux

    sh install-prisma-linux.sh
    

2. Start the server

  • Run the application locally

    ENABLE_SLEEP_MODE=false go run main.go
  • Running with Docker

    docker run -p 4466:4466 -e ENABLE_SLEEP_MODE=false wundergraph/wunderbase

3. Visit the playground

Open http://0.0.0.0:4466 in your browser.

Running on fly Machines

Check out the fly.io Machines documentation on how to deploy WunderBase to fly.io. You can build the image yourself using the Dockerfile in this repo, or just use a pre-built image from Docker Hub.

Testing

Note: Requires Docker

go test ./...

Firecracker & Fly Machines

  • Sleep Mode
    • By default, sleep mode is enabled. This means, if there is no traffic, WunderBase will sleep. Sleep mode lets WunderBase exit with exit code 0. This indicated to fly that the application wants to sleep.
  • Cold Starts
    • I've measured an avg cold start time of 400-600ms.
  • Backups
    • We're looking at integrating Litestream or a similar service for backups. If you'd like to contribute, please reach out!

Internals

WunderBase uses the Prisma Query Engine internally to translate GraphQL queries to SQL. We've added a proxy written in Golang to add GraphiQL 2.0 as the frontend and handle the lifecycle to make the service sleep when it's not in use. We're also using the Prisma Migration Engine to run migrations.

Security

I do not recommend to expose WunderBase to the public internet. The intended use case is to run it on a private network and expose it to your frontend via an API Gateway, like WunderGraph!

Note: Get Early Access to WunderGraph Cloud - " The Vercel for Backend " ๐Ÿช The Serverless API Developer Platform ๐Ÿช„

wunderbase's People

Contributors

ansoncode avatar fiam avatar jensneuse avatar starptech avatar thisisnithin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

wunderbase's Issues

Server can't create db.sqlite file if data folder does not exist

If installed and started as instructed in the README, the server will error with the following.

2022/10/26 00:27:21 Migration failed:
{
  "jsonrpc": "2.0",
  "error": {
    "code": 4466,
    "message": "An error happened. Check the data field for details.",
    "data": {
      "is_panic": false,
      "message": "unable to open database file: ./data/db.sqlite\n",
      "meta": {
        "full_error": ""
      }
    }
  }
}

This is easily rectifiable by manually creating a data folder but I would expect the server to do this automatically on startup

Makefile for fly and fly.yaml

Cool stuff

I currently use graphjin and would like to explore Wonberbase.

Would you mind adding a make or .sh file and the incarnations for making it fly on fly โ€ฆ

โ€”-
Also wondering if litefs is on your roadmap ?

Async proxy

You me tuned that โ€œ

During my testing I've realized that 2k/10k is the maximum that I can achieve before getting Timeout errors, so I've added some rate limiting to the proxy to keep everything stable.

โ€œ

An async statefuul proxy would remove this problem perhaps ?

Fly uses NATS I think , but not sure

Deployment guide ? For AWS/GCP/Azure

Hi Wundergraph team,
Our entire deployment is Serverless and after looking at this Serverless DB, we're thinking of trying it out.

Is there any guide for deployment on AWS lambda or Fargate? Is it possible?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.