

Also from Kynth Studios


Also from Kynth Studios


Also from Kynth Studios
123456# Architecture Decision Log78<!--9ADR_AGENT_PROTOCOL v1.01011You (the agent) manage this file as the single source of truth for all ADRs.1213INVARIANTS14- Keep this exact file structure and headings.15- All ADR entries use H2 headings: "## ADR-XXXX — <Title>" (4-digit zero-padded ID).16- Allowed Status values: Proposed | Accepted | Superseded17- Date format: YYYY-MM-DD18- New entries must be appended to the END of the file.19- The Index table between the INDEX markers must always reflect the latest state and be sorted by ID desc (newest on top).20- Each ADR MUST contain: Date, Status, Owner, Context, Decision, Consequences.21- Each ADR must include an explicit anchor `<a id="adr-XXXX"></a>` so links remain stable.2223HOW TO ADD A NEW ADR241) Read the whole file.252) Compute next ID:26 - Scan for headings matching: ^## ADR-(\d{4}) — .+$27 - next_id = (max captured number) + 1, left-pad to 4 digits.283) Create a new ADR section using the “New ADR Entry Template” below.29 - Place it AFTER the last ADR section in the file.30 - Add an `<a id="adr-XXXX"></a>` line immediately below the heading.314) Update the Index (between the INDEX markers):32 - Insert/replace the row for this ADR keeping the table sorted by ID descending.33 - Title in the Index MUST link to the anchor: [<Title>](#adr-XXXX)34 - If this ADR supersedes another: set “Supersedes” in this row, and update that older ADR:35 a) Change its Status to “Superseded”36 b) Add “Superseded by: ADR-XXXX” in its Consequences block37 c) Update the older ADR’s Index row “Superseded by” column to ADR-XXXX385) Validate before saving:39 - Exactly one heading exists for ADR-XXXX40 - All required fields are present and non-empty41 - Index contains a row for ADR-XXXX and remains properly sorted426) Concurrency resolution:43 - 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.4445COMMIT MESSAGE SUGGESTION46- "ADR-XXXX: <Short Title> — <Status>"4748END ADR_AGENT_PROTOCOL49-->5051## Index5253<!-- BEGIN:ADR_INDEX -->5455| ID | Title | Date | Status | Supersedes | Superseded by |56| ---- | --------------------------------------------------------- | ---------- | -------- | ---------- | ------------- |57| 0007 | [Test Fixture Cleanup Strategy](#adr-0007) | 2025-01-27 | Accepted | — | — |58| 0006 | [Automated Test Runner Implementation](#adr-0006) | 2025-01-27 | Accepted | — | — |59| 0005 | [Database Class Consolidation](#adr-0005) | 2025-01-27 | Accepted | — | — |60| 0004 | [Real Firebase Emulators Over Mocked Services](#adr-0004) | 2025-01-27 | Accepted | — | — |61| 0003 | [Test Utilities Organization in util/ Folder](#adr-0003) | 2025-01-27 | Accepted | — | — |62| 0002 | [Firebase Emulator Integration Pattern](#adr-0002) | 2025-01-27 | Accepted | — | — |63| 0001 | [Template Testing Strategy](#adr-0001) | 2025-01-27 | Accepted | — | — |6465<!-- END:ADR_INDEX -->6667---6869## ADR-0001 — Template Testing Strategy7071<a id="adr-0001"></a>72**Date**: 2025-01-2773**Status**: Accepted74**Owner**: AI Agent7576### Context7778The Python Firebase template needed a robust testing strategy that supports both rapid development and comprehensive integration testing. Tests needed to work with and without Firebase emulators running.7980### Alternatives8182- **All tests require emulators**: Simple but slow for basic function logic testing83- **Mock all Firebase services**: Fast but doesn't test real Firebase behavior84- **Mixed approach with clear categorization**: Support both scenarios with proper documentation8586### Decision8788Implement a mixed testing strategy where tests are categorized by emulator requirements:8990- Tests that only validate function logic can run without emulators91- Integration tests that require database operations use real Firebase emulators92- Clear documentation distinguishes between test types93- Environment variable `SKIP_EMULATORS=true` allows bypassing emulator startup9495### Consequences9697- **Pros**: Fast feedback for logic tests, comprehensive integration testing, flexible CI/CD options98- **Cons / risks**: Developers need to understand test categories, some complexity in setup99- **Supersedes**: —100- **Superseded by**: —101102### Compliance / Verification103104Tests documented in `tests/README.md` with clear examples. CI can run both modes: quick logic tests and full integration tests.105106---107108## ADR-0002 — Firebase Emulator Integration Pattern109110<a id="adr-0002"></a>111**Date**: 2025-01-27112**Status**: Accepted113**Owner**: AI Agent114115### Context116117The template needed reliable Firebase emulator management for integration testing. The existing github-app project had a proven pattern for emulator lifecycle management that should be adapted.118119### Alternatives120121- **Manual emulator management**: Developers start/stop emulators manually122- **Test-level emulator fixtures**: Each test manages its own emulator instance123- **Session-level emulator management**: Emulators start once per test session (github-app pattern)124125### Decision126127Adopt the github-app emulator pattern with session-level management:128129- `tests/util/firebase_emulator.py` handles emulator lifecycle130- Automatic port cleanup and process management131- Configurable emulator services (functions, firestore, storage)132- Robust timeout and error handling133- Optional automatic startup with `setup_emulators` fixture134135### Consequences136137- **Pros**: Proven pattern, reliable cleanup, supports multiple emulator services, good error handling138- **Cons / risks**: More complex than manual setup, requires Firebase CLI installation139- **Supersedes**: —140- **Superseded by**: —141142### Compliance / Verification143144Tests use `firebase_emulator` fixture. Emulator utilities must handle port conflicts and process cleanup. Pattern consistency with github-app project.145146---147148## ADR-0003 — Test Utilities Organization in util/ Folder149150<a id="adr-0003"></a>151**Date**: 2025-01-27152**Status**: Accepted153**Owner**: AI Agent154155### Context156157Test fixtures and utilities were mixed in `conftest.py`, making them harder to reuse and maintain. The `ItemFlowSetup` class and Firebase emulator utilities needed better organization for template users.158159### Alternatives160161- **Keep everything in conftest.py**: Simple but becomes unwieldy162- **Split by functionality**: Separate files for different utilities163- **Move to tests/util/**: Follow common Python testing patterns164165### Decision166167Move shared test utilities to `tests/util/` folder:168169- `tests/util/firebase_emulator.py`: Emulator management and fixtures170- `tests/util/item_flow_setup.py`: Database setup fixtures for integration tests171- Import utilities in `conftest.py` for backwards compatibility172- Clear separation of concerns173174### Consequences175176- **Pros**: Better organization, easier to find and maintain utilities, follows Python conventions177- **Cons / risks**: Minor refactoring needed for imports, slightly more complex structure178- **Supersedes**: —179- **Superseded by**: —180181### Compliance / Verification182183All test utilities under `tests/util/` with proper imports. New utilities should follow this pattern.184185---186187## ADR-0004 — Real Firebase Emulators Over Mocked Services188189<a id="adr-0004"></a>190**Date**: 2025-01-27191**Status**: Accepted192**Owner**: AI Agent193194### Context195196Integration tests needed to validate Firebase Functions behavior including database operations, triggers, and Firebase service interactions. The choice was between mocking Firebase services or using real emulators.197198### Alternatives199200- **Mock Firebase services**: Fast but doesn't test real Firebase behavior or edge cases201- **Use production Firebase**: Real but expensive, slow, and affects live data202- **Use Firebase emulators**: Real Firebase behavior in isolated environment203204### Decision205206Use real Firebase emulators for all integration testing:207208- Tests connect to actual Firestore emulator (localhost:8080)209- Real Firebase Functions emulator (localhost:5001) for function execution210- Real document operations in emulator database211- Only mock Firestore trigger events (event object creation, not database operations)212213### Consequences214215- **Pros**: Tests real Firebase behavior, catches Firebase-specific issues, validates complete workflows216- **Cons / risks**: Requires Firebase CLI, slower than mocks, more complex setup217- **Supersedes**: —218- **Superseded by**: —219220### Compliance / Verification221222Integration tests must use emulator connections. No mocking of Firebase database operations. Trigger events can be mocked for testing purposes.223224---225226## ADR-0005 — Database Class Consolidation227228<a id="adr-0005"></a>229**Date**: 2025-01-27230**Status**: Accepted231**Owner**: AI Agent232233### Context234235The template had two database classes: `Db` (base class) and `ProjectDb` (project-specific subclass). This created unnecessary inheritance complexity and indirection for a template that serves as a starting point for new projects.236237### Alternatives238239- **Keep ProjectDb inheritance**: Maintains separation but adds complexity for template users240- **Multiple database singletons**: Each with different collections but more confusing241- **Consolidate into single Db class**: Simplify by merging ProjectDb functionality into base Db class242243### Decision244245Consolidate ProjectDb functionality directly into the base Db class:246247- Merge project-specific collections (items, categories, itemActivities) into base `_init_collections()` method248- Replace all `ProjectDb.get_instance()` calls with `Db.get_instance()`249- Remove ProjectDb class entirely250- Update all imports and type hints across the codebase251252### Consequences253254- **Pros**: Simpler codebase for template users, fewer concepts to understand, easier to extend255- **Cons / risks**: Less separation of concerns, template users may need to modify collections directly256- **Supersedes**: —257- **Superseded by**: —258259### Compliance / Verification260261All references to ProjectDb removed from codebase. Single Db class used throughout with project collections included by default.262263---264265## ADR-0006 — Automated Test Runner Implementation266267<a id="adr-0006"></a>268**Date**: 2025-01-27269**Status**: Accepted270**Owner**: AI Agent271272### Context273274Developers needed an easy way to run tests with proper Firebase emulator management. Manual emulator startup/shutdown was error-prone and the existing pytest commands required knowledge of emulator setup.275276### Alternatives277278- **Manual emulator management**: Simple but error-prone, requires developer to remember setup steps279- **Docker-based testing**: Isolated but complex setup, requires Docker knowledge280- **Automated test runner script**: Single command handles emulator lifecycle and test execution281282### Decision283284Implement `run_tests.py` script with automated emulator management:285286- Automatic Firebase emulator startup/shutdown with proper cleanup287- Command-line options for test types (unit, integration, all)288- Support for existing emulators via `--no-emulator` flag289- Optional emulator log viewing with `--show-logs`290- Graceful error handling and forced cleanup on failures291292### Consequences293294- **Pros**: Better developer experience, reliable emulator cleanup, flexible test execution options295- **Cons / risks**: Additional script to maintain, requires Firebase CLI installation296- **Supersedes**: —297- **Superseded by**: —298299### Compliance / Verification300301Test runner documented in README with examples. Script handles all emulator lifecycle automatically. Command-line help available via `--help`.302303---304305## ADR-0007 — Test Fixture Cleanup Strategy306307<a id="adr-0007"></a>308**Date**: 2025-01-27309**Status**: Accepted310**Owner**: AI Agent311312### Context313314The `conftest.py` file contained unused test fixtures (`test_category`, `test_item`, `mock_callable_request`) that were not referenced anywhere in the test suite. These created confusion and maintenance overhead.315316### Alternatives317318- **Keep all fixtures**: Simple but maintains dead code and confusion319- **Move to test utilities**: Relocate unused fixtures to utils for potential future use320- **Remove unused fixtures**: Clean up conftest.py to only contain actively used fixtures321322### Decision323324Remove unused test fixtures from conftest.py:325326- Remove `test_category`, `test_item`, and `mock_callable_request` fixtures327- Keep only `firebase_app`, `db`, and `test_user_id` fixtures that are actively used328- Move complex test setup logic to dedicated utility modules when needed329- Clean up any broken import references330331### Consequences332333- **Pros**: Cleaner conftest.py, reduces confusion for new developers, easier maintenance334- **Cons / risks**: Fixtures need to be recreated if later needed, requires verification that nothing uses them335- **Supersedes**: —336- **Superseded by**: —337338### Compliance / Verification339340No references to removed fixtures exist in codebase. Tests continue to pass without the removed fixtures. New test fixtures should only be added when actively used.341
One 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 | 14 days ago | |
| agency-ai-solutions/nextjs-firebase-ai-coding-template.cursor/rules/PRD.mdc · 47 | Cursor rules | database | 44/100 | 14 days ago | |
| agency-ai-solutions/nextjs-firebase-ai-coding-templateAGENTS.md · 47 | AGENTS.md | no sections | 16/100 | 14 days ago | |
| agency-ai-solutions/nextjs-firebase-ai-coding-templateback/.cursor/rules/backend-workflow.mdc · 47 | Cursor rules | teststyledo-notagent-behaviour | 69/100 | 14 days ago | |
| agency-ai-solutions/nextjs-firebase-ai-coding-templateback/.cursor/rules/folder-structure.mdc · 47 | Cursor rules | testarch | 52/100 | 14 days ago | |
| agency-ai-solutions/nextjs-firebase-ai-coding-templatefront/.cursor/rules/ADR.mdc · 47 | Cursor rules | teststylearchtypes+3 | 58/100 | 14 days ago | |
| agency-ai-solutions/nextjs-firebase-ai-coding-templatefront/.cursor/rules/folder-structure.mdc · 47 | Cursor rules | stylearchtypesapi+2 | 77/100 | 14 days ago | |
| agency-ai-solutions/nextjs-firebase-ai-coding-templatefront/.cursor/rules/workflow.mdc · 47 | Cursor rules | teststylesecurityapi+4 | 77/100 | 14 days ago |
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 | 14 days ago | |
| TechSquidTV/Hermes.cursor/rules/10-hermes-api.mdc · 46 | Cursor rules | testlint-formatstylearch+5 | 100/100 | 14 days ago | |
| Allymahmoud/case-intake-platform.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 14 days ago | |
| dodgecfr/combatfilms-webapp.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 14 days ago | |
| deifos/clipmira-subtitles.cursor/rules/frontend.mdc · 1 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 14 days ago | |
| markstev/mark-starter.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+6 | 99/100 | 14 days ago | |
| langflow-ai/langflow.cursor/rules/docs_development.mdc · 153k | Cursor rules | setupbuildtestlint-format+7 | 97/100 | 14 days ago | |
| bybren-llc/safe-agentic-workflow.cursor/rules/10-backend-python.mdc · 399 | Cursor rules | testlint-formatstylegit+4 | 97/100 | today |
A badge carrying the measured quality of the strongest agent config file in this repository, out of 100. It reads from this index every time somebody loads your page, so it changes when the measurement changes and there is nothing to keep up to date. Free, no account, and the value is not something you or we can set by hand.
[](https://rulestack.kynth.studio/configs/agency-ai-solutions-nextjs-firebase-ai-coding-template-back-cursor-rules-adr)Would rather not hotlink us? Every badge is also served in shields.io’s endpoint schema, so shields renders the image and your readers never talk to our domain:
Published by Toolproof, the masthead over this index and eight others. The method behind the number is at toolproof.kynth.studio/methodology, and the whole thing is readable as JSON with no key at /api.