Standard 115: The "Backend-First, Data-Rich" Methodology
ID: STD-115 Category: Development Status: Active
The 5-Domain Architecture
To maintain a disciplined and scalable codebase, we adhere to exactly five top-level domain modules. All other functions are submodules within these domains.
Vertical Application Domains (Business Functions)
- Community: Resident Registry, Ownership, Occupancy, Contracts, Governance (Votes/Motions).
- Operations: Maintenance, Work Orders, Asset Management, Hospitality, Utility, Procurement.
- Finance: Ledger, Payables, Receivables, Budgeting, Reconciliation.
Cross-Cutting Domains (Central Services)
- Unified: Central AI (Narrative/Babel), Identity, Security, Communications, Admin/God-Mode, Workflow.
- Foundation: Core Infrastructure, Storage Adapters, Database Utilities, Auth Primitives.
The Sequence
- Backend Core: Define Entities, Relationships, State Machines, and API Logic.
- Goal: Logical completeness. (e.g., "The contract can transition from Draft to Signed.")
- Data Inflation (The "Texture" Sprint): Expand schemas to include "Usual and Customary" fields beyond the MVP.
- Goal: Operational realism. (e.g., "Tenants have pets, vehicles, and insurance policies.")
- Action: Update Schemas & Seeding Scripts to generate dense, messy data.
-
Frontend Realization (The "Two-Pass" Strategy):
- Pass 1: The Skeleton (Read-Only):
- Goal: Rapid visual assembly of Workbenches using the Design System.
- Action: Build List/Detail views populated with real data.
- Constraint: Shift-Left Security (AuthZ checks) IS implemented in the backend, but Frontend "Submit" buttons are stubbed/disabled.
- Result: A high-fidelity, navigable application (80% feel).
- Pass 2: The Nervous System (Write/Auth):
- Goal: Wire the brain to the hands.
- Action: Connect
AuthContextmiddleware to Server Actions and enable "Write" buttons. - Constraint: Only performed after the Domain Model is settled across related modules (e.g., Community + Finance).
-
Verification & Promotion (The "Testing" Sprint):
- Sequence:
- Design Tests: Write/Update Backend (Unit/Integration) and Frontend (E2E) suites.
- Promote to TST: Merge to
tstbranch (Integration Environment). - Execute & Fix: Run suites in CI -> Identify Failures -> Automated/Manual Fix -> Retry.
- Stabilize: Achieve "Green Build" in TST.
- Architectural Synchronization (The "As-Built" Audit):
- Scope: Compulsory update of ALL impacted blueprints.
- Domain: Update
01_architecture/blueprints/domain_*.md(e.g., Community, Finance). - Capabilities: Update
01_architecture/blueprints/06_B_CAPABILITY_MATRIX.md. - Data: Update
07_data/dictionary/**/*.md(Schemas). - UX: Update
01_architecture/blueprints/BLP-SYS-043_UI_UX_FRAMEWORK.md(Widget/Dashboard patterns). - Action: Deprecate/Archive any artifact that conflicts with the "As-Built" reality.
- Promote to STG: Merge to
stgfor User Acceptance (UAT).
Application
This standard applies to:
- Refactors: Assess if "Inflation" was skipped before redesigning UI.
Technical Rules of Engagement
1. The "Module First" Law
Business logic NEVER lives in apps/platform/src/app/actions.
- Anti-Pattern: Actions that return mock strings or perform raw data manipulation.
- Standard: Actions must strictly be a "Transport Layer" calling a Service method.
- Bad:
export async function getData() { return [{id:1}]; } - Good:
export async function getData() { return service.getData(); } - Requirement: You must create
packages/modules/[domain]/src/[feature]BEFORE touching the frontend.
2. Frontend "Co-location" Standard
Avoid "Monolithic Page Files". Distribute complexity.
- Structure:
- Benefit: Clearer git diffs, reusability, and optimal hydration boundaries.
3. Server Action Domain Grouping
Prevent the "Flat File" explosion in src/app/actions.
- Structure:
- Naming: Use
[domain]-[feature].tsonly if grouping folders are technically unfeasible (which they aren't).