Skip to content

Backend-Modules

This document is FINAL and ENFORCEABLE for all business module backends.

It defines:

  • what modules exist
  • what each module is responsible for
  • how modules interact
  • what modules must NOT do
  • shared rules across all module backends

This is the business backend layer of the system.


This document defines the Module Backends Domain.

Modules are:

independent backend services responsible for specific business domains

Examples:

  • Finance
  • Market
  • Touring
  • Venue
  • AI

Frontend → Module Backend → (Base optional) → DB
→ Middleware → Auth

Modules:

  • DO NOT compute access
  • DO NOT call Core for authorization
  • DO NOT decide permissions
  • ONLY enforce via middleware

ModuleDescription
basiccore platform features (events, dashboard, artists, etc.)
financeexpenses, income, settlements, accounting
marketcontracts, deals, artist booking
touringtours, routing, schedules
venuevenue management, availability
aianalytics, copilots, predictions

Each module backend must have its own detailed documentation.

Use the following structure:


  • Each file defines:
    • module architecture
    • API
    • integration
    • permissions
  • All modules MUST follow this document (2.3.-Backend-Modules.md)

Modules MUST use:

  • validateJwt
  • requireCompanyContext
  • resolveAccessContext
  • requireModule()
  • requirePermission()

Modules MUST NOT:

❌ compute access manually
❌ trust frontend access state
❌ call Core for entitlement checks
❌ call Auth directly for decisions (middleware handles it)

Modules must be independently accessible.

Meaning:

  • Finance can exist without Basic
  • Market can exist without Basic
  • Venue can exist without Market
  • AI can exist without any other module

Access to a module is determined by:

company entitlement (Core)
+ membership grant (Auth)

Module → Base backend (shared entities)
Module → own DB

Examples:

  • Finance reads Events from Base
  • Market reads Artists from Base
  • Venue reads Events from Base

❌ Module → Core (for access decisions)
❌ Module → Auth (for access decisions)
❌ Module → Module direct coupling (tight coupling)

Each module owns its domain data.

  • expenses
  • income
  • settlements
  • contracts
  • deals
  • negotiations
  • tours
  • routing
  • schedules
  • availability
  • layouts
  • bookings
  • predictions
  • analytics
  • scoring

Shared entities (events, artists, etc.):

  • live in Base backend
  • are READ by modules
  • not duplicated across modules

Modules MAY depend on Base for:

  • shared entities
  • read-only operations

Modules MUST NOT:

❌ replicate Base logic
❌ become dependent on Base for access

Modules must NEVER call Core for authorization

Core is only used indirectly through Auth.


Each module backend should define:

  • what problem it solves
  • what it owns
  • what it reads

Example:

finance
market
venue

Example:

finance.expense.view
finance.expense.create

Example:

/api/finance/*
/api/market/*
  • with Base
  • with external APIs
  • access logic duplication
  • entitlement logic
  • identity management

Frontend → Module Backend
Module Backend → Middleware (Auth resolution)
Module Backend → DB
Module Backend → Base (optional)

Modules must follow:

  • 401 → auth problem
  • 403 → access problem
  • 503 → system failure

Defined in:

  • 2.11.-Error-Contract.md

Modules:

  • may use local cache for performance
  • MUST NOT cache access incorrectly
  • MUST rely on Auth cache strategy (2.7)

Modules must log:

  • userId
  • companyId
  • endpoint
  • action
  • result

Legacy systems (especially Finance):

  • must migrate to this model
  • must remove local user/permission logic
  • must rely on Auth/Core

New modules must:

  1. be defined in Core (module catalog)
  2. be enabled via entitlements
  3. follow this document
  4. implement middleware enforcement
  5. integrate with Base if needed

Modules own business logic.
Auth owns access.
Core owns entitlements.
Middleware enforces access.

Modules are independent backend services that execute business logic, relying on Auth for access enforcement and Core for entitlement definition.