front-end-architecture-tmpl.yaml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. # <!-- Powered by BMAD™ Core -->
  2. template:
  3. id: frontend-architecture-template-v2
  4. name: Frontend Architecture Document
  5. version: 2.0
  6. output:
  7. format: markdown
  8. filename: docs/ui-architecture.md
  9. title: "{{project_name}} Frontend Architecture Document"
  10. workflow:
  11. mode: interactive
  12. elicitation: advanced-elicitation
  13. sections:
  14. - id: template-framework-selection
  15. title: Template and Framework Selection
  16. instruction: |
  17. Review provided documents including PRD, UX-UI Specification, and main Architecture Document. Focus on extracting technical implementation details needed for AI frontend tools and developer agents. Ask the user for any of these documents if you are unable to locate and were not provided.
  18. Before proceeding with frontend architecture design, check if the project is using a frontend starter template or existing codebase:
  19. 1. Review the PRD, main architecture document, and brainstorming brief for mentions of:
  20. - Frontend starter templates (e.g., Create React App, Next.js, Vite, Vue CLI, Angular CLI, etc.)
  21. - UI kit or component library starters
  22. - Existing frontend projects being used as a foundation
  23. - Admin dashboard templates or other specialized starters
  24. - Design system implementations
  25. 2. If a frontend starter template or existing project is mentioned:
  26. - Ask the user to provide access via one of these methods:
  27. - Link to the starter template documentation
  28. - Upload/attach the project files (for small projects)
  29. - Share a link to the project repository
  30. - Analyze the starter/existing project to understand:
  31. - Pre-installed dependencies and versions
  32. - Folder structure and file organization
  33. - Built-in components and utilities
  34. - Styling approach (CSS modules, styled-components, Tailwind, etc.)
  35. - State management setup (if any)
  36. - Routing configuration
  37. - Testing setup and patterns
  38. - Build and development scripts
  39. - Use this analysis to ensure your frontend architecture aligns with the starter's patterns
  40. 3. If no frontend starter is mentioned but this is a new UI, ensure we know what the ui language and framework is:
  41. - Based on the framework choice, suggest appropriate starters:
  42. - React: Create React App, Next.js, Vite + React
  43. - Vue: Vue CLI, Nuxt.js, Vite + Vue
  44. - Angular: Angular CLI
  45. - Or suggest popular UI templates if applicable
  46. - Explain benefits specific to frontend development
  47. 4. If the user confirms no starter template will be used:
  48. - Note that all tooling, bundling, and configuration will need manual setup
  49. - Proceed with frontend architecture from scratch
  50. Document the starter template decision and any constraints it imposes before proceeding.
  51. sections:
  52. - id: changelog
  53. title: Change Log
  54. type: table
  55. columns: [Date, Version, Description, Author]
  56. instruction: Track document versions and changes
  57. - id: frontend-tech-stack
  58. title: Frontend Tech Stack
  59. instruction: Extract from main architecture's Technology Stack Table. This section MUST remain synchronized with the main architecture document.
  60. elicit: true
  61. sections:
  62. - id: tech-stack-table
  63. title: Technology Stack Table
  64. type: table
  65. columns: [Category, Technology, Version, Purpose, Rationale]
  66. instruction: Fill in appropriate technology choices based on the selected framework and project requirements.
  67. rows:
  68. - ["Framework", "{{framework}}", "{{version}}", "{{purpose}}", "{{why_chosen}}"]
  69. - ["UI Library", "{{ui_library}}", "{{version}}", "{{purpose}}", "{{why_chosen}}"]
  70. - [
  71. "State Management",
  72. "{{state_management}}",
  73. "{{version}}",
  74. "{{purpose}}",
  75. "{{why_chosen}}",
  76. ]
  77. - ["Routing", "{{routing_library}}", "{{version}}", "{{purpose}}", "{{why_chosen}}"]
  78. - ["Build Tool", "{{build_tool}}", "{{version}}", "{{purpose}}", "{{why_chosen}}"]
  79. - ["Styling", "{{styling_solution}}", "{{version}}", "{{purpose}}", "{{why_chosen}}"]
  80. - ["Testing", "{{test_framework}}", "{{version}}", "{{purpose}}", "{{why_chosen}}"]
  81. - [
  82. "Component Library",
  83. "{{component_lib}}",
  84. "{{version}}",
  85. "{{purpose}}",
  86. "{{why_chosen}}",
  87. ]
  88. - ["Form Handling", "{{form_library}}", "{{version}}", "{{purpose}}", "{{why_chosen}}"]
  89. - ["Animation", "{{animation_lib}}", "{{version}}", "{{purpose}}", "{{why_chosen}}"]
  90. - ["Dev Tools", "{{dev_tools}}", "{{version}}", "{{purpose}}", "{{why_chosen}}"]
  91. - id: project-structure
  92. title: Project Structure
  93. instruction: Define exact directory structure for AI tools based on the chosen framework. Be specific about where each type of file goes. Generate a structure that follows the framework's best practices and conventions.
  94. elicit: true
  95. type: code
  96. language: plaintext
  97. - id: component-standards
  98. title: Component Standards
  99. instruction: Define exact patterns for component creation based on the chosen framework.
  100. elicit: true
  101. sections:
  102. - id: component-template
  103. title: Component Template
  104. instruction: Generate a minimal but complete component template following the framework's best practices. Include TypeScript types, proper imports, and basic structure.
  105. type: code
  106. language: typescript
  107. - id: naming-conventions
  108. title: Naming Conventions
  109. instruction: Provide naming conventions specific to the chosen framework for components, files, services, state management, and other architectural elements.
  110. - id: state-management
  111. title: State Management
  112. instruction: Define state management patterns based on the chosen framework.
  113. elicit: true
  114. sections:
  115. - id: store-structure
  116. title: Store Structure
  117. instruction: Generate the state management directory structure appropriate for the chosen framework and selected state management solution.
  118. type: code
  119. language: plaintext
  120. - id: state-template
  121. title: State Management Template
  122. instruction: Provide a basic state management template/example following the framework's recommended patterns. Include TypeScript types and common operations like setting, updating, and clearing state.
  123. type: code
  124. language: typescript
  125. - id: api-integration
  126. title: API Integration
  127. instruction: Define API service patterns based on the chosen framework.
  128. elicit: true
  129. sections:
  130. - id: service-template
  131. title: Service Template
  132. instruction: Provide an API service template that follows the framework's conventions. Include proper TypeScript types, error handling, and async patterns.
  133. type: code
  134. language: typescript
  135. - id: api-client-config
  136. title: API Client Configuration
  137. instruction: Show how to configure the HTTP client for the chosen framework, including authentication interceptors/middleware and error handling.
  138. type: code
  139. language: typescript
  140. - id: routing
  141. title: Routing
  142. instruction: Define routing structure and patterns based on the chosen framework.
  143. elicit: true
  144. sections:
  145. - id: route-configuration
  146. title: Route Configuration
  147. instruction: Provide routing configuration appropriate for the chosen framework. Include protected route patterns, lazy loading where applicable, and authentication guards/middleware.
  148. type: code
  149. language: typescript
  150. - id: styling-guidelines
  151. title: Styling Guidelines
  152. instruction: Define styling approach based on the chosen framework.
  153. elicit: true
  154. sections:
  155. - id: styling-approach
  156. title: Styling Approach
  157. instruction: Describe the styling methodology appropriate for the chosen framework (CSS Modules, Styled Components, Tailwind, etc.) and provide basic patterns.
  158. - id: global-theme
  159. title: Global Theme Variables
  160. instruction: Provide a CSS custom properties (CSS variables) theme system that works across all frameworks. Include colors, spacing, typography, shadows, and dark mode support.
  161. type: code
  162. language: css
  163. - id: testing-requirements
  164. title: Testing Requirements
  165. instruction: Define minimal testing requirements based on the chosen framework.
  166. elicit: true
  167. sections:
  168. - id: component-test-template
  169. title: Component Test Template
  170. instruction: Provide a basic component test template using the framework's recommended testing library. Include examples of rendering tests, user interaction tests, and mocking.
  171. type: code
  172. language: typescript
  173. - id: testing-best-practices
  174. title: Testing Best Practices
  175. type: numbered-list
  176. items:
  177. - "**Unit Tests**: Test individual components in isolation"
  178. - "**Integration Tests**: Test component interactions"
  179. - "**E2E Tests**: Test critical user flows (using Cypress/Playwright)"
  180. - "**Coverage Goals**: Aim for 80% code coverage"
  181. - "**Test Structure**: Arrange-Act-Assert pattern"
  182. - "**Mock External Dependencies**: API calls, routing, state management"
  183. - id: environment-configuration
  184. title: Environment Configuration
  185. instruction: List required environment variables based on the chosen framework. Show the appropriate format and naming conventions for the framework.
  186. elicit: true
  187. - id: frontend-developer-standards
  188. title: Frontend Developer Standards
  189. sections:
  190. - id: critical-coding-rules
  191. title: Critical Coding Rules
  192. instruction: List essential rules that prevent common AI mistakes, including both universal rules and framework-specific ones.
  193. elicit: true
  194. - id: quick-reference
  195. title: Quick Reference
  196. instruction: |
  197. Create a framework-specific cheat sheet with:
  198. - Common commands (dev server, build, test)
  199. - Key import patterns
  200. - File naming conventions
  201. - Project-specific patterns and utilities