TorbatYar/docs/architecture/module-boundaries.md
Mortezakoohjani 12c8615615 Ship enterprise Accounting FE/API with CRUD parity and production wiring.
Adds accounting-service PATCH/archive, fiscal helpers, COA templates and setup status, plus SuperApp Accounting UI (DS, scoreboard, masters, vouchers, ledger, ops modules) with session refresh and HTTPS public API URLs.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-24 15:26:43 +03:30

2.0 KiB

Module Boundaries

Architecture only. Module inventory → module-registry.md

Core Platform

Owns: tenants, domains, plans, features, subscriptions, entitlement checks, service/module registry, internal service tokens, outbox/inbox (core), audit log, core users, tenant memberships (operational), onboarding, public tenant-site resolution.

Must not own: business journals, CRM entities, restaurant menus, file blobs, SMS campaigns.

Identity & Access

Owns: user profiles linked to Keycloak, identity-layer memberships, OIDC BFF (config/token/me), mobile OTP handoff/session redeem, Keycloak admin sync.

Must not own: workspace onboarding lifecycle, plan/subscription, operational tenant roles source of truth (Core).

Frontend

Owns: UI, theme application, client-side auth redirects, dashboards, onboarding wizard UX.

Must not own: business rules, direct DB access, SQLAlchemy/Alembic, entitlement computation.

Future Business Modules

Each module (Accounting, CRM, Restaurant, Ecommerce, …) owns its database and domain APIs. Cross-module coupling is API/event only. Financial postings go only through Accounting Posting Engine (ADR-010).

Shared Library (backend/shared-lib)

Owns: JWT validation helpers, phone normalization, event envelope types, shared exceptions/responses.

Must not own: tenant business workflows or service-specific repositories.

Boundary Rules

  1. No cross-database foreign keys.
  2. No importing another service's models.
  3. Feature gates use Core entitlement API.
  4. Frontend talks to public/versioned APIs only.
  5. Providers are integrated behind module/provider adapters — see integration-architecture.md.