Module Toggles
Gordon CRM uses a JSONB-based feature flag system to control which optional modules are available in each workspace.
How Module Toggles Work
Each workspace has a settings column (JSONB) on the workspaces table. Feature toggles are stored
under the modules key:
{
"modules": {
"companies": true,
"deals": true,
"appointments": false
}
}When a module is enabled (true), its corresponding sidebar link and related UI elements appear. When
disabled (false or absent), the feature is completely hidden from the workspace — no sidebar link,
no cross-module tabs, and no related navigation options. The Global Search palette
also respects these toggles — disabled modules are excluded from search results.
What the Companies Toggle Controls
When modules.companies is enabled:
- The Companies link appears in the sidebar navigation.
- The
/companiesdirectory page and all company detail pages are accessible. - The Companies tab appears on each contact's detail page, showing associated companies.
When modules.companies is disabled:
- The sidebar link is hidden.
- Company-related tabs on other pages (e.g. the contact detail page) are not rendered.
- The Company field is hidden from deal create/edit dialogs.
- Existing company data is preserved — disabling the module does not delete any data. Re-enabling it restores full access.
What the Deals Toggle Controls
When modules.deals is enabled:
- The Deals link appears in the sidebar.
- The Deals tab appears on each company's detail page.
Deals and Companies are fully independent modules. Deals require a Contact (mandatory), but the company association is optional. A workspace can enable Deals without Companies — deals will simply be linked to contacts only, with no company picker shown.
When modules.deals is disabled:
- The sidebar link and all deal-specific pages are hidden.
- The Deal field is hidden from task create/edit dialogs.
- Existing deal data is preserved — re-enabling the module restores full access.
What the Appointments Toggle Controls
When modules.appointments is enabled:
- The Appointments link appears in the sidebar.
- The
/appointmentspage and appointment scheduling are accessible. - The Appointments section appears on each contact's detail page.
- The My Upcoming Appointments dashboard widget is displayed.
When modules.appointments is disabled:
- All of the above are hidden.
- Existing appointment data is preserved — disabling the module does not delete any data. Re-enabling it restores full access.
Who Can Toggle Modules
Module toggles are Super-Admin only. Regular workspace users — including Owners and Admins — cannot modify module settings. This restriction exists because modules are designed to align with subscription tiers and platform-level feature gating.
| Role | View Modules | Toggle Modules |
|---|---|---|
| Super Admin | ✅ | ✅ |
| Owner | ❌ | ❌ |
| Admin | ❌ | ❌ |
| Member | ❌ | ❌ |
The toggle UI is located in the System Administration section of Settings (/settings/modules),
which is only visible to users with the is_super_admin flag.
How Toggles Propagate
- The
getUserWithWorkspaces()server action fetches the workspacesettingsJSONB along with core data. - The
WorkspaceProvider(client-side context) storessettings.moduleson the current workspace object. - Sidebar navigation filters its items based on
currentWorkspace.settings.modules:- Items with a
moduleproperty are only rendered if that module istrue. - Core features (Contacts, Settings, etc.) have no
moduleproperty and are always visible.
- Items with a
- Feature-specific tabs on detail pages (e.g. the Deals tab on the company page) check the same context and conditionally render based on the module flag.
This approach avoids per-request permission checks for module visibility — the toggle state is loaded once and carried through the client-side context for the duration of the session.