Admin Pages in the Cockpit
Your app keeps data of its own: loyalty points, bookings, a B2B price list. Its customers need a place to manage it, and that place should be the Cockpit, next to their project, not a second login somewhere else. An app can bring its own admin pages into a project: they appear in the project's menu, open in a frame inside the Cockpit, and come from your own backend.
Nothing is added to Laioutr's code for your app. No Cockpit plugin, no access to Laioutr's database. Your app plugs in by the admin block of its laioutr.manifest.json and by being installed in a project.
The examples on this page follow one app, @laioutr-org/acme__loyalty, which grants loyalty points in a project.
postMessage messages and signed audit events. Each step is small, and any language and any host that answers HTTPS will do.How it fits together
| Part | Where it runs | Required |
|---|---|---|
| A storefront module (the Nuxt module of your package) | in every storefront that installs the app | no, an app may bring admin pages alone |
| A backend: the admin pages and their API | anywhere that answers HTTPS: a Cloudflare Worker, a container, your own server | yes |
laioutr.manifest.json with an admin block | read by the Cockpit from the version your package's latest tag points at | yes |
When a person opens your page:
- The Cockpit checks that the app is installed in the project and that the person's role reaches the page's action.
- It signs a session for that person (ES256, valid five minutes) and a launch token that lets the Cockpit page frame yours (valid an hour).
- Your page loads in an iframe at the address your manifest declares, with the launch token in its query. Your server answers the page with
frame-ancestorsfor the one Cockpit host the token names. - The Cockpit hands the session to your page by
postMessage. Your page calls your server with it as a bearer token, and your server verifies it with the Cockpit's public keys on every call. - When a person does something worth recording, your server posts an audit event to the Cockpit, carrying the session it was done under and signed with your app's secret. The Cockpit records it under that person and project.
The Cockpit draws a bar above your frame that names your app and your organization, so nothing your page shows reads as Laioutr's. It never calls your server to open a session and holds no key to your data.
Before you start: approval
Your pages are framed inside the Cockpit, so Laioutr approves the publisher once:
- Ask Laioutr to approve your organization as an app publisher. Laioutr approves partners it has an agreement with. Until then your apps' admin pages open nowhere, whatever is installed.
- From then on you develop, publish and install alone: every app your organization publishes with an
adminblock is framed in the projects that install it. Your Owners and Developers find your apps, their addresses and their audit secrets under Organization → Published apps.
Who sees an app depends on how it is published:
| How it is published | Who installs it |
|---|---|
Private, for your organization: @laioutr-org/<your-org>__<name>, listed by laioutr app release | your own projects |
| Granted to a client's organization (below) | the organizations it is granted to |
| The Marketplace | not available for a third party's app yet |
Your backend is yours. Its data, its uptime and its code are your responsibility. Laioutr shows the frame, checks the person's role and signs the session. A backend that fails costs only its own page: the Cockpit says that your app does not answer right now and that only this page is affected, and the rest of the Cockpit works on.
No app passes for Laioutr's. The publisher shown around your frame is the organization that owns your package in the registry, never what your manifest says. An app whose name or menu label contains "Laioutr" or is the name of a Laioutr product is refused.
Blocking. An app that misbehaves can be blocked by Laioutr: its pages, sessions and audit events stop in every project within half a minute.
The manifest's admin block
The example app's block: one page, two actions, one audit event.
{
"admin": {
"url": "https://loyalty-admin.acme.example/ui/",
"nav": { "group": "acme-loyalty", "label": "nav.group", "icon": "LuSparkles" },
"actions": [
{ "key": "view", "level": "contentManager", "label": "actions.view" },
{ "key": "grant", "level": "projectManager", "label": "actions.grant" }
],
"pages": [{ "route": "acme-loyalty", "path": "/", "navLabel": "nav.points", "icon": "LuSparkles", "action": "view" }],
"events": [{ "key": "points.granted", "label": "events.pointsGranted", "action": "grant" }],
"messages": {
"en": {
"nav": { "group": "Acme loyalty", "points": "Points" },
"actions": { "view": "See points", "grant": "Grant points" },
"events": { "pointsGranted": "Granted a point" }
},
"de": {
"nav": { "group": "Acme-Treue", "points": "Punkte" },
"actions": { "view": "Punkte sehen", "grant": "Punkte vergeben" },
"events": { "pointsGranted": "Einen Punkt vergeben" }
}
}
}
}
A malformed entry is dropped alone and the rest still works. The block sits beside configSettings in the same file, and both can be used together.
https URL whose path is the base of your bundle and ends in /. Plain http only on localhost, 127.0.0.1 or *.localhost, and only for a Cockpit that runs on the same machine. No user, query or fragment. Its origin is the aud of every session and launch token the Cockpit signs for you. Give your pages an origin of their own: never a Cockpit host (refused), never one another app uses.level is the lowest of the Cockpit's four levels that holds it: contentManager, projectManager, developer, owner. The person's role on the project decides their levels, and a session carries the actions of those levels as your published manifest grants them.route is where the page lives under the project (appadmin/<route>, lowercase segments). path is where it is inside your bundle (/, /members), resolved under url, never /api or below. navLabel is a message key, icon a Lucide icon name (LuSparkles). action is what a person needs to see the page: without it the page has no menu entry and no session.pages. Without it each page is an entry of its own.<namespace>.<key>, the namespace derived from your package: @laioutr-org/acme__loyalty records app-acme-loyalty.points.granted. The Cockpit records an event only when the session it was done under grants its action. A key is one to four lowerCamelCase words joined by dots.to a project route with :name segments (appadmin/acme-loyalty/members/:id). The page sends open with the key and values, and the Cockpit opens nothing else.{ "en": { … }, "de": { … } }, nested by the keys' dots. The Cockpit shows the reader's locale.Settings reach your backend in the session. The production environment's values of your configSettings travel in the session as the claim settings, for fields of a plain type (text, textarea, number, select, radio, checkbox, toggle_button), at most 32 fields and 1024 characters in all. A secret field never travels, because the session passes the person's browser: a secret your backend needs stays on your side.
Serving the page: the launch token
The frame's address carries ?laioutrLaunch=<token>: a JWT signed with the Cockpit's keys, with use: "app-admin-launch", aud your origin, app your package, and host, the Cockpit host the page is drawn on, valid an hour. It names no person and grants nothing but the framing.
Verify it as you verify a session (below, with use being app-admin-launch), then answer your page with:
Content-Security-Policy: frame-ancestors https://<host>
Cache-Control: no-store
http:// only for a localhost host. Without a valid token, answer frame-ancestors 'none'. A frame reloaded by itself after the hour is framed by nobody until the person reloads the Cockpit's page.
Receiving the session in the page
The page receives the session by message, never by its address. It accepts messages from one origin only: the Cockpit host named by the launch token, which your server writes into the page it serves. Every message is an object with v: 1 and a type. Anything else is ignored, on both sides.
From your page to the Cockpit (window.parent.postMessage(message, cockpitOrigin)):
type | Fields | What happens |
|---|---|---|
ready | Send it when your page has loaded. The Cockpit answers with session. | |
token.expiring | The session ends soon. The Cockpit answers with a fresh session. | |
navigate | path, replace | Your page moved inside the bundle. The Cockpit mirrors it into its own URL, so Back and links work. |
toast | status (success, error, info), title, description? | The Cockpit shows a notice, marked as your app's. |
confirm | id, title, body, confirmLabel, danger | The Cockpit asks the person, and answers confirm.answer with the same id. |
open | link, params | Opens a Cockpit place your manifest declares under links. |
unsaved | unsaved | While true, the Cockpit asks before the person leaves the page. |
title | title or null | What the page shows (a member's name), for the Cockpit's breadcrumb and tab. |
From the Cockpit to your page:
type | Fields | Meaning |
|---|---|---|
session | token, expiresAt (ms), locale, theme (light, dark), accent, path | The session to send to your server, the person's language and colour mode, the Cockpit's accent colours as CSS custom properties, and where the page opens. |
confirm.answer | id, confirmed | The person's answer to your confirm. |
route | path | The Cockpit's URL moved (Back, Forward): show this path. |
layout | offset | How many CSS pixels of the Cockpit's window lie beside your frame, so your breakpoints can answer the window's width. |
Send token.expiring about a minute before expiresAt, and every call to your server carries the newest token as Authorization: Bearer <session>.
Verifying the session
Your server verifies the session on every call. A session is a JWT:
header { "alg": "ES256", "kid": "…", "typ": "JWT" }
payload {
"use": "app-admin", "iss": "<the Cockpit>", "aud": "<the origin of admin.url>", "app": "<your package>",
"sub": "<the person's id>", "jti": "<this session>", "org": "<organization id>", "project": "<project id>",
"levels": ["contentManager", …], "actions": ["view", …],
"host": "<the Cockpit host>", "locale": "en", "theme": "light",
"settings"?: { … }, "iat": …, "nbf": …, "exp": iat + 300
}
Verify, in this order, and refuse on any failure:
algisES256, andkidnames a key of the Cockpit's public keys athttps://cockpit.laioutr.cloud/api/appadmin/jwks. Cache them ten minutes, and fetch again, at most once a minute, for akidyou do not hold. Never acceptalg: noneor a shared-secret algorithm.- The signature holds over
header.payload(P-256, IEEE P1363 form, 64 bytes). issis exactly the Cockpit you pinned.useisapp-admin. A launch token saysapp-admin-launchand is never a session.audis your origin andappyour package.expis in the future, andiatnot more than a minute ahead of your clock.- Take the person, the project and the actions from the payload alone, and check that the route's action is in
actions.
Never let a call name its own project or person: they come from the session. The Cockpit checks the install and the person's role each time it signs a session, so for up to five minutes after a role is withdrawn a session in a browser still works at your server. A route that must refuse at once checks what it needs itself.
Recording audit events
What a person does that a Cockpit page would audit, your server records in the Cockpit's audit log, so an Owner sees it beside everything else that happened in the project.
- Where:
POST https://cockpit.laioutr.cloud/api/appadmin/apps/<namespace>/audit, the namespace derived from your package (app-acme-loyalty). - Signed as Standard Webhooks with your app's secret:
webhook-idis the event's id, pluswebhook-timestampandwebhook-signature. Your Owners and Developers find the secret under Organization → Published apps → Show secret. Each read is recorded. Rotate secret makes a new one current and still accepts the one before for a day. - The body:
{ id, type, project, tenant, person, occurredAt, payload, session }.projectandpersonare the session's,tenantis the project here, andsessionis the very token the person acted under.payloadholds ids under…Idkeys, numbers, flags and nulls, never text a person typed and never an email address. At most 12 KB. - The Cockpit records it only when the session is one it signed for your app, was valid at
occurredAt, names the event's person and project, and grants the event's action.
| Answer | Meaning | What to do |
|---|---|---|
200 | Recorded (duplicate for an id already recorded) | Nothing |
400, 403, 413 | Refused for good | Fix the event; do not retry |
401 | Wrong secret | Check the secret, rotate if needed |
404 | The Cockpit does not frame this app: the publisher is not approved, or the app is blocked | Contact Laioutr |
503 | Not ready yet, for example the published manifest does not declare this event | Retry later |
500 | Not stored | Retry later |
Retry with a growing wait, starting at 30 seconds. The Cockpit takes an event up to 24 hours after its moment.
Record first, then answer. A change whose record the Cockpit did not store is taken back. Put events on a queue, and refuse an action that must leave a record while the Cockpit cannot take it:
app.post('/ui/api/points/grant', requireAction('grant'), async (c) => {
const { project } = c.get('session');
const points = grantPoint(project);
if (!(await recordAudit(c, 'points.granted', { points }))) {
takeBackPoint(project);
return c.json({ error: 'audit unavailable' }, 503);
}
return c.json({ points });
});
Building apps for your clients
A partner in Laioutr's partner programme can build apps for the organizations it works for:
- Laioutr approves the partner's organization as an app publisher, once.
- The partner publishes the app as a private app of its own organization (
@laioutr-org/<partner>__<name>,laioutr app release). - The partner's Owners and Developers grant it to a client under Organization → Published apps → Your clients → Grant. Only the client organizations linked to the partner in the partner programme are listed. Withdraw takes a grant back.
- The client finds the app in Package Management, installs it in its projects, and its pages open there from the partner's own address, under a bar naming the app and the partner.
Local development
You can develop against a Cockpit on your machine, or point a test project at your machine:
- A dev version that points at your machine.
admin.urlis read from the version thelatesttag points at. Publish a dev version whoseadmin.urlis a tunnel to your machine (https://<name>.trycloudflare.com/ui/), install it in a test project of your own, and the Cockpit frames your machine. Publish your real address with the release. Every project that installs that version frames that address, so use a project of your own. - Your origin is the audience. The origin of
admin.urlis theaudof every session and launch token, so configure your backend with the same origin. - Allow a little time. The Cockpit holds approvals and blocks for half a minute and its keys for a few minutes.
Not available yet
- Your app's tools for Larry and MCP clients. Laioutr's own apps can offer tools to Larry; a third party's tools reach neither Larry nor an MCP client yet.
- A third party's app in the Marketplace, and selling an app by size through Laioutr. Apps are private or granted.
- Reading Laioutr's data from your app (the project's content, products, media) with a token for the person. Today your app works with its own data.
- Install and uninstall notifications. Your app is not told when it is installed or removed: its sessions simply stop.
- Events without a person, such as background work your server does of its own accord.
- The SDK on a public registry. Until it is published, implement the protocol on this page.