Architecture Document Template (Directory Structure)
Template for generating architecture decision documents as a directory of individual ADR files in Phase 4.
Usage Context
| Phase |
Usage |
| Phase 4 (Architecture) |
Generate architecture/ directory from requirements analysis |
| Output Location |
{workDir}/architecture/ |
Output Structure
Template: _index.md
Component Architecture
Component Diagram
Component Descriptions
| Component |
Responsibility |
Technology |
Dependencies |
| {component_name} |
{what it does} |
{tech stack} |
{depends on} |
Technology Stack
Core Technologies
| Layer |
Technology |
Version |
Rationale |
| Frontend |
{technology} |
{version} |
{why chosen} |
| Backend |
{technology} |
{version} |
{why chosen} |
| Database |
{technology} |
{version} |
{why chosen} |
| Infrastructure |
{technology} |
{version} |
{why chosen} |
Key Libraries & Frameworks
| Library |
Purpose |
License |
| {library_name} |
{purpose} |
{license} |
Architecture Decision Records
| ADR |
Title |
Status |
Key Choice |
| ADR-001 |
{title} |
Accepted |
{one-line summary} |
| ADR-002 |
{title} |
Accepted |
{one-line summary} |
| ADR-003 |
{title} |
Proposed |
{one-line summary} |
Data Architecture
Data Model
Data Storage Strategy
| Data Type |
Storage |
Retention |
Backup |
| {type} |
{storage solution} |
{retention policy} |
{backup strategy} |
API Design
API Overview
| Endpoint |
Method |
Purpose |
Auth |
| {/api/resource} |
{GET/POST/etc} |
{purpose} |
{auth type} |
Security Architecture
Security Controls
Infrastructure & Deployment
Deployment Architecture
{description of deployment model: containers, serverless, VMs, etc.}
Environment Strategy
| Environment |
Purpose |
Configuration |
| Development |
Local development |
{config} |
| Staging |
Pre-production testing |
{config} |
| Production |
Live system |
{config} |
Codebase Integration
{if has_codebase is true:}
Existing Code Mapping
| New Component |
Existing Module |
Integration Type |
Notes |
| {component} |
{existing module path} |
Extend/Replace/New |
{notes} |
Migration Notes
{any migration considerations for existing code}
Quality Attributes
| Attribute |
Target |
Measurement |
ADR Reference |
| Performance |
{target} |
{how measured} |
ADR-{NNN} |
| Scalability |
{target} |
{how measured} |
ADR-{NNN} |
| Reliability |
{target} |
{how measured} |
ADR-{NNN} |
State Machine
{For each core entity with a lifecycle (e.g., Order, Session, Task):}
{Entity} Lifecycle
| From State |
Event |
To State |
Side Effects |
Error Handling |
| {from} |
{event} |
{to} |
{side_effects} |
{error_behavior} |
Configuration Model
Required Configuration
| Field |
Type |
Default |
Constraint |
Description |
| {field_name} |
{string/number/boolean/enum} |
{default_value} |
{validation rule} |
{description} |
Optional Configuration
| Field |
Type |
Default |
Constraint |
Description |
| {field_name} |
{type} |
{default} |
{constraint} |
{description} |
Environment Variables
| Variable |
Maps To |
Required |
| {ENV_VAR} |
{config_field} |
{yes/no} |
Error Handling
Error Classification
| Category |
Severity |
Retry |
Example |
| Transient |
Low |
Yes, with backoff |
Network timeout, rate limit |
| Permanent |
High |
No |
Invalid configuration, auth failure |
| Degraded |
Medium |
Partial |
Dependency unavailable, fallback active |
Per-Component Error Strategy
| Component |
Error Scenario |
Behavior |
Recovery |
| {component} |
{scenario} |
{MUST/SHOULD behavior} |
{recovery strategy} |
Observability
Metrics
| Metric Name |
Type |
Labels |
Description |
| {metric_name} |
{counter/gauge/histogram} |
{label1, label2} |
{what it measures} |
Logging
| Event |
Level |
Fields |
Description |
| {event_name} |
{INFO/WARN/ERROR} |
{structured fields} |
{when logged} |
Health Checks
| Check |
Endpoint |
Interval |
Failure Action |
| {check_name} |
{/health/xxx} |
{duration} |
{action on failure} |
Trust & Safety
Trust Levels
| Level |
Description |
Approval Required |
Allowed Operations |
| High Trust |
{description} |
None |
{operations} |
| Standard |
{description} |
{approval type} |
{operations} |
| Low Trust |
{description} |
{approval type} |
{operations} |
Security Controls
{Detailed security controls beyond the basic auth covered in Security Architecture}
Implementation Guidance
Key Decisions for Implementers
| Decision |
Options |
Recommendation |
Rationale |
| {decision_area} |
{option_1, option_2} |
{recommended} |
{why} |
Implementation Order
- {component/module 1}: {why first}
- {component/module 2}: {depends on #1}
Testing Strategy
| Layer |
Scope |
Tools |
Coverage Target |
| Unit |
{scope} |
{tools} |
{target} |
| Integration |
{scope} |
{tools} |
{target} |
| E2E |
{scope} |
{tools} |
{target} |
Risks & Mitigations
| Risk |
Impact |
Probability |
Mitigation |
| {risk} |
High/Medium/Low |
High/Medium/Low |
{mitigation approach} |
Open Questions
References
Variable Descriptions
| Variable |
Source |
Description |
{session_id} |
spec-config.json |
Session identifier |
{timestamp} |
Runtime |
ISO8601 generation timestamp |
{product_name} |
product-brief.md |
Product/feature name |
{NNN} |
Auto-increment |
ADR/requirement number |
{slug} |
Auto-generated |
Kebab-case from decision title |
{has_codebase} |
spec-config.json |
Whether existing codebase exists |