Architecture
The generated repository inventory lists current applications, packages, internal dependencies, and public contracts. This page records ownership and constraints that cannot be derived from those registries.
Ownership
@dawn/foundationowns errors and result primitives.@dawn/domainowns healthcare contracts, module definitions and runtime composition, repository ports, and functional services.@dawn/dbowns PostgreSQL schema, migrations, and repository adapters.@dawn/capabilitiesowns transport-neutral operation metadata.@dawn/apibinds capabilities to endpoint schemas, envelopes, OpenAPI, and the transport-neutral client.@dawn/api-clientadapts OpenAPI operations to browser query state.@dawn/api-runtimeowns access resolution, CORS, route composition, workflows, and concrete dependencies.@dawn/uiowns shared shadcn primitives. Applications own product composition and layout.
ESLint rejects imports against this dependency direction. Application source
uses its @ alias for parent imports.
Runtime constraints
Domain services are functions receiving repository ports. They do not import
Next.js, React, Drizzle, PostgreSQL, or provider SDKs. The API creates its
database-backed runtime lazily, caches it for the process, and retains an
explicit close path. Module-owned services are bound through
createModuleRuntime; application runtimes do not instantiate those factories
individually.
The workspace is the tenant boundary. Access tokens resolve a server-owned workspace and member-or-patient actor. Clients cannot select a workspace. Repository filters and composite foreign keys retain workspace scope.
Failure modes
- A prohibited dependency fails lint.
- A malformed access token fails before decoding or domain work.
- A disabled or unavailable module fails at the endpoint policy.
- Invalid path, query, or body data fails through the endpoint decoder.
- A stale mutable-resource update fails with
409; callers reload before retrying. - Database failures remain result values and map to declared API problems.