fullstack-architecture-tmpl.yaml 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824
  1. # <!-- Powered by BMAD™ Core -->
  2. template:
  3. id: fullstack-architecture-template-v2
  4. name: Fullstack Architecture Document
  5. version: 2.0
  6. output:
  7. format: markdown
  8. filename: docs/architecture.md
  9. title: "{{project_name}} Fullstack Architecture Document"
  10. workflow:
  11. mode: interactive
  12. elicitation: advanced-elicitation
  13. sections:
  14. - id: introduction
  15. title: Introduction
  16. instruction: |
  17. If available, review any provided relevant documents to gather all relevant context before beginning. At minimum, you should have access to docs/prd.md and docs/front-end-spec.md. Ask the user for any documents you need but cannot locate. This template creates a unified architecture that covers both backend and frontend concerns to guide AI-driven fullstack development.
  18. elicit: true
  19. content: |
  20. This document outlines the complete fullstack architecture for {{project_name}}, including backend systems, frontend implementation, and their integration. It serves as the single source of truth for AI-driven development, ensuring consistency across the entire technology stack.
  21. This unified approach combines what would traditionally be separate backend and frontend architecture documents, streamlining the development process for modern fullstack applications where these concerns are increasingly intertwined.
  22. sections:
  23. - id: starter-template
  24. title: Starter Template or Existing Project
  25. instruction: |
  26. Before proceeding with architecture design, check if the project is based on any starter templates or existing codebases:
  27. 1. Review the PRD and other documents for mentions of:
  28. - Fullstack starter templates (e.g., T3 Stack, MEAN/MERN starters, Django + React templates)
  29. - Monorepo templates (e.g., Nx, Turborepo starters)
  30. - Platform-specific starters (e.g., Vercel templates, AWS Amplify starters)
  31. - Existing projects being extended or cloned
  32. 2. If starter templates or existing projects are mentioned:
  33. - Ask the user to provide access (links, repos, or files)
  34. - Analyze to understand pre-configured choices and constraints
  35. - Note any architectural decisions already made
  36. - Identify what can be modified vs what must be retained
  37. 3. If no starter is mentioned but this is greenfield:
  38. - Suggest appropriate fullstack starters based on tech preferences
  39. - Consider platform-specific options (Vercel, AWS, etc.)
  40. - Let user decide whether to use one
  41. 4. Document the decision and any constraints it imposes
  42. If none, state "N/A - Greenfield project"
  43. - id: changelog
  44. title: Change Log
  45. type: table
  46. columns: [Date, Version, Description, Author]
  47. instruction: Track document versions and changes
  48. - id: high-level-architecture
  49. title: High Level Architecture
  50. instruction: This section contains multiple subsections that establish the foundation. Present all subsections together, then elicit feedback on the complete section.
  51. elicit: true
  52. sections:
  53. - id: technical-summary
  54. title: Technical Summary
  55. instruction: |
  56. Provide a comprehensive overview (4-6 sentences) covering:
  57. - Overall architectural style and deployment approach
  58. - Frontend framework and backend technology choices
  59. - Key integration points between frontend and backend
  60. - Infrastructure platform and services
  61. - How this architecture achieves PRD goals
  62. - id: platform-infrastructure
  63. title: Platform and Infrastructure Choice
  64. instruction: |
  65. Based on PRD requirements and technical assumptions, make a platform recommendation:
  66. 1. Consider common patterns (not an exhaustive list, use your own best judgement and search the web as needed for emerging trends):
  67. - **Vercel + Supabase**: For rapid development with Next.js, built-in auth/storage
  68. - **AWS Full Stack**: For enterprise scale with Lambda, API Gateway, S3, Cognito
  69. - **Azure**: For .NET ecosystems or enterprise Microsoft environments
  70. - **Google Cloud**: For ML/AI heavy applications or Google ecosystem integration
  71. 2. Present 2-3 viable options with clear pros/cons
  72. 3. Make a recommendation with rationale
  73. 4. Get explicit user confirmation
  74. Document the choice and key services that will be used.
  75. template: |
  76. **Platform:** {{selected_platform}}
  77. **Key Services:** {{core_services_list}}
  78. **Deployment Host and Regions:** {{regions}}
  79. - id: repository-structure
  80. title: Repository Structure
  81. instruction: |
  82. Define the repository approach based on PRD requirements and platform choice, explain your rationale or ask questions to the user if unsure:
  83. 1. For modern fullstack apps, monorepo is often preferred
  84. 2. Consider tooling (Nx, Turborepo, Lerna, npm workspaces)
  85. 3. Define package/app boundaries
  86. 4. Plan for shared code between frontend and backend
  87. template: |
  88. **Structure:** {{repo_structure_choice}}
  89. **Monorepo Tool:** {{monorepo_tool_if_applicable}}
  90. **Package Organization:** {{package_strategy}}
  91. - id: architecture-diagram
  92. title: High Level Architecture Diagram
  93. type: mermaid
  94. mermaid_type: graph
  95. instruction: |
  96. Create a Mermaid diagram showing the complete system architecture including:
  97. - User entry points (web, mobile)
  98. - Frontend application deployment
  99. - API layer (REST/GraphQL)
  100. - Backend services
  101. - Databases and storage
  102. - External integrations
  103. - CDN and caching layers
  104. Use appropriate diagram type for clarity.
  105. - id: architectural-patterns
  106. title: Architectural Patterns
  107. instruction: |
  108. List patterns that will guide both frontend and backend development. Include patterns for:
  109. - Overall architecture (e.g., Jamstack, Serverless, Microservices)
  110. - Frontend patterns (e.g., Component-based, State management)
  111. - Backend patterns (e.g., Repository, CQRS, Event-driven)
  112. - Integration patterns (e.g., BFF, API Gateway)
  113. For each pattern, provide recommendation and rationale.
  114. repeatable: true
  115. template: "- **{{pattern_name}}:** {{pattern_description}} - _Rationale:_ {{rationale}}"
  116. examples:
  117. - "**Jamstack Architecture:** Static site generation with serverless APIs - _Rationale:_ Optimal performance and scalability for content-heavy applications"
  118. - "**Component-Based UI:** Reusable React components with TypeScript - _Rationale:_ Maintainability and type safety across large codebases"
  119. - "**Repository Pattern:** Abstract data access logic - _Rationale:_ Enables testing and future database migration flexibility"
  120. - "**API Gateway Pattern:** Single entry point for all API calls - _Rationale:_ Centralized auth, rate limiting, and monitoring"
  121. - id: tech-stack
  122. title: Tech Stack
  123. instruction: |
  124. This is the DEFINITIVE technology selection for the entire project. Work with user to finalize all choices. This table is the single source of truth - all development must use these exact versions.
  125. Key areas to cover:
  126. - Frontend and backend languages/frameworks
  127. - Databases and caching
  128. - Authentication and authorization
  129. - API approach
  130. - Testing tools for both frontend and backend
  131. - Build and deployment tools
  132. - Monitoring and logging
  133. Upon render, elicit feedback immediately.
  134. elicit: true
  135. sections:
  136. - id: tech-stack-table
  137. title: Technology Stack Table
  138. type: table
  139. columns: [Category, Technology, Version, Purpose, Rationale]
  140. rows:
  141. - ["Frontend Language", "{{fe_language}}", "{{version}}", "{{purpose}}", "{{why_chosen}}"]
  142. - [
  143. "Frontend Framework",
  144. "{{fe_framework}}",
  145. "{{version}}",
  146. "{{purpose}}",
  147. "{{why_chosen}}",
  148. ]
  149. - [
  150. "UI Component Library",
  151. "{{ui_library}}",
  152. "{{version}}",
  153. "{{purpose}}",
  154. "{{why_chosen}}",
  155. ]
  156. - ["State Management", "{{state_mgmt}}", "{{version}}", "{{purpose}}", "{{why_chosen}}"]
  157. - ["Backend Language", "{{be_language}}", "{{version}}", "{{purpose}}", "{{why_chosen}}"]
  158. - [
  159. "Backend Framework",
  160. "{{be_framework}}",
  161. "{{version}}",
  162. "{{purpose}}",
  163. "{{why_chosen}}",
  164. ]
  165. - ["API Style", "{{api_style}}", "{{version}}", "{{purpose}}", "{{why_chosen}}"]
  166. - ["Database", "{{database}}", "{{version}}", "{{purpose}}", "{{why_chosen}}"]
  167. - ["Cache", "{{cache}}", "{{version}}", "{{purpose}}", "{{why_chosen}}"]
  168. - ["File Storage", "{{storage}}", "{{version}}", "{{purpose}}", "{{why_chosen}}"]
  169. - ["Authentication", "{{auth}}", "{{version}}", "{{purpose}}", "{{why_chosen}}"]
  170. - ["Frontend Testing", "{{fe_test}}", "{{version}}", "{{purpose}}", "{{why_chosen}}"]
  171. - ["Backend Testing", "{{be_test}}", "{{version}}", "{{purpose}}", "{{why_chosen}}"]
  172. - ["E2E Testing", "{{e2e_test}}", "{{version}}", "{{purpose}}", "{{why_chosen}}"]
  173. - ["Build Tool", "{{build_tool}}", "{{version}}", "{{purpose}}", "{{why_chosen}}"]
  174. - ["Bundler", "{{bundler}}", "{{version}}", "{{purpose}}", "{{why_chosen}}"]
  175. - ["IaC Tool", "{{iac_tool}}", "{{version}}", "{{purpose}}", "{{why_chosen}}"]
  176. - ["CI/CD", "{{cicd}}", "{{version}}", "{{purpose}}", "{{why_chosen}}"]
  177. - ["Monitoring", "{{monitoring}}", "{{version}}", "{{purpose}}", "{{why_chosen}}"]
  178. - ["Logging", "{{logging}}", "{{version}}", "{{purpose}}", "{{why_chosen}}"]
  179. - ["CSS Framework", "{{css_framework}}", "{{version}}", "{{purpose}}", "{{why_chosen}}"]
  180. - id: data-models
  181. title: Data Models
  182. instruction: |
  183. Define the core data models/entities that will be shared between frontend and backend:
  184. 1. Review PRD requirements and identify key business entities
  185. 2. For each model, explain its purpose and relationships
  186. 3. Include key attributes and data types
  187. 4. Show relationships between models
  188. 5. Create TypeScript interfaces that can be shared
  189. 6. Discuss design decisions with user
  190. Create a clear conceptual model before moving to database schema.
  191. elicit: true
  192. repeatable: true
  193. sections:
  194. - id: model
  195. title: "{{model_name}}"
  196. template: |
  197. **Purpose:** {{model_purpose}}
  198. **Key Attributes:**
  199. - {{attribute_1}}: {{type_1}} - {{description_1}}
  200. - {{attribute_2}}: {{type_2}} - {{description_2}}
  201. sections:
  202. - id: typescript-interface
  203. title: TypeScript Interface
  204. type: code
  205. language: typescript
  206. template: "{{model_interface}}"
  207. - id: relationships
  208. title: Relationships
  209. type: bullet-list
  210. template: "- {{relationship}}"
  211. - id: api-spec
  212. title: API Specification
  213. instruction: |
  214. Based on the chosen API style from Tech Stack:
  215. 1. If REST API, create an OpenAPI 3.0 specification
  216. 2. If GraphQL, provide the GraphQL schema
  217. 3. If tRPC, show router definitions
  218. 4. Include all endpoints from epics/stories
  219. 5. Define request/response schemas based on data models
  220. 6. Document authentication requirements
  221. 7. Include example requests/responses
  222. Use appropriate format for the chosen API style. If no API (e.g., static site), skip this section.
  223. elicit: true
  224. sections:
  225. - id: rest-api
  226. title: REST API Specification
  227. condition: API style is REST
  228. type: code
  229. language: yaml
  230. template: |
  231. openapi: 3.0.0
  232. info:
  233. title: {{api_title}}
  234. version: {{api_version}}
  235. description: {{api_description}}
  236. servers:
  237. - url: {{server_url}}
  238. description: {{server_description}}
  239. - id: graphql-api
  240. title: GraphQL Schema
  241. condition: API style is GraphQL
  242. type: code
  243. language: graphql
  244. template: "{{graphql_schema}}"
  245. - id: trpc-api
  246. title: tRPC Router Definitions
  247. condition: API style is tRPC
  248. type: code
  249. language: typescript
  250. template: "{{trpc_routers}}"
  251. - id: components
  252. title: Components
  253. instruction: |
  254. Based on the architectural patterns, tech stack, and data models from above:
  255. 1. Identify major logical components/services across the fullstack
  256. 2. Consider both frontend and backend components
  257. 3. Define clear boundaries and interfaces between components
  258. 4. For each component, specify:
  259. - Primary responsibility
  260. - Key interfaces/APIs exposed
  261. - Dependencies on other components
  262. - Technology specifics based on tech stack choices
  263. 5. Create component diagrams where helpful
  264. elicit: true
  265. sections:
  266. - id: component-list
  267. repeatable: true
  268. title: "{{component_name}}"
  269. template: |
  270. **Responsibility:** {{component_description}}
  271. **Key Interfaces:**
  272. - {{interface_1}}
  273. - {{interface_2}}
  274. **Dependencies:** {{dependencies}}
  275. **Technology Stack:** {{component_tech_details}}
  276. - id: component-diagrams
  277. title: Component Diagrams
  278. type: mermaid
  279. instruction: |
  280. Create Mermaid diagrams to visualize component relationships. Options:
  281. - C4 Container diagram for high-level view
  282. - Component diagram for detailed internal structure
  283. - Sequence diagrams for complex interactions
  284. Choose the most appropriate for clarity
  285. - id: external-apis
  286. title: External APIs
  287. condition: Project requires external API integrations
  288. instruction: |
  289. For each external service integration:
  290. 1. Identify APIs needed based on PRD requirements and component design
  291. 2. If documentation URLs are unknown, ask user for specifics
  292. 3. Document authentication methods and security considerations
  293. 4. List specific endpoints that will be used
  294. 5. Note any rate limits or usage constraints
  295. If no external APIs are needed, state this explicitly and skip to next section.
  296. elicit: true
  297. repeatable: true
  298. sections:
  299. - id: api
  300. title: "{{api_name}} API"
  301. template: |
  302. - **Purpose:** {{api_purpose}}
  303. - **Documentation:** {{api_docs_url}}
  304. - **Base URL(s):** {{api_base_url}}
  305. - **Authentication:** {{auth_method}}
  306. - **Rate Limits:** {{rate_limits}}
  307. **Key Endpoints Used:**
  308. - `{{method}} {{endpoint_path}}` - {{endpoint_purpose}}
  309. **Integration Notes:** {{integration_considerations}}
  310. - id: core-workflows
  311. title: Core Workflows
  312. type: mermaid
  313. mermaid_type: sequence
  314. instruction: |
  315. Illustrate key system workflows using sequence diagrams:
  316. 1. Identify critical user journeys from PRD
  317. 2. Show component interactions including external APIs
  318. 3. Include both frontend and backend flows
  319. 4. Include error handling paths
  320. 5. Document async operations
  321. 6. Create both high-level and detailed diagrams as needed
  322. Focus on workflows that clarify architecture decisions or complex interactions.
  323. elicit: true
  324. - id: database-schema
  325. title: Database Schema
  326. instruction: |
  327. Transform the conceptual data models into concrete database schemas:
  328. 1. Use the database type(s) selected in Tech Stack
  329. 2. Create schema definitions using appropriate notation
  330. 3. Include indexes, constraints, and relationships
  331. 4. Consider performance and scalability
  332. 5. For NoSQL, show document structures
  333. Present schema in format appropriate to database type (SQL DDL, JSON schema, etc.)
  334. elicit: true
  335. - id: frontend-architecture
  336. title: Frontend Architecture
  337. instruction: Define frontend-specific architecture details. After each subsection, note if user wants to refine before continuing.
  338. elicit: true
  339. sections:
  340. - id: component-architecture
  341. title: Component Architecture
  342. instruction: Define component organization and patterns based on chosen framework.
  343. sections:
  344. - id: component-organization
  345. title: Component Organization
  346. type: code
  347. language: text
  348. template: "{{component_structure}}"
  349. - id: component-template
  350. title: Component Template
  351. type: code
  352. language: typescript
  353. template: "{{component_template}}"
  354. - id: state-management
  355. title: State Management Architecture
  356. instruction: Detail state management approach based on chosen solution.
  357. sections:
  358. - id: state-structure
  359. title: State Structure
  360. type: code
  361. language: typescript
  362. template: "{{state_structure}}"
  363. - id: state-patterns
  364. title: State Management Patterns
  365. type: bullet-list
  366. template: "- {{pattern}}"
  367. - id: routing-architecture
  368. title: Routing Architecture
  369. instruction: Define routing structure based on framework choice.
  370. sections:
  371. - id: route-organization
  372. title: Route Organization
  373. type: code
  374. language: text
  375. template: "{{route_structure}}"
  376. - id: protected-routes
  377. title: Protected Route Pattern
  378. type: code
  379. language: typescript
  380. template: "{{protected_route_example}}"
  381. - id: frontend-services
  382. title: Frontend Services Layer
  383. instruction: Define how frontend communicates with backend.
  384. sections:
  385. - id: api-client-setup
  386. title: API Client Setup
  387. type: code
  388. language: typescript
  389. template: "{{api_client_setup}}"
  390. - id: service-example
  391. title: Service Example
  392. type: code
  393. language: typescript
  394. template: "{{service_example}}"
  395. - id: backend-architecture
  396. title: Backend Architecture
  397. instruction: Define backend-specific architecture details. Consider serverless vs traditional server approaches.
  398. elicit: true
  399. sections:
  400. - id: service-architecture
  401. title: Service Architecture
  402. instruction: Based on platform choice, define service organization.
  403. sections:
  404. - id: serverless-architecture
  405. condition: Serverless architecture chosen
  406. sections:
  407. - id: function-organization
  408. title: Function Organization
  409. type: code
  410. language: text
  411. template: "{{function_structure}}"
  412. - id: function-template
  413. title: Function Template
  414. type: code
  415. language: typescript
  416. template: "{{function_template}}"
  417. - id: traditional-server
  418. condition: Traditional server architecture chosen
  419. sections:
  420. - id: controller-organization
  421. title: Controller/Route Organization
  422. type: code
  423. language: text
  424. template: "{{controller_structure}}"
  425. - id: controller-template
  426. title: Controller Template
  427. type: code
  428. language: typescript
  429. template: "{{controller_template}}"
  430. - id: database-architecture
  431. title: Database Architecture
  432. instruction: Define database schema and access patterns.
  433. sections:
  434. - id: schema-design
  435. title: Schema Design
  436. type: code
  437. language: sql
  438. template: "{{database_schema}}"
  439. - id: data-access-layer
  440. title: Data Access Layer
  441. type: code
  442. language: typescript
  443. template: "{{repository_pattern}}"
  444. - id: auth-architecture
  445. title: Authentication and Authorization
  446. instruction: Define auth implementation details.
  447. sections:
  448. - id: auth-flow
  449. title: Auth Flow
  450. type: mermaid
  451. mermaid_type: sequence
  452. template: "{{auth_flow_diagram}}"
  453. - id: auth-middleware
  454. title: Middleware/Guards
  455. type: code
  456. language: typescript
  457. template: "{{auth_middleware}}"
  458. - id: unified-project-structure
  459. title: Unified Project Structure
  460. instruction: Create a monorepo structure that accommodates both frontend and backend. Adapt based on chosen tools and frameworks.
  461. elicit: true
  462. type: code
  463. language: plaintext
  464. examples:
  465. - |
  466. {{project-name}}/
  467. ├── .github/ # CI/CD workflows
  468. │ └── workflows/
  469. │ ├── ci.yaml
  470. │ └── deploy.yaml
  471. ├── apps/ # Application packages
  472. │ ├── web/ # Frontend application
  473. │ │ ├── src/
  474. │ │ │ ├── components/ # UI components
  475. │ │ │ ├── pages/ # Page components/routes
  476. │ │ │ ├── hooks/ # Custom React hooks
  477. │ │ │ ├── services/ # API client services
  478. │ │ │ ├── stores/ # State management
  479. │ │ │ ├── styles/ # Global styles/themes
  480. │ │ │ └── utils/ # Frontend utilities
  481. │ │ ├── public/ # Static assets
  482. │ │ ├── tests/ # Frontend tests
  483. │ │ └── package.json
  484. │ └── api/ # Backend application
  485. │ ├── src/
  486. │ │ ├── routes/ # API routes/controllers
  487. │ │ ├── services/ # Business logic
  488. │ │ ├── models/ # Data models
  489. │ │ ├── middleware/ # Express/API middleware
  490. │ │ ├── utils/ # Backend utilities
  491. │ │ └── {{serverless_or_server_entry}}
  492. │ ├── tests/ # Backend tests
  493. │ └── package.json
  494. ├── packages/ # Shared packages
  495. │ ├── shared/ # Shared types/utilities
  496. │ │ ├── src/
  497. │ │ │ ├── types/ # TypeScript interfaces
  498. │ │ │ ├── constants/ # Shared constants
  499. │ │ │ └── utils/ # Shared utilities
  500. │ │ └── package.json
  501. │ ├── ui/ # Shared UI components
  502. │ │ ├── src/
  503. │ │ └── package.json
  504. │ └── config/ # Shared configuration
  505. │ ├── eslint/
  506. │ ├── typescript/
  507. │ └── jest/
  508. ├── infrastructure/ # IaC definitions
  509. │ └── {{iac_structure}}
  510. ├── scripts/ # Build/deploy scripts
  511. ├── docs/ # Documentation
  512. │ ├── prd.md
  513. │ ├── front-end-spec.md
  514. │ └── fullstack-architecture.md
  515. ├── .env.example # Environment template
  516. ├── package.json # Root package.json
  517. ├── {{monorepo_config}} # Monorepo configuration
  518. └── README.md
  519. - id: development-workflow
  520. title: Development Workflow
  521. instruction: Define the development setup and workflow for the fullstack application.
  522. elicit: true
  523. sections:
  524. - id: local-setup
  525. title: Local Development Setup
  526. sections:
  527. - id: prerequisites
  528. title: Prerequisites
  529. type: code
  530. language: bash
  531. template: "{{prerequisites_commands}}"
  532. - id: initial-setup
  533. title: Initial Setup
  534. type: code
  535. language: bash
  536. template: "{{setup_commands}}"
  537. - id: dev-commands
  538. title: Development Commands
  539. type: code
  540. language: bash
  541. template: |
  542. # Start all services
  543. {{start_all_command}}
  544. # Start frontend only
  545. {{start_frontend_command}}
  546. # Start backend only
  547. {{start_backend_command}}
  548. # Run tests
  549. {{test_commands}}
  550. - id: environment-config
  551. title: Environment Configuration
  552. sections:
  553. - id: env-vars
  554. title: Required Environment Variables
  555. type: code
  556. language: bash
  557. template: |
  558. # Frontend (.env.local)
  559. {{frontend_env_vars}}
  560. # Backend (.env)
  561. {{backend_env_vars}}
  562. # Shared
  563. {{shared_env_vars}}
  564. - id: deployment-architecture
  565. title: Deployment Architecture
  566. instruction: Define deployment strategy based on platform choice.
  567. elicit: true
  568. sections:
  569. - id: deployment-strategy
  570. title: Deployment Strategy
  571. template: |
  572. **Frontend Deployment:**
  573. - **Platform:** {{frontend_deploy_platform}}
  574. - **Build Command:** {{frontend_build_command}}
  575. - **Output Directory:** {{frontend_output_dir}}
  576. - **CDN/Edge:** {{cdn_strategy}}
  577. **Backend Deployment:**
  578. - **Platform:** {{backend_deploy_platform}}
  579. - **Build Command:** {{backend_build_command}}
  580. - **Deployment Method:** {{deployment_method}}
  581. - id: cicd-pipeline
  582. title: CI/CD Pipeline
  583. type: code
  584. language: yaml
  585. template: "{{cicd_pipeline_config}}"
  586. - id: environments
  587. title: Environments
  588. type: table
  589. columns: [Environment, Frontend URL, Backend URL, Purpose]
  590. rows:
  591. - ["Development", "{{dev_fe_url}}", "{{dev_be_url}}", "Local development"]
  592. - ["Staging", "{{staging_fe_url}}", "{{staging_be_url}}", "Pre-production testing"]
  593. - ["Production", "{{prod_fe_url}}", "{{prod_be_url}}", "Live environment"]
  594. - id: security-performance
  595. title: Security and Performance
  596. instruction: Define security and performance considerations for the fullstack application.
  597. elicit: true
  598. sections:
  599. - id: security-requirements
  600. title: Security Requirements
  601. template: |
  602. **Frontend Security:**
  603. - CSP Headers: {{csp_policy}}
  604. - XSS Prevention: {{xss_strategy}}
  605. - Secure Storage: {{storage_strategy}}
  606. **Backend Security:**
  607. - Input Validation: {{validation_approach}}
  608. - Rate Limiting: {{rate_limit_config}}
  609. - CORS Policy: {{cors_config}}
  610. **Authentication Security:**
  611. - Token Storage: {{token_strategy}}
  612. - Session Management: {{session_approach}}
  613. - Password Policy: {{password_requirements}}
  614. - id: performance-optimization
  615. title: Performance Optimization
  616. template: |
  617. **Frontend Performance:**
  618. - Bundle Size Target: {{bundle_size}}
  619. - Loading Strategy: {{loading_approach}}
  620. - Caching Strategy: {{fe_cache_strategy}}
  621. **Backend Performance:**
  622. - Response Time Target: {{response_target}}
  623. - Database Optimization: {{db_optimization}}
  624. - Caching Strategy: {{be_cache_strategy}}
  625. - id: testing-strategy
  626. title: Testing Strategy
  627. instruction: Define comprehensive testing approach for fullstack application.
  628. elicit: true
  629. sections:
  630. - id: testing-pyramid
  631. title: Testing Pyramid
  632. type: code
  633. language: text
  634. template: |
  635. E2E Tests
  636. / \
  637. Integration Tests
  638. / \
  639. Frontend Unit Backend Unit
  640. - id: test-organization
  641. title: Test Organization
  642. sections:
  643. - id: frontend-tests
  644. title: Frontend Tests
  645. type: code
  646. language: text
  647. template: "{{frontend_test_structure}}"
  648. - id: backend-tests
  649. title: Backend Tests
  650. type: code
  651. language: text
  652. template: "{{backend_test_structure}}"
  653. - id: e2e-tests
  654. title: E2E Tests
  655. type: code
  656. language: text
  657. template: "{{e2e_test_structure}}"
  658. - id: test-examples
  659. title: Test Examples
  660. sections:
  661. - id: frontend-test
  662. title: Frontend Component Test
  663. type: code
  664. language: typescript
  665. template: "{{frontend_test_example}}"
  666. - id: backend-test
  667. title: Backend API Test
  668. type: code
  669. language: typescript
  670. template: "{{backend_test_example}}"
  671. - id: e2e-test
  672. title: E2E Test
  673. type: code
  674. language: typescript
  675. template: "{{e2e_test_example}}"
  676. - id: coding-standards
  677. title: Coding Standards
  678. instruction: Define MINIMAL but CRITICAL standards for AI agents. Focus only on project-specific rules that prevent common mistakes. These will be used by dev agents.
  679. elicit: true
  680. sections:
  681. - id: critical-rules
  682. title: Critical Fullstack Rules
  683. repeatable: true
  684. template: "- **{{rule_name}}:** {{rule_description}}"
  685. examples:
  686. - "**Type Sharing:** Always define types in packages/shared and import from there"
  687. - "**API Calls:** Never make direct HTTP calls - use the service layer"
  688. - "**Environment Variables:** Access only through config objects, never process.env directly"
  689. - "**Error Handling:** All API routes must use the standard error handler"
  690. - "**State Updates:** Never mutate state directly - use proper state management patterns"
  691. - id: naming-conventions
  692. title: Naming Conventions
  693. type: table
  694. columns: [Element, Frontend, Backend, Example]
  695. rows:
  696. - ["Components", "PascalCase", "-", "`UserProfile.tsx`"]
  697. - ["Hooks", "camelCase with 'use'", "-", "`useAuth.ts`"]
  698. - ["API Routes", "-", "kebab-case", "`/api/user-profile`"]
  699. - ["Database Tables", "-", "snake_case", "`user_profiles`"]
  700. - id: error-handling
  701. title: Error Handling Strategy
  702. instruction: Define unified error handling across frontend and backend.
  703. elicit: true
  704. sections:
  705. - id: error-flow
  706. title: Error Flow
  707. type: mermaid
  708. mermaid_type: sequence
  709. template: "{{error_flow_diagram}}"
  710. - id: error-format
  711. title: Error Response Format
  712. type: code
  713. language: typescript
  714. template: |
  715. interface ApiError {
  716. error: {
  717. code: string;
  718. message: string;
  719. details?: Record<string, any>;
  720. timestamp: string;
  721. requestId: string;
  722. };
  723. }
  724. - id: frontend-error-handling
  725. title: Frontend Error Handling
  726. type: code
  727. language: typescript
  728. template: "{{frontend_error_handler}}"
  729. - id: backend-error-handling
  730. title: Backend Error Handling
  731. type: code
  732. language: typescript
  733. template: "{{backend_error_handler}}"
  734. - id: monitoring
  735. title: Monitoring and Observability
  736. instruction: Define monitoring strategy for fullstack application.
  737. elicit: true
  738. sections:
  739. - id: monitoring-stack
  740. title: Monitoring Stack
  741. template: |
  742. - **Frontend Monitoring:** {{frontend_monitoring}}
  743. - **Backend Monitoring:** {{backend_monitoring}}
  744. - **Error Tracking:** {{error_tracking}}
  745. - **Performance Monitoring:** {{perf_monitoring}}
  746. - id: key-metrics
  747. title: Key Metrics
  748. template: |
  749. **Frontend Metrics:**
  750. - Core Web Vitals
  751. - JavaScript errors
  752. - API response times
  753. - User interactions
  754. **Backend Metrics:**
  755. - Request rate
  756. - Error rate
  757. - Response time
  758. - Database query performance
  759. - id: checklist-results
  760. title: Checklist Results Report
  761. instruction: Before running the checklist, offer to output the full architecture document. Once user confirms, execute the architect-checklist and populate results here.