• Stars
    star
    490
  • Rank 89,811 (Top 2 %)
  • Language
    Go
  • License
    Apache License 2.0
  • Created about 2 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

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 πŸͺ„

More Repositories

1

wundergraph

WunderGraph is a Backend for Frontend Framework to optimize frontend, fullstack and backend developer workflows through API Composition.
TypeScript
2,268
star
2

graphql-go-tools

GraphQL Router / API Gateway framework written in Golang, focussing on correctness, extensibility, and high-performance. Supports Federation v1 & v2, Subscriptions & more.
Go
690
star
3

open-previews

Open source preview comments
TypeScript
120
star
4

hopper

Modern GraphQL IDE, similar to GraphiQL and GraphQL Playground. Based on Monaco Editor (vscode).
TypeScript
65
star
5

wundergraph-demo

This Repository demonstrates how to combine 7 APIs (4 Apollo Federation SubGraphs, 1 REST, 1 standalone GraphQL, 1 Mock) into one unified GraphQL API which is then securely exposed as a JSON API to a NextJS Frontend.
TypeScript
58
star
6

nextjs-typescript-postgresql-graphql-realtime-chat

WunderGraph Realtime Chat Example using NextJS, TypeScript, PostgreSQL, GraphQL
TypeScript
51
star
7

federation-benchmarks

Comparison of a different federation gateways, e.g. supergraphs implementations
Go
17
star
8

docker

Build your custom docker image for your WunderGraph application
TypeScript
14
star
9

cloud-starter

A simple starter application that that can be deployed on WunderGraph Cloud
TypeScript
9
star
10

kubernetes-deployment

Run WunderGraph on any Kubernetes cluster
TypeScript
7
star
11

Hypermedia-GraphQL

Hypermedia GraphQL RFC
6
star
12

cosmo-federation-demos

WunderGraph Cosmo Federation demonstrations in TypeScript or Go
Shell
6
star
13

polyglot-persistence-postgresql-mysql-graphql

This repo demonstrates how to achieve polyglot persistence for PostgreSQL & MySQL using GraphQL as the layer of abstraction.
TypeScript
5
star
14

cloud-starter-turbo

Use Turborepo to speed up builds in monorepos.
TypeScript
3
star
15

cloud-demo

A demo for cloud containing 2 apps in a monorepo.
TypeScript
3
star
16

graphql-federation-monolith-to-microservices-workshop-nestjs

This is a workshop that teaches how to leverage GraphQL Federation & WunderGraph Cosmo to decompose a monolith into microservices.
TypeScript
3
star
17

nextjs-graphql-client-comparison

TypeScript
2
star
18

cloud-multi-projects-demo

A demo about how to manage multiple WunderGraph Projects in a single repository (monorepo).
TypeScript
2
star
19

wundergraph-protobuf

TypeScript
1
star
20

rust-client

Rust client for WunderGraph applications
Rust
1
star
21

terraform-provider-cosmo

Go
1
star
22

.github

Holds org-wide configuration files.
1
star
23

apollo-federation-compatibility-demo

JavaScript
1
star