Module Configuration Service
Component Detail
Description
Backend service that manages reading and writing of per-tenant module configurations in the module_configurations table. Resolves declared inter-module dependencies so that enabling one area automatically enables its prerequisites, and exposes the enabled module set as part of the bootstrap/session API response consumed by both Flutter and Next.js clients.
module-configuration-service
Sources & reasoning
This is the authoritative backend service for the feature. It must handle dependency resolution, bootstrap payload construction, and per-request enforcement - three distinct but tightly coupled responsibilities that belong in a single service to maintain a consistent source of truth for the enabled module set.
No source references — this artifact was included based on reasoning alone (see above).
Responsibilities
- Persist enabled/disabled state per module per organization in module_configurations
- Resolve dependency graph: when enabling module A, automatically enable all declared prerequisites
- Expose the full enabled-module set for a tenant in the bootstrap API response
- Enforce always-on module list - reject toggle attempts on non-toggleable modules
- Validate tenant's enabled module set on every API request to prevent client-side bypass of disabled modules
Interfaces
getEnabledModules(organizationId: string): string[]
setModuleEnabled(organizationId: string, moduleId: string, enabled: boolean): Promise<ModuleConfig>
resolveDependencies(moduleId: string): string[]
getModuleBootstrapPayload(organizationId: string): BootstrapModuleSet
validateTenantModuleAccess(organizationId: string, moduleId: string): boolean
isAlwaysOn(moduleId: string): boolean
Relationships
Related Data Entities (6)
Data entities managed by this component