krona-staff/docs/adr/ADR-001-technology-and-runtime-modes.md
2026-09-10 23:29:28 +07:00

1.3 KiB

ADR-001: TypeScript service and runtime adapters

  • Status: Accepted for foundation
  • Date: 2026-09-10

Context

Platform contracts are TypeScript, baseline API is REST/OpenAPI 3.1, PostgreSQL/Redis/BullMQ are normative, blocks need independent deployment without duplicating Core identity. Staff business rules are unknown.

Decision

Use Node.js 22 + strict TypeScript, Fastify, PostgreSQL 17, Redis/BullMQ, Zod, Vitest and a single stateless container. Keep domain code behind ports. Select either standalone adapters or platform-gateway adapters through configuration. Use ULID VARCHAR(26), UTC, BIGINT minor money, transactional outbox/inbox and S3 abstraction.

Standalone provides only explicit development tenant/actor references; no durable user/role source. Platform mode fails closed until verified Core JWT/gateway contracts are implemented.

Consequences

The module can deploy separately and share platform contract types with minimal translation. PostgreSQL RLS gives defense in depth. Runtime integration remains explicit work rather than a mocked claim. Fastify adds a different web runtime from Omnichannel, but platform compatibility is contractual, not framework inheritance.

Rejected: copy Omnichannel/Python mechanically; embed inside platform monolith; invent a local identity service; implement HR endpoints before requirements.