guide

Fly.io

Deploy Postbase on Fly.io. Unverified — a follow-up setup script is required.

Published: September 6, 2026Updated: September 6, 2026

Status: unverified. This template was written to match Postbase’s tested Docker/Railway/DigitalOcean deploy pattern but has not yet been deployed against a real account on this provider. Review the template before relying on it in production, and please report issues.

Unlike Railway/Render/DigitalOcean, Fly’s “Deploy to Fly” button only runs fly launch from fly.toml — it does not provision a managed Postgres or wire up secrets automatically. Run fly/setup.sh right after to finish setup.

Postbase is a self-hosted auth and database platform for Next.js. Drop it into your stack, configure 25+ auth providers from a dashboard, and connect your app with a single SDK call. Think self-hosted Supabase or Clerk — you own the data, you control the infra.

About Hosting Postbase

On Fly.io, Postbase runs as an app built from Dockerfile.railway per fly.toml, paired with a Fly Postgres cluster (a separate Fly app, attached via fly postgres attach). The app is stateless and can be redeployed independently of the database.

Click Deploy to Fly in the README — this clones the repo and runs fly launch, creating the app but not yet the database. Then run:

./fly/setup.sh postbase iad

Common Use Cases

  • Add auth to a Next.js app — enable email/password, magic links, or any of 25+ OAuth providers (GitHub, Google, Discord, and more) from the dashboard without writing auth code

  • Self-host your user database — store users, sessions, and OAuth accounts in your own Postgres instance with full SQL access via the built-in editor

  • Manage files and storage — connect Amazon S3, Cloudflare R2, Backblaze B2, or any S3-compatible bucket per-project from the dashboard

Dependencies

  • A Fly.io account with the flyctl CLI installed and authenticated

  • Docker — Fly builds Dockerfile.railway remotely (no local Docker required)

Implementation Details

  • fly.toml: App config: builds Dockerfile.railway, port 3000, health check at /api/health, 1 shared CPU / 1GB RAM by default

  • fly/setup.sh: Creates the Postgres cluster, attaches it (sets DATABASE_URL), generates and sets AUTH_SECRET-derived secrets, deploys, then sets NEXTAUTH_URL

Environment/secrets set:

DATABASE_URL         (set by `fly postgres attach`)
NEXTAUTH_SECRET       (fly secret, generated by setup.sh)
POSTBASE_JWT_SECRET   (fly secret, mirrors NEXTAUTH_SECRET)
NEXTAUTH_URL           (fly secret, set to https://<app>.fly.dev after first deploy)
PORT / HOSTNAME        (set in fly.toml: 3000 / 0.0.0.0)

Redeploying after a code change

fly deploy --app postbase

Why Deploy Postbase on Fly.io?

Fly runs your app close to users across multiple regions with fast, low-overhead deploys — a good fit if you already run other services on Fly.