# Boundary Rules Hard constraints for every implementation phase. Violations block completion. Canonical ownership: [module-boundaries.md](../architecture/module-boundaries.md). Process mandate: [ADR-018](../architecture/adr/ADR-018.md). ## Service & Module Boundaries 1. **Never implement responsibilities owned by another service.** 2. **Never duplicate business logic** that already lives in an owning service — consume it. 3. **Never access another service’s database** (no cross-DB queries, FKs, or shared schemas). 4. **Integrate only through** versioned HTTP APIs, domain/integration Events, and Provider interfaces. 5. **Never import** another service’s models, repositories, or private modules. ## Phase Boundaries 1. **Never move functionality from future phases into the current phase.** 2. **Never silently expand Scope** into adjacent modules “while we’re here.” 3. **Out of Scope is binding** — document exclusions and respect them. 4. High-level roadmap text authorizes **deriving production engineering** for the current phase ([definition-of-done.md](definition-of-done.md), [enterprise-phase-discovery.md](enterprise-phase-discovery.md)), **not** pulling next-phase product features forward. ## Data & Logic Boundaries | Allowed | Forbidden | | --- | --- | | External ID / ref fields (`*_ref`) | Cross-service foreign keys | | HTTP clients to published APIs | Reading foreign ORM models | | Outbox → event bus → consumers | Dual-writing the same journal/aggregate in two services | | Provider adapters in the **owning** service | Implementing SMS/payment/etc. inside a non-owning vertical | | Shared-lib envelopes/exceptions/JWT helpers | Shared-lib business workflows | ## Accounting & Platform Specials 1. Journal entries only via Accounting Posting Engine ([ADR-010](../architecture/adr/ADR-010.md)). 2. Messaging providers only inside Communication ([ADR-012](../architecture/adr/ADR-012.md)). 3. Product AI remains optional and independent ([ai-architecture.md](../architecture/ai-architecture.md)). ## Frontend / Backend 1. UI only under `frontend/` ([ADR-002](../architecture/adr/ADR-002.md)). 2. Backend never embeds UI rules as the source of truth. 3. Frontend never imports backend packages. ## Enforcement - Architecture Validation stage ([development-loop.md](development-loop.md)) - Architecture / Integration gates ([quality-gates.md](quality-gates.md)) - Architecture tests in the service suite ([testing-template.md](testing-template.md)) ## Related Documents - [Module Boundaries](../architecture/module-boundaries.md) - [Enterprise Phase Discovery](enterprise-phase-discovery.md) - [Master Prompt](master-prompt.md) - [Service Template](service-template.md) - [Module Template](module-template.md)