Skip to main content
Golden rule: secrets stay on the server. Fill the REPLACE_ME_* placeholders in the API’s env.prod there, never commit them, and never put a secret in a VITE_* / PUBLIC_* var (those are inlined into the shipped bundle).
Image builds apply each repo’s allowScripts (current npm skips dependencies’ install scripts unless it allows them). The kit needs none; a npm warn install-scripts line in a build log means a new dependency needs a decision — see Install scripts.

Backend (shipwide_api)

  • Docker: the container boots migrate → seed → serve. Migrations + the idempotent seed run automatically. Provide a managed Postgres 17 + Redis 7 (or run them alongside). The repo’s docker-compose.yml is a local-dev setup: its Postgres/Redis use dev credentials (Redis has no password) and listen on 127.0.0.1 only — in production give both strong credentials (a password in REDIS_URL).
  • Purge cron (required): run daily — node dist/jobs/purge.js (compiled path; tsx is dev-only). It’s the physical half of account deletion + support-ticket retention; idempotent.
  • Email: point SMTP_* at a transactional provider (e.g. Postmark). Set SPF, DKIM, DMARC on the sending domain — with passwordless auth, a code in spam means nobody can sign in. MAIL_REPLY_TO is your support inbox: ticket notifications answer to it, and the website’s support form (POST /v1/support) delivers its messages there.
  • CORS: CORS_ORIGINS = your exact web origin(s). The native app origins (capacitor://localhost iOS, https://localhost Android, tauri://localhost macOS/Linux, http://tauri.localhost Windows) and the admin’s ADMIN_URL are always allowed.
  • Client allowlist: CLIENT_IDS = your app’s VITE_CLIENT_ID (comma-separated for several clients). Only those ids (plus the admin’s admin) can sign in.
  • Reverse proxy: TRUST_PROXY = whose X-Forwarded-For the API trusts. The default loopback,uniquelocal covers a proxy on the same host / private network (e.g. nginx → the container); otherwise list your proxy’s IPs/CIDRs. Never true on a publicly reachable API — clients could spoof their IP and dodge per-IP rate limits.
  • Secrets to set: DATABASE_URL, REDIS_URL, JWT_SECRET (≥32), SMTP_*, ADMIN_*, DATA_ENCRYPTION_KEY, and any GOOGLE_/APPLE_/REVENUECAT/ONESIGNAL integration you enable. In production the API refuses to start without DATABASE_URL, REDIS_URL, JWT_SECRET and DATA_ENCRYPTION_KEY (unset, or still a REPLACE_ME_* placeholder) and names each missing one. Any other key left as a placeholder counts as unset: that integration stays off, and the API lists those keys in a warning at boot.
  • At-rest encryption key: DATA_ENCRYPTION_KEY (openssl rand -base64 32) encrypts admin TOTP secrets in the database — required in production. Once set, never lose or remove it — keep an offline copy. To rotate: move the old key to DATA_ENCRYPTION_PREVIOUS_KEYS, set the new one, restart, run node dist/scripts/encryptAtRest.js, then drop the old key.

App (shipwide_app)

  • Web / PWA: npm run build → static output (keeps pre-compressed .gz/.br assets, useful to an HTTP server). Serve from any static host / CDN. Its origin must be in the API’s CORS_ORIGINS.
  • iOS / Android: the same npm run build (its cap sync step copies the bundle into the native projects; Android skips the .gz/.br copies at packaging) — run it after npm run switch_to_prod (production backend), then open the committed ios/ / android/ projects in Xcode / Android Studio to archive and submit. Toolchain: App → Native builds.
  • Desktop: Tauri bundles from src-tauri/ (Rust stable). Icons via npx tauri icon.

Admin (shipwide_admin)

Docker + nginx, built with --build-arg VITE_*:
nginx serves the SPA (fallback to index.html, hashed assets cached forever / index.html never, noindex + DENY). Outside the image: (1) point ADMIN_URL in the API env at this origin or CORS refuses it; (2) put a network gate in front (Cloudflare Access / IP allowlist) — it reads everyone’s data and needs no public reachability.

Website (shipwide_website)

npm run switch_to_prod (set your domain first), then npm run build (astro-i18next generate + astro check + astro build) → static output; serve from any static host / CDN. PUBLIC_* are inlined at build. To make the support form post to your API, set PUBLIC_SUPPORT_ENDPOINT=https://<your-api-host>/v1/support and add the site origin to the API’s CORS_ORIGINS.