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.| Component | Role | Technology |
|---|---|---|
| API Server | Handles HTTP requests, authentication, routing | Bun + Elysia |
| Worker | Processes background jobs (emails, webhooks, billing sync) | BullMQ |
| Database | Persistent storage for users, orgs, subscriptions | Turso (libSQL/SQLite) |
| Redis | Job queues, caching, rate limiting | Redis 7+ |
| S3 Storage | File uploads, avatars, attachments | Any S3-compatible provider |
Production Checklist
Complete every item before your first production deployment.Provision Turso database
Create a production database on Turso Cloud. Choose a primary region close to your API servers.
Provision Redis
Use a managed Redis provider (Upstash, Railway addon, ElastiCache) or run Redis in Docker with a password and persistence enabled.
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.
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.Configure email sending
Verify your production domain in Resend. Update
EMAIL_FROM to use the verified domain.Set all environment variables
See the full list in the Environment Configuration section below.
Environment Configuration
Set every variable listed below in your production environment. Use a secrets manager (not.env files) whenever possible.
Required Variables
Optional Variables
Security Headers and CORS
BunShip applies security headers automatically in production (NODE_ENV=production). The defaults are:
| Header | Value |
|---|---|
Strict-Transport-Security | max-age=31536000; includeSubDomains |
X-Content-Type-Options | nosniff |
X-Frame-Options | DENY |
X-XSS-Protection | 0 (relies on CSP instead) |
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 exposesGET /health which returns:
What to Monitor
| Metric | Alert Threshold | Why |
|---|---|---|
| API response time (p95) | > 500ms | Performance degradation |
| Error rate (5xx) | > 1% | Application failures |
| Redis memory usage | > 80% capacity | Queue backpressure risk |
| Worker queue depth | > 1000 pending jobs | Worker needs scaling |
| Database connection errors | Any | Turso connectivity issue |
| SSL certificate expiry | < 14 days | Prevents downtime |
Recommended Monitoring Stack
- 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.

