In short
An Add-on is a server extension that is installed into the phis Core at runtime. It can add routes, webhooks,
jobs and tables without rebuilding the server. This page is for developers who ship such an extension and for
operators who install it.
How it fits
An Add-on runs inside the phis Core API, the Debian package that runs under systemd, and shares that process
with every Site on the instance. The phis CLI installs and activates it, and Core keeps its tables in
PostgreSQL. When the package also has a Module half, that half is compiled into the Site. The two halves never
import each other and share values only through a small contract file.
What matters
One self-contained file. An Add-on is a single ESM file, addon.mjs, that exports phisAddon. The
server resolves nothing for it, so the bundle must be built with no externals.
No side effects at load. The server imports the file to read its manifest before the Add-on is
enabled. Open no connections, start no timers and register nothing at module scope.
No SQL. The Add-on declares tables and named queries in its manifest, and Core derives the statements,
adds the Site filter and writes the scope columns.
No scheduler of its own. A job declares a schedule and Core runs each moment on exactly one instance.
Work that would need to run more often than every five minutes should wait for an event instead.
Operators decide. Installation never enables an Add-on, and an Add-on cannot enable itself. Each Site
then asks for it with phis addon site.
Native modules are not allowed. They bundle without error and fail when loaded.
Example
Installing, enabling and switching on an Add-on without a Module half for one Site:
phis addon install --artifact ./dist/addon.mjs
phis addon reconcile
phis addon migrate --addon @acme/status
phis addon enable --addon @acme/status
phis addon reconcile
phis addon site --addon @acme/status --site <site key> --enable --without-module