For Developers
Build & Deploy
This section consolidates how we build images and deploy to Railway, plus local Compose.
Docker images
Client (apps/client/Dockerfile)
- Build stage: Bun install, compile server once (for Hono exports),
vite buildwithVITE_*args - Runtime stage: copy
dist, installserveonly, run non-root on 5173
Server (apps/server/Dockerfile)
- Build stage: workspace-filtered Bun install for
server,types,db;bun run compile - Prod stage: install prod deps only via filters, copy sources, run DB schema generator in
packages/db, run non-root on 8080
Docs (apps/docs/Dockerfile)
- Bun base; install deps; copy selective source;
bun run build;bun start
Crons (crons/backup, crons/cleanup)
- Bun base with prod deps; backup additionally installs PostgreSQL client 16
- Non-root execution
Railway deployment
- Each service has a
railway.jsonspecifying DOCKERFILE builder and resource profiles - Client: staging sleeps, production 2 replicas
- Server: healthcheck
/, timeout 180s, production 3 replicas, multi-region; staging sleeps - Docs: similar to client (1 staging, 2 prod replicas)
- Crons: scheduled with
cronSchedule: "0 5 * * *", restart policyNEVER
Environment variables are managed per-service and per-environment within Railway.
docker-compose (docker-compose.yml)
- Services:
server(8080),client(5173),docs(3000),backup-cron - Client build args pass
VITE_*envs;clientdepends onserver - Usage:
- Build:
bun build - Run:
bun start
- Build:
CI/CD and branches
- Staging deployments on
stagingbranch - Production deployments on
mainbranch - Database schema pushes must be run manually with root scripts (
db_push:<env>) prior to deploys that require schema changes