Parts of a package
An installed package is a directory named after the extension ID:
hello/
├── extension.json
├── backend
└── assets/
└── page.js
extension.jsonis the manifest. It declares the package identity, the executable, pages, panels, native capabilities and policies. Fountain validates it without running any code.backendis the executable named by the manifest'sexecutablefield. The host starts it as a child process and talks to it over a private Unix socket.assets/holds the browser modules named by page and panelentryfields, plus anything they import. A package without pages or panels needs no assets.
See Package layout and manifest for the full field reference.
How a request reaches an extension
Browser code never talks to a backend directly. It calls the scoped helpers the host passes to its mount function, and Fountain decides whether to forward each request.
- A page or panel module calls
requestorstreamwith a path relative to its API base. - Fountain requires a native signed-in browser session, matches the route to a running package, checks the contribution's scope and permission, and, when the package declares
native.contribution.authorize, asks the package's authorizer. - The host replaces anything the browser supplied with its own authority — extension, contribution, actor and, for repository pages, repository and permission — and forwards the request to the backend. Browser cookies and authorization headers are never forwarded.
- The backend reads that authority with the SDK. When it needs native data, it calls back into Fountain over a second private socket; each callback is checked against the request's private admission and the live session.
What the host owns and what the extension owns
| Fountain | The extension |
|---|---|
| Native routes, layout, navigation and account controls | Labels and content inside its own mount root |
| Sign-in, sessions, account state and repository permissions | Additional, endpoint-specific policy on every operation |
| Package validation, process start and stop, sockets and readiness | Its application logic and HTTP interface |
| Native reads and conditional native writes, with their authorization | Deciding what to read or request and why |
| Where the private data directory lives | What is stored in it and how |
Forgejo's database and internal services stay behind the host. Extensions reach native data only through the SDK's callbacks, and only for the capabilities they declare.
Two authority paths
Browser work and background work are authorized separately.
- Browser session. Pages and panels act for the person signed in to the forge, for the duration of a request or stream. When the session ends or access is revoked, the host retires the mount and closes its streams.
- Background. Work that runs without a browser uses the package's stable installation identity, an enrolled actor binding approved by an administrator and a native personal access token. Closing a browser tab neither grants nor revokes it. See Background collaboration.
Package states
Each package has a durable requested state — enabled or disabled — and a live state the host reports in site administration.
Private data survives every state change, including disabling, replacement and removal. See Install and manage packages.
Continue
Before installing anything, read the Extension trust model: extensions run as trusted code. Then enable extensions on your forge.