Home

Awesome

Combining Marmot + PocketBase + Fly.io

What is Marmot?

Marmot is an distributed SQLite replicator that runs as a side-car to you service, and replicates data across cluster using NATS.

What is PocketBase?

PocketBase is an open source backend consisting of embedded database (SQLite) with realtime subscriptions, built-in auth management, convenient dashboard UI and simple REST-ish API.

What is Fly.io?

Fly is a platform for running full stack apps and databases close to your users. Compute jobs at Fly.io are virtualized using Firecracker, the virtualization engine developed at AWS as the engine for Lambda and Fargate.

Why should I care?

This demo effectively shows how PocketBase can be pushed closer to the edge. After developer has done local development, and finalized schema, a literal copy of the DB can be deployed in production. These nodes scale up or down based on traffic, and write from everywhere. This can horizontally scales your PocketBases close to the user. With NATS embedded into Marmot, a sharded RAFT is used to capture changes, and replay them across the fly nodes (multi-primary replicas).

Important Notes:

Install Flyctl

Deploy and Scale

Create Admin

Once cluster is started go to http://<application-name>.fly.dev/_/ to launch admin panel, it will prompt you to create an admin account. Choose your email and password. Once you hit create, it will create your admin account.

PocketBase might show you an error saying invalid token. If that happens just wait for a second or so to let changes propagate. Try reloading http://<application-name>.fly.dev/_/ until you see login form. If issue persists try creating account again.

Use the APIs

Now you can play with your app's API using http://<application-name>.fly.dev/api/. Checkout PocketBase Docs for deep dive.