Source file

docs/architecture/dependency-resolution.md

Dependency Resolution

BrightWeb resolves module order from the registry, not from ad hoc assumptions. The current chain is linear: Core first, then Admin, then CRM, then Projects.

Current dependency rules

  • CRM requires Admin. CRM policies and shared workflows assume the RBAC and governance layer already exists.
  • Projects requires CRM. Projects attach to organizations and reuse CRM-owned organizational structure.
  • Admin depends on Core. RBAC extends the shared profile and auth foundations in Core.

Resolved install-order examples

Install shapeResolved orderNote
Base onlyCore → AdminIn workspace mode the generator keeps Admin governance enabled for platform auth and RBAC even if the admin UI surface is not selected.
Base + CRMCore → Admin → CRMCRM depends on Admin, so RBAC and governance land before CRM schema and logic.
Base + CRM + ProjectsCore → Admin → CRM → ProjectsProjects depends on CRM, so the install order is fully resolved before client-only migrations.

Where the order comes from

  • supabase/module-registry.json defines the module graph.
  • scripts/_db-modules.mjs resolves enabled modules into a concrete apply order.
  • The scaffold generator mirrors that logic when it creates supabase/clients/<slug>/stack.json in workspace mode.

Base-only nuance: even if the admin UI module is not selected as a starter surface, the current workspace generator still keeps Admin governance enabled when resolving the database stack for a platform app.

Related docs

Repo sources

  • supabase/module-registry.json
  • scripts/_db-modules.mjs
  • packages/create-bw-app/src/generator.mjs
  • supabase/README.md

Repo source

  • docs/architecture/dependency-resolution.md
  • This page is rendered directly from the root docs folder. Edit the markdown there, not inside the app.