Skip to content

The application admin

Every application gets the same small administration area, inside its own SPA and behind its own sign-in. It has a registry of sections, a permission gate in front of every operation, two operations that need no platform data (the navigation and the about page), and a shared shell in @flowcatalyst/ui that builds its menu from what the server says and what the session may open. The standard data sections plug in the same way: event types, roles, configuration, users and invitations and activity (the application’s events and dispatch jobs). The normative text is the admin specification.

The platform console administers the platform: every client, application, role and subscription. The application admin administers one application’s own slice, from inside that application, with the application’s own words and permissions.

Piece Artifact
AdminModule, AdminSection, Admin (the registry), the two operations framework-admin
AdminConfigModule: the config section (reads the application’s own Config) framework-admin
PlatformAdminModule: the event types and roles sections (read the platform) framework-flowcatalyst
PlatformUsersAdminModule: users, invitations, invite / resend / revoke framework-flowcatalyst
PlatformConfigAdminModule: the application’s platform config and secrets, with a separate reveal permission and an all-clients permission framework-flowcatalyst
PlatformActivityAdminModule: events and dispatch jobs with attempts framework-flowcatalyst

framework-admin depends on framework-core and framework-http only: no database, no write path and no auth module (the gate reads Context.permissions, which any context resolver fills).

The shared UI pages call either server unchanged, because the wire is the specification’s. The UI side is in @flowcatalyst/ui: FwAdminShell, FwAdminAbout, adminRoutes, adminNavigation, useAdminNavigation, AdminPage, and the data pages (standardAdminPages, replaceAdminPage, AdminDataApi, adminPermissions).

.module(AdminModule.of(APPLICATION)) // the skeleton: navigation and about
.module(new FlowCatalystModule()) // the platform connection the next lines read
.module(PlatformAdminModule.of(APPLICATION)) // event types and roles, from the platform
.module(PlatformUsersAdminModule.of(APPLICATION)) // users and invitations, through the service account
.module(PlatformActivityAdminModule.of(APPLICATION)) // events and dispatch jobs
.module(AdminConfigModule.of(APPLICATION)) // configuration and secret status
.module(new OrdersAdminModule()) // your own section(s)

Registration order is navigation order, with about first. PlatformAdminModule needs the flowcatalyst module enabled (it answers 503 PLATFORM_NOT_CONFIGURED when it is not) and its flowcatalyst.application must equal the code you pass. Map a platform role to the admin permissions in the auth module’s permission mapping:

"orders-demo:admin", Set.of("orders-demo:admin:*:*")

AdminModule.consoleView(application) is the permission that opens the area at all: orders-demo:admin:console:view.

Names are {application}:admin:{section}:{action}: four segments, which is what the platform’s definition sync accepts. The platform’s wildcard rule applies (same number of segments, * in a held segment matches), so orders-demo:admin:*:* is the administrator.

The server decides in three layers:

  1. The operation. Every operation checks its permission before it parses anything. A caller without it gets 403 and the standard error envelope with code FORBIDDEN (the message says this needs the permission {permission}); an unauthenticated one gets 401 first.
  2. The navigation. GET /api/admin/navigation lists only the sections the caller may use, and needs {app}:admin:console:view itself.
  3. The UI. The shell hides what the session cannot open and the router refuses the route. This is courtesy; layers 1 and 2 decide.

A section is a value. Its operations are ordinary typed operations that must carry a permission and live under /api/admin/.

Register it in register, bind the handler in boot:

// OrdersAdminModule
public static final Operation<NoBody, OrdersOverview> OVERVIEW =
Operation.get("/api/admin/orders/overview", OrdersOverview.class)
.id("getAdminOrdersOverview").tag("admin").permission(VIEW).build();
static final AdminSection SECTION =
AdminSection.of("orders", "Orders overview", "/admin/orders", VIEW)
.icon("i-lucide-chart-no-axes-column").serving(OVERVIEW);
public void register(AppBuilder app) { Admin.section(app, SECTION); } // also declares OVERVIEW in the document
public void boot(App app) { app.get(Routes.class).forModule(ID).bind(OVERVIEW, r -> Outcome.ok(...)); }

Admin.permissions(..) lists every permission the registry needs, for Definitions.permission and a role that grants them.

Start-up fails, and so does the openapi command, when an operation of a section has no permission or sits outside /api/admin/, a permission does not have four segments or belongs to another application, or two sections share an id or a path.

Some data is not one client’s: a database partition holds every client’s rows. A section can be marked operators only. Besides its permission, every operation of it requires the principal’s tier to be exactly ANCHOR (Go fw.Context.IsPlatformOperator(), Java Context.isPlatformOperator(); the auth module sets the tier from the token’s tier claim, for a session and for a bearer token alike). A PARTNER, a CLIENT, a principal with no tier and any other spelling (anchor) get 403 FORBIDDEN with the message “this is for platform operators only”, and GET /api/admin/navigation does not list the section for them, whatever permissions they hold, a wildcard included. The order is 401, the permission (403), the operator check (403), then the request is read.

The gate is the builder’s OperatorsOnly() (Java operatorsOnly()) on each operation, and the OpenAPI document carries x-fw-operators-only: true on it. A section marked operators-only that serves an operation without it is a start-up problem, so none can be forgotten:

static final Operation<NoBody, Vault> VAULT =
Operation.get("/api/admin/vault", Vault.class).id("getAdminVault").tag("admin")
.permission("orders:admin:vault:view").operatorsOnly().build();
static final AdminSection VAULT_SECTION =
AdminSection.of("vault", "Vault", "/admin/vault", "orders:admin:vault:view")
.operatorsOnly().serving(VAULT);

A section that serves an operation without operatorsOnly() fails with an IllegalArgumentException from the section, so it fails in register and in the openapi command.

The framework’s own operators-only section is the partitions section.

Never give such a section’s permissions to a client-managed role (one a client’s own administrators may assign). With the FlowCatalyst module and the permission mapping (Go WithPermissionMapping, Java withPermissionMapping), start-up refuses it, naming the role and the permission, and the definition sync refuses it too; see the FlowCatalyst module.

An application whose whole admin area is for platform operators declares it so:

.module(AdminModule.of(APPLICATION, AdminModule.Option.OPERATORS_ONLY))

With the option the navigation operation and the about operation need a platform operator (tier ANCHOR) as well as {app}:admin:console:view: any other caller gets 403. Every section you register must be operators-only too (Go Section.OperatorsOnly(), and a section package can ask adm.OperatorsOnly(); Java AdminSection.operatorsOnly(), and a section module can ask AdminModule.operatorsOnly()), or start-up fails naming the section. The configuration section (Go config, Java AdminConfigModule) and the platform sections (platformadmin, PlatformAdminModule and the others) are not operators-only, so they cannot be part of such an area. console:view is then an operators-only permission, so a client-managed role that holds it fails start-up. Without the option nothing changes.

Each section has its own view permission: {app}:admin:event-types:view, {app}:admin:roles:view, {app}:admin:config:view, and so on, besides {app}:admin:console:view. You do not declare them. When the FlowCatalyst module is enabled and admin sections are registered, the definition sync (the application’s sync command, or --dry-run) sends every admin permission and one role, admin (on the platform orders-demo:admin), that grants them one by one, because the sync accepts no wildcard inside a role even though your permission mapping may use one. Role and permission names follow the platform’s rules (letters, digits and _.- in each colon-separated segment, no whitespace). Declare your own role named admin and nothing is added: it is yours.

The suggested role can be named or declined, for example for an operators-only area:

.module(new FlowCatalystModule().adminRoleName("platform-operator"))

adminRoleDisplayName("...") sets the display name, withoutAdminRole() adds the permissions and no role (give them to a role of your own; with a name it is a start-up problem).

When no declared role grants {app}:admin:console:view, build logs a warning. The name goes through the ordinary role-name check, so an empty or malformed name is a start-up problem and never falls back to admin. A role of the chosen name that the application declares itself is kept and nothing is added. The suggested role is never client-managed. Renaming the suggested role creates a new role on the platform: people who held the old one must be given the new one.

The platform-backed sections call the platform as the application’s own service account, after the operation gate has checked the signed-in user’s admin permission, so a refused user never reaches the platform. What the service account is allowed to read decides what the pages can show.

Section Platform read The framework adds
Event types GET /api/event-types (event-type:view), GET /api/event-types/{id} Own application only. Filters status, subdomain, aggregate, q. Sorted by code. Cursor paging
Roles GET /api/roles (role:view), GET /api/roles/{name} Own application only. Filter source, q. Sorted by name. Cursor paging

Operations: GET /api/admin/event-types[/{id}] and GET /api/admin/roles[/{name}]. Both are read-only.

Paging is by keyset cursor: nextCursor is the key of the last item; pass it as after; limit is 1 to 200 (default 50). A platform refusal, outage or error is 502 PLATFORM_ERROR with a message that names no host and no token (the cause is logged). A 403 from the platform tells the admin the service account lacks the platform’s view permission, so the page shows a missing grant instead of an empty list. A platform that explains a refusal (EMAIL_EXISTS, ROLE_APP_FORBIDDEN, …) is passed on in its own words. A disabled FlowCatalyst module answers 503 PLATFORM_NOT_CONFIGURED. The framework confines every answer to the application’s own records, whatever the platform sends; another application’s record is 404.

Section users (/admin/users): GET /api/admin/users[/{id}], GET /api/admin/invitations, POST /api/admin/users (invite), POST /api/admin/invitations/{id}/resend, DELETE /api/admin/invitations/{id}. Permissions: {app}:admin:users:view (lists and reads), :invite, :resend, :revoke. Give an auditor only view and the pages offer nothing to change.

The application calls the platform’s application-user routes as its own service account. The platform’s application-service role needs the user and invitation permissions, and every application service account must mint a new token to carry them after they are granted.

  • The application code in every platform path is the configured one; an id that is not [A-Za-z0-9_-]{1,64} is a 404 without a call. Only the application’s roles are shown, used as a filter, or accepted on an invitation (another application’s role is 403 ROLE_APP_FORBIDDEN).
  • The invite link is a credential. Ask for it with returnInviteLink: true on the invitation (or the resend). It is then in that one answer (Cache-Control: no-store) and nowhere else: not in lists, errors or logs. The page keeps it in one dialog (“Invitation link”, shown once) and drops it when the dialog closes. Never log an invite result or a platform response in code you add around these operations.
  • The platform’s reasons reach the admin with its status and code: EMAIL_EXISTS, ROLE_APP_FORBIDDEN, UNKNOWN_ROLE, ROLES_REQUIRED, INVITATION_DELIVERY_REQUIRED, CLIENT_NOT_AVAILABLE, INVITE_DELIVERY_FAILED. Anything else is 502 PLATFORM_ERROR with no platform text.
  • Revoking an invitation deactivates the user on the platform; a console action reactivates.

Section activity (/admin/activity), one permission {app}:admin:activity:view: GET /api/admin/events[/{id}] and GET /api/admin/dispatch-jobs[/{id}]. Read-only, newest first, paged by an offset cursor. The platform is asked for this application’s records, and the framework drops anything else again (an event type must start with {app}:, a job code’s first segment must be the application). A job’s attempts are asked for only after its code was checked.

The event drawer lists the event’s payload (cut at 20 000 characters) and its jobs. The job drawer lists the attempts with the subscriber’s answer (cut at 4 000 characters). A job belongs to the application because its code is the application’s event type; its target may be another application’s subscriber, so the drawer shows the target under “Delivery target”. The target URL is shown without user info and query. Payloads and answers are visible to holders of activity:view.

GET /api/admin/config (and /{key}) lists the settings your modules declare: the module, the type in words, whether it is a secret or required, whether it is set, defaulted or unset, and where each value came from (environment variable NAME, a file, default or not set), plus the application’s health.

A secret is shown as set or not set, never its value. The same holds for a setting whose key names a credential (secret, password, token, api-key, …) even if declared as plain text, and URLs lose their user info, query and fragment. Durations are ISO-8601. Withhold every value with AdminConfigModule.of(app).withoutValues() (Java) or admin.WithoutValues() (Go). Not shown: the database and Redis instance sections (they carry passwords and are not declared settings), per-client secrets, and range-check results.

Operation Id Answers
GET /api/admin/navigation getAdminNavigation {sections: [{id, title, path, permission, icon?, description?}]}, only those the caller may use
GET /api/admin/about getAdminAbout {application, framework?, environment, startedAt, ready, checks: [{name, status, critical}]}

The about answer leaves failure messages out on purpose, because they can carry connection strings. status is UP, DOWN or TIMED_OUT. The framework version is omitted in Go (the field is optional). Both operations are in the committed OpenAPI document, so the SPA’s client has them.

The package holds no generated client; the application passes its own. The skeleton pieces are AdminPage, adminRoutes, adminNavigation and FwAdminShell.

admin/pages.ts
export const adminPages: readonly AdminPage[] = [
...standardAdminPages("orders-demo"), // about, event types, roles, users, activity, config
{ id: "orders", title: "Orders overview", icon: "...", permission: ADMIN_ORDERS_VIEW, path: "/admin/orders", component: ... },
];
// main.ts: app.use(flowcatalystUi, { api, admin: { application: "orders-demo", api: sdk, pageSize: 8 } })
// with import * as sdk from "./api/orders/sdk.gen.ts" (the generated client's operations)
// router.ts: ...adminRoutes(adminPages) every route carries meta.permission; the session guard enforces it
// App.vue: <FwAdminShell app-name="Orders admin" :pages="adminPages" :load="loadAdminNavigation" back-to="/orders">
  • adminRoutes(pages) refuses a page without a four-segment permission, a bad id, a path outside /admin and duplicates, and redirects /admin to the about page.
  • adminNavigation(pages, sections, can) shows a page only when the server listed its section and the session holds the permission. A listed section without a page is not shown (a development warning names it). A failed or missing navigation shows nothing.
  • FwAdminShell is FwAppShell with that navigation, a Back link, breadcrumbs (Admin, section, record) and an inline “could not be loaded” error with Try again.
  • FwAdminAbout is the presentational about page.

standardAdminPages(application, ids?) returns the pages of the sections the framework defines, in navigation order: about, event-types, roles, users, activity, config, and platform-config (the platform-config page needs the four platform-config admin operations in the application’s API and the view, manage, reveal and all-clients permissions; see platform config). Pass ids for a subset when your server mounts only some sections (for example ["about", "config"]).

They are FwListPage with FwRecordDrawer as child routes over the application’s generated operations. The plugin option admin carries the application code and the generated client’s operations, checked by TypeScript where you pass them: each generated function must take and answer what the page expects, so a server change that breaks a page fails your typecheck. Every call is optional (AdminDataApi); a page whose operation you did not pass shows an alert naming it. Permissions are derived from the application code (adminPermissions("orders-demo")). A platform failure is a persistent alert on the page in the server’s words.

Replacing a page. Build your own page and give it the standard page’s id; replaceAdminPage(pages, own) puts it in place, and the navigation, routes and breadcrumbs follow:

export const adminPages = replaceAdminPage(standardAdminPages("orders-demo"), myUsersPage); // id: "users"

Icons the pages use are in the package’s own list, so an application lists only the icons of its own sections. Generate the client from the committed OpenAPI document; see the UI package.

framework-admin’s tests start an application with the module and a test resolver. An application can use the real sessions, roles and mapping with two principals (AuthTesting.user("prn_admin", "orders-demo:admin") and a clerk) and a fake platform from the flowcatalyst module’s test-jar.

The SPA side has unit tests for the pure functions and a gallery page for the admin shell under the strict policy and axe.

Writes from the event types, roles and config pages (read-only by design), a way to hide event payloads, and the database and Redis instance settings on the config page. The platform’s application-user and scoped-read routes are called over plain HTTP until the platform SDKs expose them. Not verified against a real platform, Firefox or WebKit.