Package layout
hello/
├── extension.json
├── backend
└── assets/
└── page.js
| Path | Required | Purpose |
|---|---|---|
extension.json |
Yes | The manifest, at the package root |
| The executable | Yes | Named by executable, relative to the package root, with its executable bit set |
assets/ |
When the package has pages or panels | Browser modules. Each entry is a path relative to assets/, and the host serves the whole directory to signed-in users |
The executable must run on the forge's host. The container image is Alpine Linux on amd64, so build a static Linux amd64 executable or one linked against musl. Fountain never compiles packages.
A minimal package
This manifest adds one global page at /applications and reads the signed-in actor:
{
"protocol": 1,
"id": "hello",
"name": "Hello",
"version": "1.0.0",
"executable": "backend",
"capabilities": ["native.actor.read"],
"pages": [
{
"id": "home",
"title": "Hello",
"scope": "global",
"route": "applications",
"entry": "page.js"
}
]
}
The backend is a Go program built with the Fountain SDK; see Extension backend. The browser module assets/page.js exports a mount function; see Browser mount contract. The source tree's contrib/extensions/example package shows a larger example with a shared page and panel, per-user storage and a live stream.
Build and assemble the package, then install it:
mkdir -p hello/assets
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o hello/backend ./cmd/hello
cp extension.json hello/
cp web/page.js hello/assets/
Manifest fields
extension.json must contain exactly one JSON object of at most 1 MiB. Unknown fields are rejected.
| Field | Type | Required | Rules |
|---|---|---|---|
protocol |
integer | Yes | Must be 1, the host's extension protocol. |
id |
string | Yes | Package ID: lowercase letters and digits in groups separated by single hyphens, such as hello or build-notes. The installed directory takes this name. Catalog packages are limited to 64 bytes. |
name |
string | Yes | Display name. Must not be blank. |
version |
string | Yes | 1 to 64 characters from letters, digits, ., _, + and -, starting with a letter or digit. |
executable |
string | Yes | Relative path to the backend inside the package. No absolute paths, .., backslashes or unclean paths such as ./backend. |
pages |
array | No | Page contributions; see Page fields. |
panels |
array | No | Panel contributions; see Panel fields. |
capabilities |
array of strings | No | Native interfaces the package uses, each listed once. See the Capabilities reference. |
policies |
array of strings | No | Host policies the backend implements. The only policy is forgejo.username. |
preferred_workspace |
boolean | No | When true, ordinary forge pages include the persistent panels region, so panels from running packages appear while people browse. |
lifecycle_controller |
string | No | ID of the required package that controls this package's external effects. Must be a valid ID other than this package's own. |
Page fields
| Field | Type | Required | Rules |
|---|---|---|---|
id |
string | Yes | Unique among the package's pages; same character rules as the package ID. |
title |
string | Yes | Page title and navigation label. Must not be blank. |
scope |
string | Yes | global, repository, user or admin. |
entry |
string | Yes | Browser module under assets/, a clean relative path ending in .js. |
route |
string | No | Host-owned slot for the page's public address. Omit it for a page that only provides an API or an administration settings page. See Pages and panels. |
permission |
string | Depends on scope | Omitted for global; user for user; admin for admin; read, issues, write or admin for repository. |
subroutes |
array | No | Up to 8 subordinate routes under route; requires route. Each has a pattern and an optional title. |
owner |
string | No | Links the page to one panel as a single shared instance; see Pages and panels. |
Panel fields
| Field | Type | Required | Rules |
|---|---|---|---|
id |
string | Yes | Unique among the package's panels; same character rules as the package ID. |
title |
string | Yes | Panel title. Must not be blank. |
entry |
string | Yes | Browser module under assets/, ending in .js. |
owner |
string | No | Links the panel to one global page as a single shared instance. |
Validation at startup
Beyond the manifest itself, Fountain checks a package against the forge it runs on:
- Two running packages cannot claim the same route or subroute in a scope. A collision stops the forge at startup.
- A global route cannot match an existing account or organization name, because those names share the forge's top-level addresses.
- The backend's handshake must match the manifest: it registers a contribution authorizer exactly when
native.contribution.authorizeis declared, the same policies aspolicies, and a lifecycle handler exactly whennative.extension.lifecycleis declared. - A package declaring
native.service.bridgeneeds[extensions] SERVICE_CALLBACK_PATHconfigured.
Lifecycle controllers
Most packages have no effects outside Fountain and leave lifecycle_controller empty. A package whose activation or cleanup must be carried out by another component names a required package as its controller. The controller declares native.extension.lifecycle and registers a lifecycle handler in its backend. Fountain then asks the controller to activate and deactivate the controlled package, keeps ordinary access to that package closed until the controller confirms activation, and reports the outcome in site administration. Catalog entries and manifests must name the same controller.
Continue
Decide where your package appears in the forge with Pages and panels.