Cursor rule
front/.cursor/rules/ADR.mdcArchitectural Decision Records
Cursor rules
Quality
58/100
Scores the file, not the repository.Length
1,341 words
49 headings · 2 code blocksRepository
47
— · pushed 336 days agoLast changed
3 days ago
First indexed 3 days ago.1234567# Architecture Decision Log89<!--10ADR_AGENT_PROTOCOL v1.01112You (the agent) manage this file as the single source of truth for all ADRs.1314INVARIANTS15- Keep this exact file structure and headings.16- All ADR entries use H2 headings: "## ADR-XXXX — <Title>" (4-digit zero-padded ID).17- Allowed Status values: Proposed | Accepted | Superseded18- Date format: YYYY-MM-DD19- New entries must be appended to the END of the file.20- The Index table between the INDEX markers must always reflect the latest state and be sorted by ID desc (newest on top).21- Each ADR MUST contain: Date, Status, Owner, Context, Decision, Consequences.22- Each ADR must include an explicit anchor `<a id="adr-XXXX"></a>` so links remain stable.2324HOW TO ADD A NEW ADR251) Read the whole file.262) Compute next ID:27 - Scan for headings matching: ^## ADR-(\d{4}) — .+$28 - next_id = (max captured number) + 1, left-pad to 4 digits.293) Create a new ADR section using the “New ADR Entry Template” below.30 - Place it AFTER the last ADR section in the file.31 - Add an `<a id="adr-XXXX"></a>` line immediately below the heading.324) Update the Index (between the INDEX markers):33 - Insert/replace the row for this ADR keeping the table sorted by ID descending.34 - Title in the Index MUST link to the anchor: [<Title>](#adr-XXXX)35 - If this ADR supersedes another: set “Supersedes” in this row, and update that older ADR:36 a) Change its Status to “Superseded”37 b) Add “Superseded by: ADR-XXXX” in its Consequences block38 c) Update the older ADR’s Index row “Superseded by” column to ADR-XXXX395) Validate before saving:40 - Exactly one heading exists for ADR-XXXX41 - All required fields are present and non-empty42 - Index contains a row for ADR-XXXX and remains properly sorted436) Concurrency resolution:44 - If a merge conflict or duplicate ID is detected after reading: recompute next_id from the current file state, rename your heading, anchor, and Index row accordingly, and retry once.4546COMMIT MESSAGE SUGGESTION47- "ADR-XXXX: <Short Title> — <Status>"4849END ADR_AGENT_PROTOCOL50-->5152## Index5354<!-- BEGIN:ADR_INDEX -->5556| ID | Title | Date | Status |57| --- | -------------------------------------------- | ---------- | -------- |58| 009 | Testing Strategy - Firebase Emulator Support | 2024-08-23 | Accepted |59| 008 | TypeScript Configuration | 2024-08-23 | Accepted |60| 007 | Project Structure - Essential Files Only | 2024-08-23 | Accepted |61| 006 | Hook Patterns - Status Enum Approach | 2024-08-23 | Accepted |62| 005 | Firebase Initialization Strategy | 2024-08-23 | Accepted |63| 004 | Form Handling - React Hook Form + Yup | 2024-08-23 | Accepted |64| 003 | Firebase Security - Remove App Check | 2024-08-23 | Accepted |65| 002 | State Management - React Context over Jotai | 2024-08-23 | Accepted |6667<!-- END:ADR_INDEX -->6869## ADR-002: State Management - React Context over Jotai7071**Status:** Accepted72**Date:** 2024-08-237374### Context7576The original codebase used Jotai for state management, but we needed to simplify the template for broader adoption.7778### Decision7980Use React Context API instead of Jotai atoms for authentication state management.8182### Rationale8384- Reduces external dependencies85- Built into React - no additional learning curve86- Sufficient for authentication state needs87- Easier to understand for developers new to the codebase88- Maintains compatibility with existing patterns8990### Consequences9192- Less performant than Jotai for complex state scenarios93- More boilerplate code required94- Limited to simple state management patterns9596---9798## ADR-003: Firebase Security - Remove App Check99100**Status:** Accepted101**Date:** 2024-08-23102103### Context104105App Check with reCAPTCHA was included in the original setup but adds complexity to the template.106107### Decision108109Remove Firebase App Check and reCAPTCHA integration from the template.110111### Rationale112113- Simplifies initial setup and development114- Reduces dependencies115- App Check can be added later when needed for production116- Template focuses on core functionality117- Easier testing during development118119### Consequences120121- Less security protection out of the box122- Users need to implement App Check separately for production123- Potential for abuse during development phase124125---126127## ADR-004: Form Handling - React Hook Form + Yup128129**Status:** Accepted130**Date:** 2024-08-23131132### Context133134Forms are essential for authentication and data input in web applications.135136### Decision137138Use React Hook Form with Yup for validation.139140### Rationale141142- Performance benefits from uncontrolled components143- Built-in validation support144- TypeScript integration145- Minimal re-renders146- Yup provides comprehensive validation schemas147- Industry standard approach148149### Consequences150151- Additional dependencies to manage152- Learning curve for form-specific patterns153- More setup required for complex forms154155---156157## ADR-005: Firebase Initialization Strategy158159**Status:** Accepted160**Date:** 2024-08-23161162### Context163164Firebase initialization needed to handle server-side rendering and missing credentials gracefully.165166### Decision167168Implement conditional Firebase initialization with fallback empty objects.169170### Rationale171172- Prevents SSR errors during build time173- Graceful handling of missing credentials174- Allows template to build successfully without Firebase setup175- Clear error messages when credentials are missing176177### Implementation178179```typescript180let firebaseApp: FirebaseApp | undefined;181if (FIREBASE_CONFIG.apiKey) {182 firebaseApp = initializeApp(FIREBASE_CONFIG);183}184export const auth = firebaseApp ? getAuth(firebaseApp) : ({} as Auth);185```186187### Consequences188189- Additional conditional checks required190- Potential runtime errors if Firebase methods are called without proper initialization191- More complex initialization logic192193---194195## ADR-006: Hook Patterns - Status Enum Approach196197**Status:** Accepted198**Date:** 2024-08-23199200### Context201202Needed consistent patterns for data fetching hooks across the application.203204### Decision205206Use status enum (`"loading" | "error" | "success"`) pattern instead of separate boolean states.207208### Rationale209210- Matches existing codebase patterns211- Prevents impossible states (loading + error)212- More maintainable than multiple boolean flags213- Clear state transitions214- Better TypeScript inference215216### Implementation217218```typescript219const [status, setStatus] = useState<"loading" | "error" | "success">(220 "loading"221);222```223224### Consequences225226- Consistent with existing codebase227- Easier state management228- Clear separation of loading states229230---231232## ADR-007: Project Structure - Essential Files Only233234**Status:** Accepted235**Date:** 2024-08-23236237### Context238239Template needed to be minimal while providing complete Firebase integration.240241### Decision242243Include only essential files for Firebase integration and authentication.244245### Included Components246247- Firebase services (auth, firestore, storage, functions)248- Authentication system with React Context249- Basic pages (home, signin, signup, dashboard)250- Essential hooks for data fetching251- Material-UI theme configuration252253### Excluded Components254255- Complex state management solutions256- Advanced routing patterns257- Non-essential UI components258- Advanced Firebase features (Analytics, Remote Config, etc.)259260### Rationale261262- Faster onboarding for new projects263- Easier to understand and modify264- Reduces maintenance burden265- Clear separation of concerns266267### Consequences268269- May require additional setup for complex applications270- Users need to add advanced features themselves271- More opinionated structure272273---274275## ADR-008: TypeScript Configuration276277**Status:** Accepted278**Date:** 2024-08-23279280### Context281282Template needed strong typing for Firebase operations and React components.283284### Decision285286Use strict TypeScript configuration with comprehensive type definitions.287288### Features289290- Strict mode enabled291- Custom type definitions for Firebase documents292- Proper interface definitions for hooks293- Type-safe Firebase operations294295### Rationale296297- Better developer experience298- Compile-time error catching299- Self-documenting code300- Industry best practices301302### Consequences303304- Steeper learning curve for JavaScript developers305- More verbose code in some cases306- Additional type maintenance required307308---309310## ADR-009: Testing Strategy - Firebase Emulator Support311312**Status:** Accepted313**Date:** 2024-08-23314315### Context316317Development and testing needed to work without affecting production Firebase resources.318319### Decision320321Include Firebase emulator configuration for local development.322323### Implementation324325- Emulator configuration in firebase.json326- Environment-based Firebase initialization327- Test mode Firestore rules328329### Rationale330331- Safe local development332- Faster iteration cycles333- Cost-effective testing334- Offline development capability335336### Consequences337338- Additional setup required339- Emulator-specific behaviors may differ from production340- Need to manage emulator lifecycle341342---343344## Future ADRs345346The following decisions may be documented in future ADRs:347348- Authentication provider selection349- Deployment strategy350- Error handling patterns351- Performance optimization approaches352- Security rule implementations353- Monitoring and analytics integration354
Also in agency-ai-solutions/nextjs-firebase-ai-coding-template
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| agency-ai-solutions/nextjs-firebase-ai-coding-template.cursor/rules/ADR.mdc · 47 | Cursor rules | archgitmonorepo | 50/100 | 3 days ago | |
| agency-ai-solutions/nextjs-firebase-ai-coding-template.cursor/rules/PRD.mdc · 47 | Cursor rules | database | 44/100 | 3 days ago | |
| agency-ai-solutions/nextjs-firebase-ai-coding-templateAGENTS.md · 47 | AGENTS.md | no sections | 16/100 | 3 days ago | |
| agency-ai-solutions/nextjs-firebase-ai-coding-templateback/.cursor/rules/ADR.mdc · 47 | Cursor rules | testtesting-strategygitdatabase | 52/100 | 3 days ago | |
| agency-ai-solutions/nextjs-firebase-ai-coding-templateback/.cursor/rules/backend-workflow.mdc · 47 | Cursor rules | teststyledo-notagent-behaviour | 69/100 | 3 days ago | |
| agency-ai-solutions/nextjs-firebase-ai-coding-templateback/.cursor/rules/folder-structure.mdc · 47 | Cursor rules | testarch | 52/100 | 3 days ago | |
| agency-ai-solutions/nextjs-firebase-ai-coding-templatefront/.cursor/rules/folder-structure.mdc · 47 | Cursor rules | stylearchtypesapi+2 | 77/100 | 3 days ago | |
| agency-ai-solutions/nextjs-firebase-ai-coding-templatefront/.cursor/rules/workflow.mdc · 47 | Cursor rules | teststylesecurityapi+4 | 77/100 | 3 days ago |
Diff against .cursor/rules/ADR.mdc Diff against .cursor/rules/PRD.mdc Diff against AGENTS.md Diff against back/.cursor/rules/ADR.mdc Diff against back/.cursor/rules/backend-workflow.mdc Diff against back/.cursor/rules/folder-structure.mdc Diff against front/.cursor/rules/folder-structure.mdc Diff against front/.cursor/rules/workflow.mdc
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| hiromaily/go-crypto-wallet.cursor/rules/typescript.mdc · 126 | Cursor rules | setupbuildtestlint-format+6 | 100/100 | 3 days ago | |
| TechSquidTV/Hermes.cursor/rules/10-hermes-api.mdc · 45 | Cursor rules | testlint-formatstylearch+5 | 100/100 | 3 days ago | |
| dodgecfr/combatfilms-webapp.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 3 days ago | |
| deifos/clipmira-subtitles.cursor/rules/frontend.mdc · 1 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 3 days ago | |
| markstev/mark-starter.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+6 | 99/100 | 3 days ago | |
| Allymahmoud/case-intake-platform.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 3 days ago | |
| langflow-ai/langflow.cursor/rules/docs_development.mdc · 153k | Cursor rules | setupbuildtestlint-format+7 | 97/100 | 3 days ago | |
| TechSquidTV/Hermes.cursor/rules/20-hermes-api-tests.mdc · 45 | Cursor rules | teststyletesting-strategysecurity+3 | 97/100 | 3 days ago |
