In short
A Module is an npm package compiled into a Site. It is the unit that brings Widgets, Pages, navigation, Themes
and translations for one coherent feature. It is for people who build or assemble Sites.
How it fits
Modules are part of the Site, the Next.js app built from npm packages, and are shipped in @phis/ui or as
packages of their own. A Module binds either to Core or to exactly one Add-on, the server extension inside the
phis Core API. The Module half never imports Add-on code, and the Add-on never imports the Module.
What matters
One identity. Every Module has one stable id of the form <npm-package>/modules/<module>, and
everything it owns is named beneath that id.
Core is required, the rest can go. The Core Module is loaded in every Site and cannot be deselected.
Area base Modules such as Public, App and Admin belong to one Area each, and optional Modules such as
Asset, Auth, Blog, Theme and Tour can be left out per Area.
Modules do not import each other. A Module may use the shared Foundation (types, constants, helpers,
Controls) but never another Module. The Builder is the one exception and may use only the ids of others.
Foundation is not a Module. It has no id and registers nothing. It must never import a Module, and a
validator in runtime-modules:check holds this rule for every reference, tests included.
At most one Controller. A Module owns at most one Controller type. A Module without a Controller is
valid only when its other artifacts stand on their own.
Installing does not activate. Activation is a separate, per-Area choice, and it never installs or
enables an Add-on.
Example
A Module declares its server binding as definition metadata. A Module that needs nothing beyond Core binds
with PHI_CORE_SERVER_BINDING.
type PhiRuntimeModuleServerBinding = {
providerId: PhiCapabilityProviderId;
requiredCapabilities: readonly PhiCapabilityId[];
};