Skip to main content

Production Architecture

BunShip runs as a set of cooperating services. In production, the minimum deployment consists of an API server, a background worker, a Redis instance, and a Turso database.

Production Checklist

Complete every item before your first production deployment.
1

Generate secrets

Create strong, unique values for every secret. Never reuse development values.
2

Provision Turso database

Create a production database on Turso Cloud. Choose a primary region close to your API servers.
3

Provision Redis

Use a managed Redis provider (Upstash, Railway addon, ElastiCache) or run Redis in Docker with a password and persistence enabled.
4

Configure S3 storage

Create a bucket in AWS S3, Cloudflare R2, or another S3-compatible service. Set a CORS policy that allows uploads from your frontend domain.
5

Set up Stripe production keys

Switch from sk_test_ to sk_live_ keys. Create a production webhook endpoint pointing to https://api.yourdomain.com/webhooks/stripe and subscribe to the required events.
6

Configure email sending

Verify your production domain in Resend. Update EMAIL_FROM to use the verified domain.
7

Set all environment variables

See the full list in the Environment Configuration section below.
8

Run database migrations

9

Verify health endpoint

After deploying, confirm the health check returns a 200 response.

Environment Configuration

Set every variable listed below in your production environment. Use a secrets manager (not .env files) whenever possible.

Required Variables

Optional Variables

Never commit .env files containing production secrets to version control. Use your platform’s secrets management (Railway variables, AWS Secrets Manager, Fly.io secrets, etc.) instead.

Security Headers and CORS

BunShip applies security headers automatically in production (NODE_ENV=production). The defaults are: CORS is configured through the FRONTEND_URL environment variable. In production, only requests from that origin are accepted. If you need additional origins, update the CORS configuration in apps/api/src/index.ts.

Health Checks and Monitoring

Health Endpoint

BunShip exposes GET /health which returns:
Configure your load balancer or orchestrator to poll this endpoint every 30 seconds. A non-200 response means the instance should be replaced.

What to Monitor

  • Error tracking: Sentry (set SENTRY_DSN)
  • Uptime monitoring: BetterUptime, Checkly, or UptimeRobot against /health
  • Logs: Structured JSON logs are written to stdout. Ship them to Datadog, Grafana Cloud, or your preferred log aggregator.
  • Metrics: Export Prometheus metrics from /metrics (if enabled) or use your platform’s built-in dashboards.

Deployment Options

Docker

Run BunShip with Docker Compose on any server or VPS

Railway

One-click deploy with automatic builds and managed infrastructure

Fly.io

Deploy globally with edge regions and automatic scaling

AWS

Full control with ECS Fargate, ALB, and the AWS ecosystem