Deploy

B2BKit runs anywhere that runs Node and Postgres. This guide covers one VPS with Docker, which is how demo.b2bkit.dev runs. See deploy/README.md for the scripts.

One VPS with Docker Compose

What runs: Postgres, the API container and the web container, behind a reverse proxy (Caddy) that handles HTTPS.

  1. Point DNS at the server: app.example.com (web) and api.example.com (API for mobile).
  2. Copy the repo to the server and create an env file next to it:
POSTGRES_PASSWORD=...           # openssl rand -hex 24
BETTER_AUTH_SECRET=...          # openssl rand -base64 32
PUBLIC_WEB_URL=https://app.example.com
SMTP_URL=smtps://...
EMAIL_FROM="Acme <hello@example.com>"
  1. Build, migrate and start:
docker compose -f deploy/docker-compose.demo.yml --env-file ../.env.production build
docker compose -f deploy/docker-compose.demo.yml --env-file ../.env.production up -d postgres
docker compose -f deploy/docker-compose.demo.yml --env-file ../.env.production run --rm -w /app/packages/db tools ../../node_modules/.bin/drizzle-kit migrate
docker compose -f deploy/docker-compose.demo.yml --env-file ../.env.production up -d api web
  1. Proxy the domains (Caddy example, certificates are automatic):
app.example.com {
	reverse_proxy b2bkit-demo-web:3000
}
api.example.com {
	reverse_proxy b2bkit-demo-api:3001
}

The demo stack uses about 110 MB of RAM at idle; building the web image needs about 1.5 GB free.

Other hosts

Part Options
Web Vercel (root apps/web, set API_URL), or the web Docker target
API Railway, Fly.io, Render, any Docker host (api target, port 3001)
Database Neon, Supabase Postgres, Railway, RDS
Mobile EAS Build and Submit (set EXPO_PUBLIC_API_URL to the production API)