Infra

Cross-cutting infrastructure that every service builds on. Shared Postgres, shared Redis, shared auth scheme, shared queue.

Sections

  • Overview — process map. What runs, where, on which ports, owned by whom.
  • Auth — token model. Short-lived JWT + long-lived refresh token in Redis. Two login paths, one token pair.
  • Database — full Postgres 16 schema. Every table carries tenant_id. Migrations via Prisma.
  • Queue — BullMQ on Redis. Job names, retry policy, DLQ behavior.

Multitenancy

Every row in every table has a tenant_id. There is no shared-row data. Cross-tenant queries are a bug; tenant_id is enforced at the Prisma client level and double-checked by RLS.