Monorepo: apps/web (Next.js), apps/api (NestJS + BullMQ worker), packages/shared (contracts). HTTPS-only, multi-tenant via PostgreSQL Row-Level Security, transactional outbox for dual-write safety, real-time over Socket.IO. Read top-to-bottom; arrows show request & data flow.
Transactional outbox (ADR-0007) eliminates "DB committed but webhook lost / webhook sent but DB rolled back". Inbound webhooks verify HMAC over the raw body before any DB read (INV-4) and dedup by (source, external_id).
Two enforced layers (ADR-0005): the DB rejects cross-tenant rows via RLS FORCE even if a query forgets the filter; the service layer keeps the GUC contract honest by routing every scoped read/write through the per-request transactional manager. Identity tables (users/orgs/memberships) are intentionally un-scoped so auth can resolve a user before tenant context exists.