Plat5 CLI
Run Plat5 locally, and manage a deployment’s config. Everything runs in Docker: the CLI is one binary and needs nothing else.
plat5 init my-app # start a project from integrations, templates, or an example (wizard or flags)cd my-appplat5 start # Plat5 and its modules; applies the config; runs your apps; prints links, logins, a keyplat5 init creates a project you own using the built-in organization → project starting plat5.yml, optional integrations (idp, authorizer, observability, ci, deploy), and starter templates (service, customer-console, operator-console) — or copies a standalone runnable example with --example <id> (docs/concepts/composition.md). Run without flags to launch the interactive wizard, pass --example tasks-saas -y for the complete B2B SaaS tasks demo, or pass -y alone for bare Plat5. With --service go-fiber-service:api --customer-console solid-customer-console --operator-console solid-operator-console -y:
my-app/ plat5.yml the deployment's config: kinds, roles (or authorizer), and service files services/ per-service route files: your APIs, identity.yml, audit.yml plat5.local.yml how plat5 start runs the stack on your machine api/ your API service plugin (add more anytime with plat5 add) customer-console/ your customers' console (--customer-console none to omit) operator-console/ your operators' console (--operator-console none to omit) docker-compose.yml runs your apps: includes each app folder's compose file docker-compose.infra.yml project-owned local infra (Cerbos, Topaz, Keycloak), stays up with -x app operator.yml the operator gateway's config (control plane, services, authorizer) .env.local local secrets (mode 0600, gitignored) + .env.example template README.md what's here, and how to run itEvery generated service, console, policy, and workflow belongs to your project, not a runtime dependency. Official integrations, starter templates, and standalone examples live in plat5dev/registry and plat5dev/templates (go-fiber-service, bun-effect-service, node-fastify-service, solid-customer-console, solid-operator-console; examples: tasks-saas, topaz-documents, enterprise-sso), and entries can also be resolved from owner/repo//subdir@ref, git URLs, .tar.gz URLs, or local directories (Plugins).
plat5 init my-app -y (no flags) writes Plat5 alone: plat5.yml with the default organization → project hierarchy and roles (admin, member, developer, viewer), services/identity.yml, services/audit.yml, plat5.local.yml, and operator.yml. Edit plat5.yml and run plat5 routes generate anytime to reshape your hierarchy, add integrations or starter templates with plat5 add, or add your own service file in services/, list it in plat5.yml’s services, and include it in docker-compose.yml. A service file’s routes sit in a kind’s scope, relative to its node (/orgs/{organization}/…), in the user scope for the user’s own data, such as /user/notification-settings (the service gets X-Plat5-User-Id), or in public (plat5 docs/reference/config/services.md).
Self-hosting a deployment is compose, not this CLI: plat5 docs/guides/deploy.md.
Install
Section titled “Install”brew install plat5dev/tap/plat5# orcurl -fsSL https://plat5.com/install.sh | shmacOS and Linux, amd64 and arm64. On Windows, use WSL2. The script verifies the release’s checksum and installs to /usr/local/bin (or ~/.local/bin); PLAT5_CLI_VERSION=v0.20.0 pins a release, PLAT5_INSTALL_DIR picks the directory. Or download a tarball from GitHub Releases. plat5 --version prints plat5 0.20.0 (no leading v); plat5 version adds the image versions the project pins.
From source: go install github.com/plat5dev/cli/cmd/plat5@latest.
What plat5 start runs
Section titled “What plat5 start runs”One compose project, plat5-<project_id>, with one Postgres (a database per plane), then your app’s own compose file, as its own compose project, <project_id> (State).
| Module | What | Port | Login |
|---|---|---|---|
| core (always) | Gateway | 5400 | |
| Control plane (admin API) | 5402 | admin token dev-admin-token |
|
auth |
Plat5 Auth, the customer IdP, in dev mode | 5401 | [email protected] / password |
observability |
Grafana (grafana/otel-lgtm: Loki, Tempo, Prometheus) | 5403 | none |
| OTLP (Alloy, which also reads every container’s logs) | 4318 HTTP, 4317 gRPC | ||
operator |
Operator gateway (operator) on operator.yml, and operator-audit, the operator audit log |
5410 | a dev token from its IdP |
| Operator IdP: a second Plat5 Auth, in dev mode, never the customer IdP | 5411 | [email protected] / password |
|
Operator console (operator.console, in your app’s compose file) |
5412 | [email protected] / password |
|
your app (app.compose) |
whatever its compose file runs | its own |
auth, observability, and operator are on unless plat5.local.yml turns one off. plat5 start -x observability skips one for a run; -x app runs everything but your app, so you can run it on your machine.
The operator module runs operator’s images as operator’s dev compose does (operator compose/docker-compose.yml): the gateway on Plat5’s network with IDENTITY_URL set to identity, the project’s operator.yml mounted as its CONFIG_FILE, operator-audit in its own database on the one Postgres, and the operator IdP at the project’s auth pin. The operator console is an app the project owns: docker-compose.yml includes its compose file, and start runs it only with the module, so turning the module off, or -x operator, leaves the folder and runs none of it. start restarts the operator gateway when operator.yml changes.
A busy port is an error naming it, never a silent move: stop what holds it, or pin another under ports:. When another Plat5 project holds it, the error names the project and how to stop it. Running plat5 start again updates the stack in place.
start prints its steps, and each image it has to pull, one per line. Docker compose’s own pull, build, and container output goes to start.log in the stack dir; a failure prints its last lines and the path. -v / --verbose shows it all instead.
Once the control plane is up, start applies plat5.yml as plat5 apply does. It applies without a prompt; a blocked plan (a kind removed, or its parent changed, while it has nodes) is printed and refused, and a gateway replica that refuses the new revision fails start. Apply checks the config’s rules, as in any deployment. A role may grant any permission, and a route permission no role grants is legal: only a "*" role holds it.
Then it makes sure there is something to call with, through identity’s routes at the gateway like any client: the dev person ([email protected], signed in with a dev token from local Auth; GET /user), their name, “Dev Person” (PATCH /user, while they have none, since local Auth’s tokens carry no name; a name already set stays), a node named Dev of each root kind they own (found through GET /user/nodes?kind=organization, or made with POST /orgs; /orgs/dev), and one personal key (POST /user/keys), which acts as them in every tree. Every credential, token or key, is sent as Authorization: Bearer. It reuses them while the key works. A config without those routes gets a warning. Then it prints every link, login, and key; plat5 status prints them again.
my-app is running.
Web app http://localhost:3001 [email protected] / password Operator console http://localhost:5412 [email protected] / password
Plat5 Gateway http://localhost:5400 Auth http://localhost:5401 sign-up codes: plat5 logs auth | grep code Control plane http://localhost:5402 admin token dev-admin-token Operator gateway http://localhost:5410 config: operator.yml Operator IdP http://localhost:5411 Grafana http://localhost:5403 Plat5 folder: Service Health, Auth, Debug
Dev person [email protected] Personal key plat5-uk-1-… acts as them in every tree
Open http://localhost:3001 and sign in as [email protected] / password.The consoles lead, each with its login; a module turned off, or apps not run, drops its rows. start ends by pointing at the customer console; status lists container health instead.
The operator gateway routes by service name (/services/{service}/{path…}) and takes node ids, not slugs: operator docs/reference/config.md. Every call through it is in the operator audit log, GET /services/operator-audit/operator-audit-events?node_id=….
Local Auth runs in dev mode: POST /dev/token mints a token for any email, and login codes for new sign-ups are in plat5 logs auth | grep code. The sign-in page says it’s the local stack and shows the dev login. The operator IdP is the same in its own colors, with its own users, at :5411.
Commands
Section titled “Commands”| Command | |
|---|---|
plat5 init [dir] [flags] |
Create a Plat5 project. Without selection flags, launches the interactive wizard; -y uses the built-in organization → project starting config. Flags: --example (copy a standalone example such as tasks-saas, topaz-documents, enterprise-sso), --service (repeatable, optional :name), --idp, --authorizer, --operator, --operator-idp, --operator-authorizer, --customer-console, --operator-console, --observability, --ci, --deploy, --set, --dry-run. Pass none to disable any optional layer (e.g. --idp none, --operator none, --observability none). --project-id <id> sets the project id (State); --sources <dir> resolves sibling checkouts (contributors) |
plat5 add <plugin> [flags] |
Add a service, IdP, authorizer, console, observability, CI, or deploy plugin to an existing project (--slot, --as <name>, --set, --dry-run, -y) |
plat5 registry <list|add|remove|update|search|validate> |
Manage plugin registries and validate a local registry directory |
plat5 start [-x target,…] [-v] |
Run the stack, project infra, and your apps; apply plat5.yml; seed the dev user; print the summary |
plat5 status |
The summary again, and container health |
plat5 stop |
Stop everything. Data (volumes) is kept |
plat5 reset [-y] |
Stop everything and delete the project’s volumes: Plat5’s and the operator’s databases, your apps’ volumes, Grafana’s data. The next start seeds a fresh dev user. Asks first unless -y |
plat5 logs [service…] |
Container logs. Follows on a terminal; piped, prints and exits. --app for your apps, --infra for project infra; -f / -f=false to choose |
plat5 doctor |
Check Docker, plat5.local.yml, plat5.yml, operator.yml, and ports, the operator console’s included (naming the Plat5 project that holds a busy one) |
plat5 validate [-f file …] [plat5.yml] |
Check a deployment’s config against the schema, offline (--auth-config <file> validates a control-plane AUTH_CONFIG_FILE against control_plane_auth.json) |
plat5 plan [-f file …] [plat5.yml] [-out plan.json] [--detailed-exitcode] |
Dry run: the diff applying it would make |
plat5 apply [-f file …] [plat5.yml | plan.json] [--auto-approve] [--reason <text>] [--ref <ref>] |
Plan, confirm, apply, or apply a saved plan (attaching optional X-Plat5-Change-Reason / X-Plat5-Change-Ref, with --ref auto-filled from GITHUB_SHA/CI_COMMIT_SHA); then wait up to 10s for the gateway’s replicas to load it, and exit 1 if one refused it |
plat5 login [--issuer <name>] [--device-code] [--no-browser] |
Sign in to an OIDC-enabled control plane (RFC 8252 PKCE or RFC 8628 Device Flow) and cache tokens in $XDG_STATE_HOME/plat5/credentials.json (0600) |
plat5 logout [--all] |
Remove cached control-plane login credentials |
plat5 whoami |
Show the verified control-plane identity and read / apply access level (GET /auth/whoami) |
plat5 routes list [-f file …] [plat5.yml] |
Every service’s expanded routes, identity’s and audit’s included: method, public path, scope, upstream, permissions. A dry run: the routes the control plane expanded |
plat5 routes generate [--permission-separator <sep>] [-f file …] [plat5.yml] |
Write identity’s and audit’s routes for every kind into services/identity.yml and services/audit.yml, overwriting them while keeping url, timeouts and max_body_bytes. Offline. Automatically skips any method + path claimed by your own service files, honors routes.exclude and routes.permission_separator in plat5.local.yml, and runs after adding or removing a kind or changing a kind’s path or list_permission |
plat5 config pull [--revision n] [dir] |
Write an applied revision as plat5.yml and services/<service>.yml |
plat5 version / --version |
The CLI version, and the image versions plat5.local.yml pins |
validate, plan, apply, routes list, routes generate, config pull, login, logout, and whoami work against a control plane. validate and routes generate are offline; the others talk to the local control plane (from plat5.local.yml when present, else http://localhost:5402 and dev-admin-token) unless --control-plane-url / PLAT5_CONTROL_PLANE_URL points elsewhere.
Control-plane credentials resolve in order:
--token/PLAT5_TOKEN--token-file/PLAT5_TOKEN_FILE(e.g., Kubernetes projected ServiceAccount JWT)--token-cmd/PLAT5_TOKEN_CMD(external credential helper printing a token to stdout)- Cached
plat5 loginOIDC session for the target URL (auto-refreshed viarefresh_token) - Native CI OIDC: GitHub Actions (
ACTIONS_ID_TOKEN_REQUEST_URL+ACTIONS_ID_TOKEN_REQUEST_TOKEN, audience from--oidc-audience/PLAT5_OIDC_AUDIENCE/ control-plane URL) or GitLab CI (PLAT5_OIDC_TOKEN) - Local
plat5.local.ymladmin_token/dev-admin-token
Pass -f / --file multiple times to layer environment overlays over a base plat5.yml (cannot be combined with a positional file argument):
plat5 validate -f plat5.yml -f plat5.prod.ymlplat5 plan -f plat5.yml -f plat5.prod.ymlplat5 apply -f plat5.yml -f plat5.prod.ymlOverlays merge left-to-right with RFC 7396 merge-patch semantics: maps merge recursively, scalars and lists (such as reserved_slugs) replace, and null deletes a key. An overlay’s services: may be a mapping (e.g. services: { api: { url: http://api.prod.internal:3000 } }) or a list of service files resolved relative to the overlay file. Validation and control-plane errors name the exact file that set the failing field.
plat5.local.yml
Section titled “plat5.local.yml”How plat5 start runs the project on your machine. A deployment never reads it, and it holds nothing that’s in plat5.yml. Found by walking up from the working directory; plat5.yml is the file beside it. Relative paths resolve against its directory. Unknown keys are errors, with a hint that a newer CLI may know them.
cli: is the oldest CLI that reads the file. plat5 init writes the version that introduced the newest key it uses (internal/config.SchemaVersion), not its own version, and every command checks it first: an older CLI says the project needs a newer one and how to upgrade, instead of failing on a key. Raise SchemaVersion in a release that adds a key. A dev build, one built without a release version (go build from a checkout), passes every floor and says so in one line: plat5: a dev build (no release version), so plat5.local.yml's cli: >=0.20.0 is not checked.
project_id: my-app # plat5 init --project-id, else the directory name; one folder per id, see Statecli: ">=0.20.0" # the oldest plat5 CLI that reads this file
versions: # image tags; plat5 init writes the latest of each plat5: v0.21.1 auth: v0.5.1 # also the operator IdP's operator: v0.11.1
modules: # auth, operator default true auth: true operator: true
observability: mode: local # local (lgtm + alloy, default) | alloy-only | off
gateway: # optional local gateway overrides scope_claim: scope # AUTH_SCOPE_CLAIM audit_mode: sync # sync, async, or off rate_limit_enabled: true upstream_signing: false # generates local Ed25519 key in project state cors_allowed_origins: [] # overrides CORS_ALLOWED_ORIGINS (default: app.web + auth.origins) cors_allowed_headers: [] # sets CORS_ALLOWED_HEADERS
routes: # optional plat5 routes generate settings permission_separator: ":" # :, _, ., or - ("_" for Topaz) exclude: [] # permanently omitted routes, e.g. ["POST /orgs"]
app: # your app; plat5 start runs it after Plat5 compose: ./docker-compose.yml web: http://localhost:3001 # its browser origin: wires local Auth redirect allowlists and Gateway CORS
operator: # the operator module config: ./operator.yml # the operator gateway's CONFIG_FILE; required with the module console: # the operator console: app.compose includes it, start runs it with the module compose: ./operator-console/docker-compose.yml web: http://localhost:5412 # its origin: allowed to sign in with the operator IdP and call the operator gateway origins: [] # more origins the operator IdP and gateway allow; each also allows <origin>/callback
# Optionalports: # host ports; these are the defaults gateway: 5400 auth: 5401 control_plane: 5402 grafana: 5403 otlp_grpc: 4317 otlp_http: 4318 operator: 5410 operator_auth: 5411admin_token: dev-admin-token # local onlysecret_brand: plat5 # user keys are {brand}-uk-1-…, member keys {brand}-mk-1-…, invite tokens {brand}-i-1-…auth: # local Auth, beyond app.web clients: [plat5] # also the gateway's audiences (Plat5 Auth's aud is the client id) origins: [] # each also allows <origin>/callback redirect_uris: [] theme_file: ./theme.json # OpenAuth Theme JSON for the sign-in pageidp: # with modules.auth false: the gateway's IdP issuer: https://idp.example.com jwks_uri: https://idp.example.com/.well-known/jwks.json audiences: [my-api] subject_claim: sub # the person's IdP subject (AUTH_SUBJECT_CLAIM) name_claims: [name, preferred_username] # JWT claims for display name seeding (AUTH_NAME_CLAIMS); [] disablesotel: endpoint: http://host.docker.internal:4318 # your collector, instead of the observability modulesource: # contributors: build from checkouts; plat5 init --sources writes it (see below) plat5: ../plat5Your app and its url
Section titled “Your app and its url”A service file’s url is the address the gateway reaches, in the local stack as in any deployment, so plat5 start and plat5 apply send the same config. Write it with your app’s compose service name: url: http://api:3000.
When plat5 start runs app.compose or infra.compose, each service a url names is put on the Plat5 network with a generated override (app-override.yml / infra-override.yml in the stack dir), so the gateway reaches it by name, the same way on every OS. Its host port can then be bound to 127.0.0.1: only the gateway may reach a Plat5 service, and the host port is for your own curls. With plat5 start -x app there is no app container (infra.compose stays running): start maps the name to your machine on the gateway (extra_hosts: api:host-gateway), so the app must listen there on the url’s port, beyond loopback on Linux.
Reserved compose service names: Project services in app.compose and infra.compose cannot share a name with any embedded Plat5 stack service (gateway, control-plane, identity, audit, postgres, valkey, db-init, auth, operator, operator-audit, operator-audit-migrate, operator-auth, lgtm, alloy); rename any colliding service.
The compose contract for project apps and consoles: plat5 start runs them with docker compose -p <project_id> up -d --build --wait and this env, so they can reference ${PLAT5_GATEWAY_URL}:
| Env | |
|---|---|
PLAT5_GATEWAY_URL |
The gateway, as the browser reaches it |
PLAT5_AUTH_URL |
The customer IdP’s issuer, as the browser reaches it |
PLAT5_AUTH_CLIENT_ID |
The OAuth client id (plat5) |
OTEL_EXPORTER_OTLP_ENDPOINT |
Where to send traces and metrics (Alloy on the host, http://host.docker.internal:4318), or empty |
PLAT5_OPERATOR_URL |
The operator gateway, as the browser reaches it |
PLAT5_OPERATOR_AUTH_URL |
The operator IdP’s issuer, as the browser reaches it |
PLAT5_OPERATOR_CLIENT_ID |
The operator console’s OAuth client id (operator-console) |
PLAT5_UPSTREAM_SIGNING_PUBLIC_KEY |
Base64url Ed25519 public key when gateway.upstream_signing: true |
Plugins
Section titled “Plugins”Every integration (idp, authorizer, observability, ci, deploy) and starter template (service, customer-console, operator-console) is a declarative plugin directory with a plat5.plugin.yml manifest at its root; standalone examples (type: example in registry.yml) are plain runnable Plat5 project directories. First-party entries in plat5dev/registry and plat5dev/templates use the exact same format as community registries.
- Project composition, slots, and pipeline:
docs/concepts/composition.md - Plugin manifest reference (
plat5.plugin.yml):docs/reference/plugin.md - Registry format (
registry.yml):docs/reference/registry.md - Local config reference (
plat5.local.yml):docs/reference/local-config.md
Contributors: run checkouts
Section titled “Contributors: run checkouts”source: builds a module’s images from a local checkout instead of pulling them, on the same embedded stack (prod targets: what ships). Keys are the versions: keys; a sourced module needs no version.
plat5 init --sources <dir> resolves plat5, auth, operator, registry, and templates from sibling checkouts under <dir> (writing source: entries for runtime repos that exist there, and resolving plugins directly from local checkouts).
plat5 init scratch --sources .. --project-id scratch-cli --example tasks-saas -ycd scratch && plat5 start # builds, then runs; the first Rust build takes a whileA CLI built from this checkout with no version flag is a dev build (cli:): it runs any project, so go build -o plat5 ./cmd/plat5 is all --sources needs.
The embedded compose files (internal/bundle/stack) track plat5 HEAD, so a plat5 checkout at HEAD runs as it will ship. For hot reload of one service, use that repo’s own dev compose.
Embedded copies tested against sibling checkouts (skipped when siblings aren’t present):
- Config JSON Schemas (
internal/schema/files/↔plat5/schema/) - Embedded stack compose files (
internal/bundle/stack/{core,operator,operator-auth}.yml↔plat5/compose/&operator/compose/)
$XDG_STATE_HOME/plat5/projects/<project_id>/ (default ~/.local/state/plat5/…, on macOS too): state.json (the folder that owns the project id, what the last start ran, and the dev keys; mode 0600) and stack/ (the compose files, the generated override, and the sign-in themes, the operator IdP’s included).
One folder per project id: the id names both compose projects, the stack’s (plat5-<project_id>) and your app’s (<project_id>), their volumes and images, and this state, so a second folder with the same id would take over the first one’s. A folder’s default id is the normalized directory name docker compose gives a project in it, so there docker compose sees your app’s containers as plat5 runs them; under another id, add -p <project_id>. state.json records the owning folder (absolute, symlinks resolved), the first one to plat5 start the id, and start, stop, reset, status, logs and init from any other folder refuse, naming both folders; doctor reports it as a failed check. A state with no folder recorded is the next start’s. To run both, give one its own id: plat5 init --project-id b-work, or in an existing project’s plat5.local.yml:
project_id: b-work