Scopes and permissions
Every page has a scope, which decides where it lives, which layout it uses and who may open it:
| Scope | permission |
Who can open it | Layout |
|---|---|---|---|
global |
omitted | Any signed-in user | Forge pages |
user |
user |
Any signed-in user, for their own settings | User settings |
admin |
admin |
Site administrators | Site administration |
repository |
read |
Users who can read the repository's code | Repository |
repository |
issues |
Users who can read the repository's issues | Repository |
repository |
write |
Users who can write the repository's code | Repository |
repository |
admin |
Repository administrators | Repository settings |
All extension routes need a native signed-in browser session; access tokens, Basic authentication and reverse-proxy sign-in are refused. Pages a user cannot open are left out of navigation and return not found when requested directly.
Routes
A page's route selects one of the slots the host owns. The validator accepts only these values:
| Scope | route value |
Public address |
|---|---|---|
global |
workspace |
/workspace |
global |
feed |
/feed |
global |
applications |
/applications |
global |
tailnet |
/tailnet |
user |
workspace |
/user/settings/workspace |
user |
identity |
/user/settings/identity |
admin |
workspace |
/admin/workspace |
repository |
feed |
/{owner}/{repo}/feed |
Addresses include the forge's sub-path when it runs under one. Each slot holds one page per scope across all running packages; a second claim stops the forge at startup. A global route also cannot match an existing account or organization name.
The package and page IDs never appear in public addresses. Navigation links for routed pages appear in the native menus for their scope.
Pages without a route
Omit route to declare a page that provides an API for other code but has no public address. One case is special: the first admin page with admin permission and no route becomes the package's administration settings page. Site administrators reach it from the Settings button on Site administration → Extensions, at /admin/extensions/ID/settings/PAGE, while the package is enabled.
Subroutes
A routed page may declare up to 8 subroutes below its route. Each pattern has one to three segments separated by /, at most 128 characters in total. A segment is either a literal in the same character rules as IDs or a parameter written {name}; parameter names are unique within a pattern. A title, at most 128 characters without surrounding spaces, replaces the page title on that subroute.
{
"id": "activity",
"title": "Activity",
"scope": "repository",
"permission": "read",
"route": "feed",
"entry": "activity.js",
"subroutes": [
{"pattern": "new", "title": "New entry"},
{"pattern": "entries/{entry}", "title": "Entry"}
]
}
This page answers /{owner}/{repo}/feed, /{owner}/{repo}/feed/new and /{owner}/{repo}/feed/entries/42. Subroutes use the same admission as the page. Any other suffix returns not found. Parameter values reach your code as opaque path segments; your backend validates what they mean.
Panels
A panel is a browser component that stays mounted while people move between forge pages. It keeps its DOM, local state, timers and streams instead of reloading with each page. Panels have no scope or permission of their own: they act for the signed-in user only, and observing a repository while browsing grants no repository authority.
Panels appear in the persistent panels region of ordinary forge pages. The host adds that region only when at least one running package sets "preferred_workspace": true in its manifest. When the region is present, it hosts the panels of every running package that the user may see.
Panels are retained across navigation between supported forge pages. Sign-in and account flows, error pages, credential-bearing addresses, other origins and a full page reload load a fresh document instead, and the panel mounts again from the start.
Share one instance between a page and a panel
A page and a panel can be one application instance shown in two places. Give both the same owner value:
{
"pages": [
{"id": "home", "title": "Notes", "scope": "global", "route": "applications", "entry": "notes.js", "owner": "notes"}
],
"panels": [
{"id": "notes", "title": "Notes", "entry": "notes.js", "owner": "notes"}
]
}
The rules for a shared owner:
- The page must use
globalscope and declare aroute. - Each owner links exactly one page and exactly one panel.
- The page and the panel use the same
entry.
The host mounts the module once. On the page's address the instance is presented in the page; elsewhere it continues as the panel. Both presentations use the page's API base and receive ownerId in their mount context, so the backend sees one API identity.
Contribution authorizer
Declare native.contribution.authorize and register an authorizer in the backend to add your own access rules. Fountain consults it before showing a page in navigation, before mounting a panel and for every page or panel API request. It receives the actor ID, the contribution and, on repository pages, the repository ID, and must answer within 2 seconds.
The authorizer can only narrow access: it cannot grant what Forgejo denies. A denial, an error or a timeout hides the contribution or rejects the request.
Continue
Write the browser module with the Browser mount contract.