- Status: Accepted
- Date: 2026-11-11
Context#
Tier 3 lets an HTX or an outside developer add a feature to DX-OS without
changing the core. The plug-in model is the main point of the OLP 2026 entry.
The demo installs a tea hill tour booking app (tea-tour) live and removes it
again, and the core must keep running, with every smoke and browser test green,
when no mini-app is installed.
The core already has what such an app needs:
- Keycloak tokens with
htx_codeand realm roles. - APISIX in standalone YAML mode, with an internal port
9081for the web container. - Hasura row permissions on
htx_code. - Python services built from the same base image (
disease-api,dxos-scanner,dxos-dataops).
Decision#
Each mini-app is its own service, described by an app.yaml manifest
(apiVersion: dxos/v1, JSON Schema in platform/apps/manifest.schema.json)
and installed with the dxos CLI (./dxos install|remove|list|validate).
- Process: one container per app, built from the app directory or pulled
by
@sha256:digest. The CLI generates its compose file with fixed settings that the manifest cannot change: - network
dxos-apps-netonly (internal: true; besides the apps it holds onlyapisixandpostgres, and every installed app shares it), no host port; - user
10001:10001, read-only root filesystem,/tmptmpfs; cap_drop: [ALL],no-new-privileges;- 256 MB of memory and 0.5 CPU.
- Routes:
- The CLI writes the app's APISIX routes under
/apps/<id>/intodocker/runtime/<project>/gateway/and merges them with the trackedplatform/gateway/apisix.yaml. APISIX reloads the merged file in place. - Protected prefixes use
openid-connectbearer_only, plus aclaim_schemacheck onrealm_access.roleswith the manifest's roles. - The tracked file is never modified at runtime.
- App routes match only on the internal listener
9081(vars: [["server_port", "==", "9081"]], ruling R23), so the published9080answers 404 under/apps/and every outside request goes through the web proxy.gateway-syncrefuses an app route without that condition. - Sign-in:
- The web app proxies
/apps/<id>/...toapisix:9081. It attaches the user's access token, taken server-side bygetCoreToken(), on protected paths only. - It forwards only to ids in
platform.installed_apps, drops the browser's cookies and authorization headers, and refuses cross-site writes. - The app decodes the token's claims without verifying its signature; on a
user request the gateway has verified it. The gateway is not the only
path to an app, though: every installed app shares
dxos-apps-netand can call another app directly with a forged token. In v1.8.0 the trust boundary is therefore the set of installed apps, so only trusted apps may be installed (ruling R24). Per-app isolation (JWT verification or a network per app) is deferred to v1.9. - Data:
- Each app gets a schema and a login role, both
app_<id>, with rights on that schema only and a connection cap. - Migrations run as that role, and every table must have
htx_code text NOT NULL. - Core data is read through Hasura with the user's own token, so the core's tenant rules apply unchanged.
- UI:
- Pages are rendered on the server, as HTML and forms with no JavaScript.
Every response under
/apps/carriesscript-src 'none'. - Signed-in pages show inside the app shell in an
<iframe sandbox="allow-forms allow-same-origin allow-top-navigation-by-user-activation">. /dxos-app.cssgives apps the core's design tokens, and?theme=passes the viewer's light or dark choice.- Lifecycle:
- The CLI journals its steps (validate, database, gateway, compose).
./dxosthen starts the container and registers the app. - A failure or an interrupt at any step undoes the earlier steps in reverse order.
- Remove keeps the app's data unless
--purgeis given.
Alternatives considered#
- Next.js modules compiled into
apps/web(a plugin folder or package per app): rejected. - Every install or removal would mean a rebuild and a redeploy of the core image, which is the opposite of plug-in.
- App code would run inside the web process, with its session cookies, secrets and database connection.
- A broken or malicious app could take down or read the whole core.
- A low-code builder (forms and workflows defined in n8n or a form builder, stored as data): rejected.
- It cannot express what
tea-tourneeds: a booking that locks the tour row so concurrent guests never oversell, per-HTX data rules, and public and role-scoped pages. - It ties apps to one engine. n8n is not OSI-licensed (ADR 0001).
- A visual builder's output is hard to review and test.
- Client-side apps with scripts in the frame were also rejected. A script
inside the app shell's origin could read the user's session, and the
sandbox without
allow-scriptsremoves that whole class of risk.
Consequences#
- Installing or removing an app touches no tracked file and does not rebuild
the core. With the image built ahead,
./dxos install miniapps/tea-tourtakes about 11–12 seconds. - A stack with no app installed has a gateway file identical to the base and
behaves as before. A stack started with a bare
docker compose up(noDXOS_GATEWAY_FILE) has no app routes, which fails closed. - Apps are limited by design:
- no JavaScript, no cookies, and no response headers beyond
content-typeand a redirectlocationinside the app; - no internet access at run time;
- a Python image for the health check.
- Each app is one more container (256 MB cap) and one more database role.
The role keeps
CONNECTon the other databases throughPUBLICin v1.8.0 (ruling R17). - The public route limit (10 requests a minute per IP) is enforced in the web
proxy per process, and it trusts
X-Forwarded-For. It must move to the gateway or a shared store when web runs more than one instance. - The release bundle of v1.8.0 cannot install mini-apps: no CLI image is published, and the release stack starts with the base gateway file.
- The manifest format is now a public contract (
dxos/v1). Breaking changes need a newapiVersion.