Skip to content

Implement module registry for better seperation #440

Open

Description

@Bohreromir

Users should be able to only use modules they need.
Seperate the modules, no imports from each other, extract shared components.

  • Registers per module (id, enabled, nav entry, optional server hook and startup check)
  • A disabled module returns 404 and needs no configuration.
  • Sidebar and (app)/+layout.server.ts read the registry.
  • New COCKPIT_TRINO_ENABLED
  • Feature flags move into each module's config. Each module declares its env variables in its own file and src/env.ts combines them.
  • Settings: move /settings/connections → /settings/storage.
  • ESLint rule: modules don't import from each other.
  • architecture test enforcing the pattern. Every folder under (app)/, (app)/api/ and (app)/settings/ is either a registered module ID or on an explicit exception.

Something along the lines of

export const storageModule: CockpitModule = {
  id: 'storage',
  enabled: storageConfig.enabled,          // COCKPIT_STORAGE_ENABLED
  nav: { href: '/storage', label: m.nav_storage, icon: IconFolder },
  hook: storageConnectionHook,             // optional
  startupCheck: () => storageEncryptionKey() // optional
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions