Modularity
How optional modules are enabled and what each module adds.
Workbase uses a company-scoped module platform. Core entities stay stable while optional capabilities are enabled per company.
How module state works
- Registry source:
src/modules/registry.ts - State storage:
ModuleStatetable (companyId + moduleId) - Lifecycle engine:
src/modules/core/module-lifecycle.ts
Enable flow can:
- ensure state row
- apply module SQL migrations
- run module
onEnablehooks
Disable flow can:
- run module
onDisablehooks - optionally drop module tables if no other company still uses them
Module file structure
Each module lives under src/modules/<module-id>/ and may contain:
index.ts— module definition: id, route, nav label, sidebar entrydashboard/— admin UI components (pages import from here)ui/— client-side UI extensions (pricing widgets, option form extensions)
Admin pages import from @/modules/<module-id>/dashboard/.
Current module ids
ai_worker
- AI-powered product editing with credit-based usage.
- Session-scoped instruction context and image extraction mode.
- Requires
AI_PROVIDERand provider API key env vars.
blogs
- Company blogs, nested categories, and markdown articles.
- Supports image insertion from shared file assets.
bulk_product_creator
- Template-driven bulk product and variant creation flow.
- Code/name generation via configurable templates with transforms.
discounts
- Tier pricing behavior in pricing pipeline/UI extensions.
matrix
- Matrix config and generated variant combinations.
matrix_type
- Adds
MATRIXoption behavior with axis pairing tables.
moysklad
- MoySklad settings, sync, attribute mapping, and export tools.
- Counterparty import, category mirroring, product sync.
opencart_import
- OpenCart catalog import and image download workflows.
- Price export back to OpenCart by product code matching.
product_lists
- Curated ordered product lists for storefront blocks (e.g. Recommended, Popular).
storefronts
- Storefront profiles: contacts, social links, opening hours.
- Static pages with markdown content and file-based images.
yarvet
- Yarvet API price sync and product export to Excel.
Practical guidance
- Treat module enable/disable as an operational change, not just a UI toggle.
- Verify module table lifecycle when changing SQL migrations.
- Keep module routes and module ids synchronized (
routein module definition and dashboard pages). - Module admin UI components belong in
src/modules/<id>/dashboard/— never insrc/components/.