Extensions

Trusted extensions live under app/extensions/<extension-id>/ and are bundled with APay at build time. They can provide admin pages, login-required user pages, admin APIs, and user APIs without depending on the active theme.

Routes use fixed namespaces: /admin/plugins/<id>/**, /user/plugins/<id>/**, /api/admin/plugins/<id>/**, and /api/plugins/<id>/**. Admin pages and APIs share plugin:<id>:<capability>:view|edit permissions. Disabled extensions return unavailable responses from both their pages and APIs.

After changing an extension, run node scripts/generate-extension-build.mjs and node scripts/check-extension-system.mjs. Runtime ZIP installation and untrusted third-party code are not supported.

Private database migrations belong under the extension's database/sqlite, database/postgresql, and database/mysql directories and are declared in extension.json. All three dialects are required. The build registry embeds statements and checksums so deployments do not require runtime filesystem access.

An administrator must run pending migrations from Settings → Extensions before enabling an extension. Applied files are immutable; append a higher migration ID for every change. Extension tables use the ext_<extension_id>_ prefix. Disabling never drops private tables or migration records, and checksum mismatches block both migration and enablement.