---
title: "Extensions"
canonical_url: "https://ainode.run/docs/extensions"
type: "doc"
locale: "en"
description: "Build trusted APay extensions with their own pages and APIs."
---

# Extensions
> Build trusted APay extensions with their own pages and APIs.

Trusted extensions live under `app/extensions//` 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//**`, `/user/plugins//**`, `/api/admin/plugins//**`, and `/api/plugins//**`. Admin pages and APIs share `plugin:::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__` prefix. Disabling never drops private tables or migration records, and checksum mismatches block both migration and enablement.
