Engineering Standards
Practical coding, API, contract, naming, formatting, and analysis rules and how automated checks enforce them.
Apply these standards at the boundary where a change is made. Automated checks catch many violations, but passing CI does not replace clear ownership or compatible contracts.
Keep business logic inside its owning service, preserve public contract compatibility, propagate cancellation through asynchronous work, and never commit credentials. Do not introduce MediatR; request handling uses the existing source-generated mediator.
Rules and enforcement
| Area | Follow | How it is enforced |
|---|---|---|
| Service design | Use Domain-Driven Design and Vertical Slice Architecture. Services own their business rules and persistence; do not add direct service-to-service project dependencies. | Architecture tests and review |
| C# | Prefer nullable-aware, file-scoped code. Seal endpoints, handlers, DbContexts, integration events, and test classes by default. Keep warnings actionable. | Compiler warnings as errors, Roslyn analyzers, architecture tests |
| Async work | Use async/await end to end and pass CancellationToken through every asynchronous boundary. | Analyzers and review |
| Requests and APIs | Keep endpoint handlers focused; use explicit API versions and apply authorization at the endpoint boundary. Validate input and return consistent errors. | Build checks, tests, and review |
| Messaging contracts | Name events [Action][Entity]IntegrationEvent. Publish only fields consumers need; preserve message identity and ownership metadata. | Pact contract tests and review |
| Protocol Buffers | Lint schemas, check backward compatibility, and regenerate the schema lock after an intentional change. | Buf checks and consumer coordination |
| PostgreSQL | Use snake_case for identifiers, columns, tables, and raw SQL. | Review and database tests |
| Frontend | Use Bun, keep workspace imports within the allowed dependency direction, avoid any, and provide accessible interactions. | Boundary checks, TypeScript checks, ESLint |
| Formatting | Apply the repository formatter to changed files; do not suppress a formatter or analyzer finding globally. | Git hooks and CI |
Run the relevant checks
- Backend:
mise run build, then the relevant test task from Testing ExecutionCustom DocTesting ExecutionHow to run backend, frontend, contract, browser, and documentation checks locally and interpret their results.Ownerarchitecture-enabling-teamOpen doc. - Frontend: run
bun run boundaries,bun run check-types, andbun run lintin the frontend workspace. - Protocol Buffers: after installing Buf with
mise run setup:buf, runbuf lint,buf breaking --against lock.binpb, andbuf build -o lock.binpbfrom the schema workspace. Commit the schema and refreshed lock together. - Formatting: use
mise run format:cs,mise run format:fe, ormise run format:docsfor the changed area.
CI repeats the applicable format, analyzer, architecture, boundary, contract, and test checks. See Testing MatrixCustom DocTesting MatrixReference tables for test scope, dependencies, local and CI execution triggers, and passing criteria.Ownerarchitecture-enabling-teamOpen doc for which suites apply and Pull Request ProcessCustom DocPull Request ProcessPrepare a focused draft, satisfy automated checks and review, and merge a contribution safely.Ownerarchitecture-enabling-teamOpen doc for merge requirements.