Copied
ADR

Architecture Decision Records

On a solo engineering team there is no second human reviewer to catch a boundary violation. Every ADR below is paired with a mechanical enforcement gate in CI (AST boundary test, security drift scanner, or environment contract check).

ADR-001 monorepo Ratified

Clerk for Identity Authentication, PostgreSQL for Role Authority

Session tokens establish who the actor is; PostgreSQL profile records establish what the actor is permitted to do.

Enforced by: withAuth / safeAction actor resolution middleware
ADR-002 apps/client Ratified

Strict Layer Boundaries & Unidirectional Import Flow

HTTP route handlers and Server Actions are thin transport adapters that must never import Prisma directly.

Enforced by: AST boundary test suite in CI
ADR-003 apps/client Ratified

Vertical Domain Slicing Over Horizontal Technical Layers

Organize domain logic into 24 isolated vertical slices communicating only via public service contracts or NATS events.

Enforced by: ESLint & AST import boundary checks
ADR-006 monorepo Ratified

Class A–D Data Classification & Idempotency Replay Sanitization

Prevent Class A (Secrets) and Class B (Sensitive PII) fields from ever persisting in idempotency caches or structured logs.

Enforced by: Zero-PII Pino log sanitizer + DTO mapper unit tests
ADR-010 apps/workers Ratified

Background Worker Daemon Isolation from Web Runtime

Offload NATS JetStream consumers, BullMQ queues, Sharp image encoding, and BoQ PDF compilation to a standalone Node.js 24 daemon.

Enforced by: Package dependency boundaries + container liveness probe
ADR-ADMIN-001 apps/admin Ratified

Capability-Based Admin Authorization & Tiered Step-Up Freshness

Why administrative mutations resolve permissions from a database AdminProfile on every request and require step-up re-authentication.

Enforced by: pnpm run admin:report-security-drift:strict (0 findings across 309 files)
ADR-ADMIN-008 apps/admin Ratified

Declarative Audit Logging Inside safeAction

Eliminate manual audit-log omission bugs by making audit metadata a required declarative property of high-risk action definitions.

Enforced by: TypeScript compiler contract on safeAction + security drift scanner
ADR-ADMIN-009 apps/admin Ratified

Strangler-Fig Migrations via Typed Feature Flags with Expiry Governance

Migrate legacy administrative verticals behind typed feature flags enforced by automated CI expiration checks.

Enforced by: pnpm run admin:check-governance