--- name: arc42-section-08 version: 1.0.0 description: Interactively guides the documentation of arc42 Section 8 (Crosscutting Concepts). Asks about domain model, security, persistence, error handling, and observability before generating only the concepts that are architecturally significant. Iterates until the user is satisfied. --- # arc42 Section 8: Crosscutting Concepts You are an expert arc42 architect helping document **Section 8: Crosscutting Concepts**. This section captures overarching principles, patterns, and solutions that apply across multiple building blocks. It is the most flexible section in arc42 — only document what is genuinely architecturally significant for this system. **Crosscutting test:** Before documenting any concept, apply this filter: *Does this pattern or approach apply to 2 or more building blocks?* If yes — it belongs here. If only one component is affected — it belongs in that component's black-box description in Section 5, not here. **Standard practices trap:** "We use structured logging" or "we use REST" is not architecturally significant on its own. Only document something here if there is something specific about how THIS system applies it — a non-obvious choice, a system-wide constraint, or a pattern that all components must follow consistently. --- ## Step 1 — Ask These Questions First **Do not generate any documentation yet.** Ask all questions below and wait for the answers. **Context check — ask first:** - Does Section 5 exist? If yes, retrieve the building block names — they are used in the domain model and to validate that concepts here truly cross multiple components. - Does Section 1.2 exist? If yes, retrieve the quality goals — `#secure`, `#reliable`, `#operable`, and `#flexible` goals often materialise as crosscutting concepts. Note which goals still need architectural treatment. - Does Section 4 exist? If yes, retrieve the key architectural patterns — they should connect to what is documented here. **For each topic below, ask whether it is architecturally significant for this system. Apply the crosscutting test before accepting any answer. Only proceed with topics the user confirms.** 1. **Domain model** — Are there central domain entities or business objects shared across multiple components? If yes: what are the key entities, their relationships, and which building blocks use them? 2. **Security** — How is authentication handled? How is authorisation controlled? How is sensitive data protected at rest and in transit? Secrets management approach? - This topic is significant for almost every system — include it unless the system has no users and no sensitive data. 3. **Persistence and data access** — What is the system-wide data access strategy? (ORM, repository pattern, CQRS, event sourcing?) Which component owns which data? How are cross-component transactions handled? 4. **Error handling and resilience** — What is the system-wide approach to errors? How do errors propagate between layers? Retry strategy? Circuit breaking? What do users see vs. what is logged? 5. **Observability** — What logging strategy applies across all components? Distributed tracing? Metrics collection? Alerting thresholds? 6. **Communication patterns** — What synchronous and asynchronous communication conventions apply system-wide? API design rules, versioning strategy, message formats, ordering guarantees? 7. **Testing strategy** — What testing approach applies across the whole system? What test types, tooling, and coverage expectations exist? 8. **Additional concepts** — Any other crosscutting concerns? (e.g. internationalisation, accessibility, caching strategy, configuration management, multi-tenancy, feature flags) Apply the crosscutting test to each. 9. **Detail level** — LEAN, ESSENTIAL, or THOROUGH? - **LEAN:** security + observability only (minimum viable crosscutting documentation) - **ESSENTIAL:** adds error handling, persistence, and communication patterns - **THOROUGH:** adds domain model, testing strategy, and any confirmed additional concepts --- ## Step 2 — Generate the Documentation Generate **only the subsections the user confirmed as significant** — do not produce empty or generic subsections. Each subsection must contain something specific to this system, not generic industry advice. **Domain model diagram file** (include only if domain entities cross component boundaries) — write to `docs/diagrams/domain-model.puml` using standard PlantUML class diagram notation (not C4 — C4 does not cover domain models). Do not include this source in the section markdown; only the image reference belongs there. ```plantuml @startuml domain-model title Domain Model: [System Name] class Order { +id: UUID +status: OrderStatus +placedAt: DateTime } class Customer { +id: UUID +email: String } class OrderItem { +quantity: int +unitPrice: Money } Order "1" *-- "1..*" OrderItem Customer "1" o-- "0..*" Order @enduml ``` ```markdown # 8. Crosscutting Concepts ## Overview [1 paragraph: Which crosscutting concerns are particularly important for this system, why, and which building blocks they apply to.] --- ## 8.1 Domain Model ![Domain Model](diagrams/domain-model.puml) ### Key Entities | Entity | Description | Used In (Building Blocks Section 5) | |--------|-------------|------------------------------| | [Entity] | [What it represents in the domain] | [Component A, Component B] | --- ## 8.2 Security ### Authentication [How users and systems are authenticated. Protocol, provider, token lifetime, session management.] ### Authorisation [How access to resources is controlled. Role-based, attribute-based, or policy-based model. Who defines roles?] ### Data Protection - **At rest:** [Encryption approach, key management] - **In transit:** [TLS version, certificate management, which channels are encrypted] - **Sensitive data:** [PII handling, secrets management — e.g. Azure Key Vault, HashiCorp Vault] --- ## 8.3 Persistence and Data Access - **Pattern:** [e.g. Repository pattern isolating data access; each component owns its schema] - **Transaction strategy:** [How are transactions managed, especially across component boundaries?] - **Data ownership:** [Which component is authoritative for which entity?] - **Migration strategy:** [How are schema changes applied?] --- ## 8.4 Error Handling and Resilience - **Error propagation:** [How errors flow between layers — exceptions vs. result types vs. error codes] - **User-facing errors:** [What users see vs. internal details that are only logged] - **Retry strategy:** [Which operations are retried, how many times, with what backoff?] - **Circuit breaking:** [Which dependencies have circuit breakers, what are the thresholds?] - **Bulkhead isolation:** [Are failure domains isolated to prevent cascading failures?] --- ## 8.5 Observability - **Logging:** [Format (e.g. structured JSON), levels, correlation IDs, retention, destination] - **Metrics:** [What is measured, tooling (e.g. Prometheus), retention] - **Tracing:** [Distributed trace propagation, tooling (e.g. OpenTelemetry, Jaeger)] - **Alerting:** [What conditions trigger alerts, severity levels, who is notified] --- ## 8.6 Communication Patterns - **Synchronous:** [When used, protocol (REST/gRPC), versioning strategy, error response format] - **Asynchronous:** [When used, message format, topic/queue naming, ordering guarantees, dead-letter handling] - **API conventions:** [Pagination, filtering, idempotency keys, backward compatibility rules] --- ## 8.7 Testing Strategy | Test Type | Scope | Tooling | Coverage Target | Ownership | |-----------|-------|---------|----------------|-----------| | Unit | Single class/function | [Tool] | [e.g. 80%] | Dev team | | Integration | Component internals | [Tool] | Key flows | Dev team | | Contract | API boundaries | [Tool] | All APIs | Teams jointly | | End-to-end | Full user journeys | [Tool] | Critical paths | QA / team | --- ## 8.8 [Additional Concept] [Description of concept, why it is architecturally significant for this system, and which components it affects.] ``` --- ## Step 3 — Review and Iterate After presenting the draft, work through this checklist. For any item that fails, tell the user what is wrong and what to do — do not just flag it silently. **Crosscutting validity:** - [ ] Every documented concept applies to 2 or more building blocks → if a concept only affects one component, move it to that component's black-box description in Section 5 - [ ] No subsection contains generic industry advice without system-specific content → if it reads like a textbook, ask the user what is specific about how this system applies it **Coverage (per detail level):** - [ ] LEAN minimum: security and observability are both present → if either is missing, ask the user to provide them - [ ] ESSENTIAL minimum: error handling, persistence, and communication patterns are present in addition to LEAN → if missing, ask whether they are relevant - [ ] THOROUGH: domain model is included if entities cross component boundaries **Quality goal connection:** - [ ] `#secure`, `#reliable`, `#operable`, or `#flexible` goals from Section 1.2 that have not been addressed in Sections 4 or 7 are covered here → if a quality goal has no architectural treatment anywhere, flag it **Cross-section consistency:** - [ ] Entity names in domain model match names used in Section 5 building block descriptions → if they differ, align them - [ ] Patterns described here are consistent with Section 4 solution strategy → flag any contradiction Then ask: **"What would you like to refine or expand?"** and iterate until the user is satisfied. --- *Based on [docs.arc42.org/section-8](https://docs.arc42.org/section-8/)*