Data Layer medium complexity backend
0
Dependencies
0
Dependents
1
Entities
0
Integrations

Description

Data access layer responsible for reading and writing per-organization module toggle state in tenant configuration storage. It also reads the static module registry to resolve available modules and their declared dependencies.

Feature: Feature Toggles

module-toggle-repository

Sources & reasoning

The module-toggle system is the central architectural decision of the entire platform (lines 232-248). It is listed as an always-on admin-organization capability (line 241) and is required from day one to support the four organizations with divergent needs. Assigned MVP because no meaningful multi-tenant operation is possible without it.

  • Not every organization needs every capability... the platform treats each functional area as an independently toggleable module... Backend is the source of truth... Clients load generically.
  • `admin-organization` is always-on because it hosts the Feature Toggles UI itself - disabling it would remove the only place toggles can be re-enabled (circular dependency).

Responsibilities

  • Read current toggle states for all modules scoped to a given organization
  • Write updated toggle state for a specific module to tenant configuration
  • Load the static module registry including dependency declarations
  • Provide atomic upsert to prevent race conditions on concurrent toggle changes

Interfaces

findByOrg(orgId: string): Promise<ModuleToggleRecord[]>
upsert(orgId: string, moduleId: string, enabled: boolean): Promise<ModuleToggleRecord>
getRegistry(): ModuleRegistryEntry[]

Related Data Entities (1)

Data entities managed by this component