Service Layer medium complexity backend
0
Dependencies
0
Dependents
7
Entities
0
Integrations

Description

Server-side service that manages the enabled module set for each tenant and enforces toggle rules on every API request. It validates that requested module IDs exist in the canonical platform taxonomy and that the always-on constraint for the Feature Toggles area is never violated. The service exposes the enabled set to both admin and mobile clients at startup.

Feature: Feature Toggles

module-toggle-service

Sources & reasoning

Lines 232-248 define the module-toggle architecture as the core mechanism for serving four divergent organizations from one codebase. The Feature Toggles page is the sole configuration surface for this system. Always-on status (line 241) and the circular-dependency constraint confirm no deferral is possible - this is MVP.

  • docs/source/likeperson.md · line 232-235
    Module = Area. The canonical areas defined in the area taxonomy (section 8) are the unit of toggling. Each area ID (e.g. expense-reimbursement, encrypted-assignments, certification-training) is a module that can be enabled or disabled per tenant.
  • docs/source/likeperson.md · line 241
    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).
  • docs/source/likeperson.md · line 237-238
    Backend is the source of truth. The API exposes the enabled module set for the current user's tenant as part of the session/bootstrap response. Every endpoint that belongs to a module checks the tenant's enabled set before executing

Responsibilities

  • Read and write the tenant-scoped enabled module set in persistent configuration
  • Validate module IDs against the canonical area taxonomy before accepting changes
  • Enforce the always-on constraint that prevents disabling the feature-toggles area
  • Gate incoming API requests by checking whether the requested module is in the enabled set
  • Provide the enabled module list to clients for navigation and screen filtering

Interfaces

getEnabledModules(tenantId: string): Promise<string[]>
setModuleEnabled(tenantId: string, moduleId: string, enabled: boolean): Promise<void>
isModuleEnabled(tenantId: string, moduleId: string): Promise<boolean>
validateModuleId(moduleId: string): boolean
enforceAlwaysOn(moduleId: string): void