bunx @dash/cli create dash-admin --template adminapps/admin: it is typechecked by bun run check, runs in place, and
is what --template admin copies. Your own Admin belongs in its own consumer
directory/repository. Its pages use server
JSX, its client uses App and the generated router, and its queries and actions
come from src/flows/admin.flow.json through ordinary codegen. The flow editor
is the same tool for developers, architects and operators.OIDC_ISSUER,
OIDC_CLIENT_ID, OIDC_CLIENT_SECRET, OIDC_REDIRECT_URI and DASH_AUTH_SECRET;
the mechanics, routes and protections are in
Sessions and single sign-on.
In development, dash-cli start offers a development session instead. Service accounts
can still use bearer JWTs. Per-gateway tokens (below) are minted from the signed-in
user, so a browser session never leaves Admin.src/collections): browser
sessions, replay protection for signed gateway requests, and RPC trace history. Any
number of Admin instances therefore behave as one, locally on Postgres
(bun run db:setup) and on Cloudflare in D1. Sessions end after 30 idle minutes and are
re-checked with the provider hourly; traces keep every failure and a quarter of successes
for ten minutes; request rate limits are on by default in production. See
Sessions and single sign-on and
Rate limiting.Package | Responsibility |
|---|---|
| @dash/admin | Composable Dash pages, gateway connection composition and browser tool adapters |
| @dash/gateway | Backend authentication, application discovery and generic management dispatch |
| @dash/server | Management operation contract, Local API CRUD execution and runtime tracing |
| @dash/devtools/server | Flow storage, templates and trace discovery |
| @dash/cms/server | Optional collection administration, using collection access policies |
| @dash/theme-editor/server | Application theme management and persistence |
| @dash/theme-editor/local | The same editor API backed by browser storage |
| @dash/shared | Portable theme definitions, flow schema and application manifest |
flowchart LR
Assets[Static Admin assets] --> Browser[Dash client]
Browser --> Admin[Admin Dash API]
Admin --> Gateway[Gateway backend]
Gateway --> Local[Local management provider]
Gateway --> Remote[Signed remote provider]
Remote --> App[Managed application's handler]
App --> Tools[Devtools / CMS / Themes / extensions]
Gateway --> Self[Admin application's handler]createGatewayClient when an independently hosted client owns its UI.
The supplied Admin app uses normal server-driven pages and its own API. It can
connect to several gateways without sharing client-global endpoint or credential
state. Application selection is scoped by both gateway ID and application ID.Services are modules, not mandatory processes. Register them in an application
process or host them separately when deployment requires it. The local and remote
management providers dispatch the same validated operations. Gateway code has no
CMS, theme or Devtools imports and needs no changes to register another service.import { createManagementProvider } from "@dash/server";
import { createDevtoolsService, createManifestFlowStore } from "@dash/devtools/server";
import { createCmsService } from "@dash/cms/server";
import { createThemeEditorService, createFileThemeStore } from "@dash/theme-editor/server";
import { manifest } from "@dash/generated/management";
import { data } from "@dash/generated/data";
export const management = createManagementProvider({
applicationId: "shop",
services: [
createDevtoolsService({ manifest, store: createManifestFlowStore(manifest) }),
createCmsService({ data, collections: ["notes"] }),
createThemeEditorService({ store: createFileThemeStore({ filePath: "var/themes.json" }) }),
],
});createFileFlowStore(projectRoot);
for an immutable deployed build, use the embedded manifest store. File storage
rejects traversal and symlink escapes, writes atomically, and never runs codegen
or deployment commands. Flow saves do not yet detect concurrent edits; coordinate
authors editing the same file.An extension is a ManagementService with an id, optional canAccess, and named
operations. managementOperation(schema, handler) validates input. Handlers
receive { applicationId, user, req? }. Default admission requires an admin;
operation and service names must be explicitly registered. Backend extensibility
does not generate an editor for a new service; the browser half is the next section.ManagementService as above.createAdminBackend({ tools: { status: "Status", … } }). Only
listed services appear, and the label is what the switcher shows.createAdminComponents(api, { tools }).import { builtInTools, defineAdminTool, type AdminToolProps } from "@dash/admin/client";
function StatusTool({ workspace, api, onDirtyChange, guard, data, children }: AdminToolProps) {
// api.call("service/operation", applicationId, input) reaches the managed application
…
}
const statusTool = defineAdminTool({ id: "status", component: StatusTool });
createAdminComponents(api, { previewCss, tools: [...builtInTools, statusTool] });src/app/api/rpc/admin/invoke.ts
(export const POST = admin.invoke). The tool's call names service/operation, Admin checks
the service is listed, and the gateway enforces who may use it. Traces are recorded per
operation; untraced leaves some out (the trace list itself is one).Every Admin page is one scroll area with the header and the page in the same wide column, so
they always line up. A tool does not pad, centre or scroll itself: Admin places it by its
layout. The default, page, puts it in that column under the header (Content, Connections,
Tenants); canvas gives it the whole space under the header, edge to edge, to scroll its own
panes (Themes, Workflows):defineAdminTool({ id: "map", component: MapTool, layout: "canvas" });/admin/[application]/[service] serves every tool. A tool that wants data loaded with the
page, or a server-rendered stand-in while it loads, gets a page of its own (a static segment
wins over [service]) built with createAdminToolPage; Themes does this to ship its catalog
and layout with the first response. Wrap the stand-in in page(…) or canvas(…) (from
@dash/admin), as the tool's layout, so it sits where the tool will. The header says "Dash Admin" unless each page factory
(createAdminConsolePage, createAdminServicePage, createAdminThemesPage,
createAdminToolPage) is given { brand: "Your name" }. A listed service with no component in the browser shows
"is not available in this Admin". The three built-ins (cmsTool, themesTool,
workflowsTool) are ordinary tools; pass your own list to drop or replace any of them.queryResolvers). Tools that are not
expressible as a UI tree run inside one ClientOnly island, AdminTool, registered through
createAdminComponents: the flow editor (a node-graph canvas) and the theme editor
(live preview). Each receives an injected API object, not global state.Collection administration is different: the managed application builds the UI
tree for its own collections and Admin renders it. RemoteView from
@dash/client is the primitive for that. The host passes load(path) (fetch a
tree and its query data), rpc(method, params, httpMethod) (the only RPCs the view
may run; throw for anything else), and an optional formPrefix/onDirtyChange/
guard for unsaved-change handling. The view keeps its own query cache, rewrites
links under basePath to in-view navigation, and marks a form clean after a
successful save. It draws the remote page as it is, with no padding or controls of
its own: the host decides where it sits, and the remote pages carry their own way
back (each CMS page links up to the one above it). It must be rendered inside the host's router
and page runtime, as any island is. Admin's CMS tab is RemoteView plus a
function that maps cms/<collection> actions to the cms/crud operation.import { startGateway, createRemoteManagementProvider } from "@dash/gateway";
import { createDefaultDataUserResolver } from "@dash/server";
await startGateway({
port: 3100,
getUser: createDefaultDataUserResolver({
publicOwnerId: false,
env: { ...process.env, NODE_ENV: "production" },
}),
applications: [{
id: "shop", name: "Shop", canAccess: user => user.role === "admin",
provider: createRemoteManagementProvider({
applicationId: "shop", endpoint: "https://shop.internal/api/gateway",
secret: process.env.SHOP_GATEWAY_SECRET!,
}),
}],
});management directly as its provider. A remote
app exports a signed handler from an ordinary src/app/api/gateway.ts route:import { createGatewayAppHandler } from "@dash/gateway";
import { management } from "../../server/management.js";
const handler = createGatewayAppHandler({
applicationId: "shop", secret: process.env.SHOP_GATEWAY_SECRET!, provider: management,
});
export const POST = handler.handleRequest;getUser verifies the gateway session. Admin does not forward the user's own
credential to a gateway: createAdminBackend takes gateways: [{ id, name, endpoint, tokenSecret, audience? }] and signs a short-lived token (default 60
seconds, issueServiceToken) for each one, with that gateway's secret and
audience. Configure the gateway's resolver with the same secret and audience,
e.g. createDefaultDataUserResolver({ audience, env: { JWT_SECRET: tokenSecret, ... } }).
Tokens carrying an aud verify only where that audience is configured, and an
audience-less service rejects them, so a token minted for one service cannot be
replayed at another. JWT_AUDIENCE sets a service's audience from the environment. App membership is checked on discovery and
every invocation. Each service then enforces admission; CMS also enforces the
collection's own rules with overrideAccess: false. A remote handler can use
mapUser(principal) to map a signed identity to a local account or reject it.The signed transport binds app ID, HTTP method, path/query, content type, body,
identity, expiry and nonce. It does not forward browser credentials to applications.
Use a separate random secret of at least 32 bytes for each app. Requests expire
after 30 seconds; replayed nonces are rejected. Multiple handler replicas need a
shared atomic consumeNonce(nonce, expires) implementation. HTTP is allowed only
on loopback; redirects are rejected. Request bodies are limited to 2 MB and remote
calls time out after 15 seconds. Host infrastructure owns TLS and rate limiting.createGatewayClient({ endpoint, getAccessToken }) (used directly when a browser
client talks to a gateway) speaks MessagePack to
POST /api/rpc/gateway/applications and POST /api/rpc/gateway/invoke. Each
connection obtains its own token; configure audience-specific credentials when
connecting gateways with independent issuers. Explicit allowedOrigins enables
a trusted separately hosted browser client.createAdminApi(operations) consumes generated
actions by stable flow node ID, so changing an action's method and regenerating
changes the method used at runtime. Page modules consume generated query exports
in the same way. Flow handler/database nodes describe relationships; they do not
execute arbitrary server code or invent per-node measurements.dash-cli codegen generates .dash/management.ts and .dash/management.json
from the same route scanner, registered collections and flow files used by the
other generators. The manifest records full nested RPC method names, public
collection slugs separately from physical table names, source flow definitions,
and a build identity derived from application source. Palette discovery and flow
validation use this manifest contract instead of separate source-code regexes.
Generated files are never edited by hand.Source edits become effective through the app's normal codegen, build and restart
or deployment process. A source save is not a production deployment. The running
build retains its manifest, allowing traces to identify the code that actually ran.createRpcTraceBuffer is exported by @dash/server. Pass it to ordinary RPC
routes as createRPCRoute(schema, handler, { traces }), and expose its snapshot
through Devtools. It records duration and successful or failed outcomes, including
HTTP-200 business errors, and associates methods with the running manifest's
application/build/flow node IDs. Request and response payloads are not retained.
History is bounded to 1–1000 entries and ten minutes. Admin's trace polling does
not record itself. The editor highlights related graph nodes; these are not
claims of measured execution for every node in a diagram.Enable OTEL_TRACING_ENABLED=true and configure the normal OTLP endpoint for
cross-service spans. Async context and W3C propagation are registered by server
startup. Server-side gateway clients can pass traceHeaders: injectTraceHeaders;
remote management providers forward that context to signed app handlers. Each
process owns its in-memory trace buffer; multiple replicas need a shared trace
provider if a combined history is required.createLocalThemeApi({ storage }) for personal catalogs with the same
ThemeApi and theme schema. Browser storage is scoped by origin; a shared hosting
origin or browser extension can distribute a user's theme across apps.Migrate old gateway-hosted pages/assets to a consumer created with --template admin.
Move flow, CMS and theme configuration into the application's management provider.
Use @dash/*/server for tool services and @dash/gateway/client for a connection.
Remove tool-specific gateway RPC routes and synthetic-request rewrites. Existing
flow files and the Devtools editor remain supported; implicit /_dev/* endpoints
and the gateway's packaged browser server are removed.See CMS, Theme editor, and Flows.