0003 — NestJS + Fastify backend, one image for two apps¶
Status: reconstructed — needs confirmation
Context¶
The platform needs a customer-facing API and a separate admin API with different auth models, sharing entities, config, and integrations.
Decision¶
aim-digigold-real/ is a NestJS 10 monorepo (nest-cli.json,
"monorepo": true) with two apps — apps/api (port 3000) and
apps/admin-api (port 3001) — and eight shared libs (libs/common,
config, database, events, razorpay, redis, safegold, storage).
Both apps run on the Fastify adapter (main.ts), not Express. One Docker
image (Dockerfile, 3-stage, node:20-alpine) contains both compiled apps;
the compose command: picks which one a container runs
(deploy/docker-compose.yml).
Consequences¶
- Shared code lives in libs; the two APIs can never drift on entity shape.
- One image = one build per deploy, but
apiandadmin_apialways deploy together (no independent rollout). - Fastify implies fastify-flavored middleware (e.g. raw-body handling for webhooks) rather than Express idioms.