Surplus logo
Surplus Docsby Sharing Excess
GuidesDevelopers

Build and deploy

Docker

Production images are defined per app:

  • apps/client/Dockerfile — static Vite build served for the browser app
  • apps/server/Dockerfile — Bun server with workspace packages/* dependencies needed at runtime
  • apps/docs/Dockerfile — Next.js docs (fumadocs-mdx postinstall, next build)

Each Dockerfile assumes a monorepo build context from the repository root (see COPY paths inside the files).

Railway

Service-specific railway.json files live next to each deployable unit, for example:

  • apps/client/railway.json
  • apps/server/railway.json
  • apps/docs/railway.json
  • crons/*/railway.json for scheduled workers

They declare Docker builders, watch patterns, replica hints, and environment-specific overrides (staging vs production) where applicable.

Version label

The docs image expects a version field in the root package.json so VERSION can be baked into the sidebar footer at build time.

Secrets and env

Never commit secrets. Production and staging values (database URLs, JWT signing material, S3 credentials, Mapbox tokens, …) are injected in Railway (or your host) and read only in apps/server / apps/client build pipelines—not inside reusable packages/* libraries.