Storefront has been decoupled into micro-frontends with a dedicated commerce app and shared shell.

Read the architecture guide →

Architecture Constraints

Mandatory technical, organizational, and engineering guardrails for BookWorm.

Architecture

This chapter defines the guardrails for decisions that shape BookWorm across .NET 11 services, Next.js 16 microfrontends, and Aspire 17 orchestration. It separates mandatory constraints from engineering conventions and open commitments: constraints limit options, while principles guide choices and exceptions.

The catalog distinguishes:

  • Mandatory constraints: changes require an approved exception or an architecture decision record (ADR).
  • Engineering conventions: repository standards that automated checks or review should enforce.
  • Open commitments: targets or controls that are not yet signed off and must not be presented as guarantees.

Executive summary

  • Preserve bounded-context ownership and explicit interoperability.
  • Resolve breaking changes through impact and migration planning.
  • Name an owner and approver for every material exception.
  • Enforce platform standards and evidence-based architecture changes.
  • Avoid uncontrolled technology, compliance, vendor, or operational commitments.

BookWorm is an open-source reference architecture. It does not, by itself, establish organization-specific procurement mandates, staffing models, regulatory certification, approved service levels, or named production approvers.

Architecture constraint principles

These principles translate architecture governance into practical BookWorm rules.

  1. Domain ownership is explicit. One bounded context owns one domain and its authoritative data.
  2. Contracts are products. Consumers depend on stable, versioned interfaces owned and evolved by a producer.
  3. Standards reduce variance. Approved runtimes, frameworks, protocols, and verification tools take precedence over local alternatives.
  4. Independent deployment follows compatibility. Deployment autonomy is earned through validated contracts and operational readiness.
  5. Infrastructure is supportive. Shared platform components must not become hidden domain owners or transaction coordinators.
  6. Decisions must be traceable. Material changes include an ADR, updated documentation, and recorded evidence.
  7. Gaps remain visible. Proposed targets remain proposals until scope, owners, budgets, and acceptance evidence are approved.

Technical constraints

IDMandatory constraintBusiness and architectural impactPrimary evidence
TC1Preserve bounded-context data ownership. Each bounded context owns its domain behavior and persistence. Services do not query another service’s database directly.Limits change blast radius, protects domain invariants, and requires explicit cross-boundary contracts.Service boundaries and persistence configuration; BookWorm.ArchTests
TC2Integrate through owned, explicit contracts. Cross-service communication uses versioned HTTP (ApiVersions.V1), Protocol Buffers gRPC, or CloudEvents JSON over Kafka through Wolverine.Gives producers and consumers a stable interoperability surface and makes compatibility a release gate.Contract definitions; Pact and Protocol Buffer verification
TC3Evolve Protocol Buffer contracts compatibly. Lint .proto definitions (edition = "2023") and verify backward compatibility against the committed baseline. Breaking changes require consumer coordination and a migration plan.Prevents incompatible gRPC clients and avoids unplanned rollout coupling..proto lint and compatibility jobs
TC4Use the approved backend stack. Target net11.0, C# 15, BookWorm.slnx, Mediator.SourceGenerator for CQRS, Wolverine and Kafka, Microsoft Entra ID, Aspire 17, and TUnit on Microsoft.Testing.Platform.Standardizes runtime behavior, tooling, observability, identity, and delivery pipelines.Directory.Packages.props, solution projects, CI workflows
TC5Use the approved frontend stack. Use Bun, Turborepo, Next.js 16, React 19, TypeScript, and Better Auth integrated with Microsoft Entra ID across Storefront, Commerce, and Backoffice.Prevents lockfile and dependency-layer drift while preserving consistent identity and delivery behavior.Bun lockfile, Turbo boundaries, frontend CI
TC6Make independent deployability a compatibility property. A service may deploy independently only when the intended contract and behavior remain compatible with consumers.Supports faster, lower-risk releases; breaking changes require a coordinated migration or compatibility period.Contract tests, deployment pipelines, release evidence
TC7Keep shared infrastructure domain-neutral. Notification, Scheduler, API Gateway, and BuildingBlocks must not own commerce domain state or enforce commerce business rules.Prevents shared infrastructure from becoming an implicit coupling point or hidden source of truth.Architecture tests, code ownership, service boundaries
TC8Apply security controls at platform and endpoint boundaries. Authenticate and authorize external requests, protect secrets, and apply PII and AI governance controls where sensitive data or agents are used.Reduces exposure from identity, privacy, and model-integration failures.Endpoint policies, secret configuration, Presidio and AI governance settings

Organizational constraints

IDMandatory constraintEnforcement and governance
OC1Assign bounded-context ownership. Every service, contract, and cross-context flow has an explicit owner and escalation path before production adoption or boundary change.Architecture review confirms ownership; the owning team maintains implementation and contract evolution.
OC2Keep architecture artifacts synchronized. Behavior, contract, persistence, or boundary changes update the relevant architecture views and ADR set.Pull-request review and documentation/architecture fitness checks identify drift.
OC3Protect credentials and toolchain baselines. Secrets remain outside source control. SDK and package-feed configuration changes require explicit approval.GitHub Actions or Azure OIDC, user secrets, or environment variables contain credentials; global.json and NuGet.config remain protected.
OC4Record material architecture decisions. Non-reversible or cross-team decisions require an ADR describing context, options, consequences, and ownership.Accepted ADRs are reviewed and linked to implementation, roadmap, and operational runbooks.
OC5Use evidence for production commitments. Availability, recovery, latency, privacy, security, and AI safeguards require frozen test conditions and recorded evidence.Service owners report evidence; designated review forums grant production status.

Engineering conventions

IDConventionRepository and CI enforcement
C1Use mise tasks for restore, build, test, format, and workspace preparation.Repository task definitions and pre-commit checks provide a repeatable workflow.
C2Keep C# types, async flows, namespaces, and dependencies consistent. Endpoints, handlers, DbContext types, and tests are sealed by default; CancellationToken is propagated; namespaces are file-scoped; package versions are centrally managed..editorconfig, analyzers, Central Package Management, and BookWorm.ArchTests enforce and detect violations.
C3Use snake_case PostgreSQL identifiers and explicit API versioning. Authorization is applied at endpoint boundaries.Naming conventions, migrations, OpenAPI metadata, and endpoint tests preserve consistency.
C4Preserve integration-event naming and routing metadata. Shared contracts live in BookWorm.Contracts; events follow owned naming and identity conventions.Wolverine routing, contract tests, and EventCatalog fitness checks validate interoperability.
C5Validate boundaries continuously. Combine unit, contract, architecture, frontend, and documentation checks.TUnit, PactNet, ArchUnitNET, Vitest, Playwright BDD, Turbo boundaries, and documentation checks form the change-safety gate.

Architecture governance

Architecture governance should make constraints visible, proportionate, and reviewable before implementation.

Governance stageRequired outputDecision authority
Architecture principlesConfirm that the proposal follows the principles in this chapterArchitecture review
Baseline and targetCompare current and target business, application, data, and technology statesProduct and architecture review
Impact assessmentIdentify affected bounded contexts, consumers, data, security, operations, cost, and rollout riskDomain owners and delivery management
Decision and roadmapRecord an ADR and sequence migrations, compatibility periods, and verificationDelegated architecture authority
Implementation reviewDemonstrate contract compatibility, automated checks, operational readiness, and documentation updatesEngineering leads and governance forum
Benefit and risk reviewRecord outcomes and unresolved risks against the approved targetExecutive sponsor and architecture review

Exception process

An exception is a documented, time-bound deviation; it is not an informal bypass.

  1. Identify the constraint or convention, affected systems, and the reason the baseline is unsuitable.
  2. Assess user, security, compliance, delivery, cost, operability, and migration impacts.
  3. Define compensating controls, an expiry or exit condition, and a named accountable owner.
  4. Obtain approval from the authority appropriate to the risk.
  5. Record the exception in an ADR or governed exception register.
  6. Review the exception before expiry and remove or renew it with evidence.

Open commitments and scope limits

The following items require formal approval and are intentionally not represented as current guarantees:

  • Numerical latency, availability, throughput, freshness, recovery, and retention budgets.
  • Named production SLAs, RTO/RPO targets, and contractual compliance obligations.
  • Organization-specific regulatory scope, security certification, vendor procurement, and staffing requirements.
  • End-to-end operational evidence for all proposed quality scenarios.

Unresolved numerical budgets belong in the quality requirements and decisions records rather than this constraint catalog.

  • Engineering StandardsCustom DocEngineering StandardsPractical coding, API, contract, naming, formatting, and analysis rules and how automated checks enforce them.Ownerarchitecture-enabling-teamOpen doc — Detailed backend and frontend coding standards.
  • Solution StrategyCustom DocSolution StrategyExecutive summary of the architectural decisions that satisfy BookWorm's quality goals and constraints.Ownerarchitecture-enabling-teamOpen doc — How BookWorm satisfies quality goals within these constraints.
  • Contracts and MessagingCustom DocContracts and MessagingOwned APIs and events connect independently maintained BookWorm capabilities without sharing business state.Ownerplatform-engineering-teamOpen doc — Detailed gRPC, REST, and Kafka contract rules.
  • Testing and Change SafetyCustom DocTesting and Change SafetyLayered tests and schema checks protect BookWorm behavior, service boundaries, and contract compatibility.Ownerarchitecture-enabling-teamOpen doc — Verification layers enforcing compatibility and boundary rules.
  • Architecture DecisionsCustom DocArchitecture DecisionsNavigable register of whole-system and capability-specific architecture decisions.Ownerarchitecture-enabling-teamOpen doc — Formal decisions behind these constraints.
  • Quality RequirementsCustom DocQuality RequirementsChapter guide to BookWorm's quality attributes, priorities, and measurable scenarios.Ownerarchitecture-enabling-teamOpen doc — Proposed quality targets and measurable scenarios.