ADR 0009 — Business module platform

Status: accepted. Date: 2026-12-03.

Context

Fellow needs independent modules that can be installed, activated, upgraded and deactivated safely, with entitlements, per-tenant activation without a rebuild, and packages with integrity.

Decision

  • Discovery is build time; installation, subscription and activation are runtime. Code and migrations arrive through a controlled release. fellow migrate applies the migrations and records the installed version (fellow_modules), refusing downgrades; modules with updatePolicy: 'manual' are only upgraded with module:upgrade.
  • Per-tenant activation (fellow_tenant_modules) and entitlements (fellow_entitlements, with expiry) are checked in the pipeline of every route and page, after the tenant, when moduleActivation is enabled. An inactive module looks nonexistent (404); a suspended one, or one without an entitlement, responds 403 with a stable code. core modules (accounts, home) are always active.
  • Events respect activation: listeners are registered with their owning module and do not receive events from tenants where the module is inactive.
  • Deactivating never deletes data. Uninstalling requires that no tenant uses the module and a human approval; tables are only removed through a reviewed migration, after export and retention.
  • Package = tgz + signed fellow-package.json (Ed25519) with the SHA-256 of each file and the contract surface. Verification rejects links, unsafe paths, extra, modified or missing files, and untrusted keys (.fellow/trust). The sha512- hash serves lockfiles and the registry (ADR 0011).
  • Contract-based versioning: module:pack compares the surface with the previous package; removing a contract requires a major, adding or changing one requires a minor.
  • State read at runtime is cached for up to 15 s per process (immediate with shared Redis).

Consequences

  • Third-party code runs in the Nitro process; the signature guarantees origin and integrity, not isolation. Untrusted integrations should be external services over APIs and events.
  • “Changed” in the contract surface may be compatible (a new optional field); the rule is conservative.
  • Tests create random tenants: createTestApp disables activation unless moduleActivation: true.