AAP Template Spec v2 — Authoring Guide
Overview
Templates define how applications are deployed on AI Admin Panel. Each template is a YAML file that describes the Docker Compose configuration, user-configurable variables, resource requirements, and routing rules.
This guide covers the v2 template specification. All curated templates in the catalog follow this exact format.
To start from an existing repository instead of a blank file, use Generate with AI from a GitHub repo on the custom-template editor: it fills in a draft you review before saving.
Template Structure
A template YAML file has three sections:
- Top-level envelope —
apiVersionandkind(alwaysv2andTemplate) - Metadata — name, description, category, tags, icon
- Spec — compose definition, variables, resource requirements, domain routing
Here is a complete minimal example:
apiVersion: v2
kind: Template
metadata:
name: my-app
displayName: My App
description: "A simple web application with persistent storage."
category: business
icon: ""
tags: [web]
license: "MIT"
spec:
domains:
- port: 3000
minResources:
cpuCores: 1
memoryMB: 256
compose: |
services:
app:
image: myapp/myapp:latest
expose:
- "3000"
volumes:
- app_data:/app/data
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/health"]
interval: 30s
timeout: 10s
retries: 3
restart: unless-stopped
volumes:
app_data:
Logo
Every catalog template ships its project's own logo, served by the panel itself. The panel never loads logos from a CDN, so offline installs show them and no third party sees which apps an admin browses. A test fails when a template has no logo, so add one with the template:
Get the project's official mark: from its repository (
assets/,docs/,public/, the README logo, the favicon) or its website. Prefer SVG; otherwise a PNG of at least 128 px with a transparent background. Only when the project ships none, use its simple-icons SVG (CC0), downloaded rather than linked. Never use a generic glyph or another project's logo.Save it as
frontend/public/logos/<metadata.name>.svg(or.png), under 100 KB. Logos are drawn on a white tile in both themes, so pick the dark-on-light variant. SVGs may not contain scripts, event handlers,<foreignObject>or links to outside files.Record where it came from in
frontend/public/logos/SOURCES.json:"my-app": { "file": "my-app.svg", "source": "https://raw.githubusercontent.com/example/my-app/<commit>/docs/logo.svg", "license": "trademark of Example Inc., used to identify the project", "retrieved": "2026-10-28" }Map it in
frontend/src/features/templates/templateIcons.tsx(TEMPLATE_LOGOS).
frontend/src/features/templates/templateIcons.test.ts checks every catalog YAML against these three places. A project that publishes no logo at all goes in TEMPLATES_WITHOUT_LOGO with the reason, and shows the first letter of its name instead.
Full YAML Reference
Metadata Fields
| Field | Type | Required | Description |
|---|---|---|---|
apiVersion | string | yes | Must be "v2" |
kind | string | yes | Must be "Template" |
metadata.name | string | yes | URL-safe slug (e.g., "my-app"). Used as the unique identifier. |
metadata.displayName | string | yes | Human-readable name shown in the catalog UI |
metadata.description | string | yes | 2-3 sentence marketing description |
metadata.category | string | yes | One of: ai-agents, ai-apps, knowledge-rag, automation, ai-models, databases, devtools, business, tools (the operator's own infrastructure; no customer plan offers it). Before these existed the values were ai and webapps; a file that still has them is accepted and stored as ai-apps and business. |
metadata.icon | string | no | Not shown by the panel; leave it empty. The catalog shows the template's bundled logo (see Logo) |
metadata.tags | string[] | no | Search and filter tags (e.g., [web, database, llm]) |
metadata.trending | bool | no | Show in the trending section of the catalog |
metadata.hidden | bool | no | Keep the template out of every panel (not listed, not deployable) while its file stays for later |
metadata.hiddenReason | string | when hidden | Why it is hidden; required with hidden: true, refused without it |
metadata.featured | bool | no | Show in the catalog's Featured section at the top of the Templates page. Refused together with hidden: true |
metadata.featuredOrder | int | with featured | Position in the Featured section, 1 first. Leave it out (0) when the template is not featured |
metadata.lowProminence | bool | no | Keep the template listed but never featured, and sort it last in its category. Refused together with featured: true |
metadata.license | string | yes for catalog templates | The upstream licence as its LICENSE file states it, for example MIT, AGPL-3.0 or Sustainable Use License. Shown on the card and template page as information only: no gate, no confirmation. A catalog file without it fails the test suite |
metadata.licenseNote | string | no | One plain line about the licence that an operator should know, for example who may run it for several tenants. At most 200 characters |
metadata.support | string | no | Catalog templates only: maintained or beta. Leave it out for Beta. See Template Support Levels. Anything else stops the panel loading the catalog |
metadata.retirementFlag | object | no | Catalog templates only. Asks the owner to keep, hide or remove the template: reason (upstream-archived or no-stable-release), since (YYYY-MM-DD), optional note. Changes nothing by itself. go run ./cmd/template-retirement-review prints the table for the monthly review |
Spec Fields
| Field | Type | Required | Description |
|---|---|---|---|
spec.compose | string | yes* | Docker Compose YAML (as a multiline string) |
spec.image | string | yes* | Docker image for single-container shorthand |
spec.gitRepo | string | yes* | Repository source for a Git template |
spec.gitBranch | string | no | Branch for a Git template |
spec.buildMethod | string | no | auto, dockerfile, railpack or compose (nixpacks is refused: Railpack replaced it) |
spec.domains | DomainSpec[] | recommended | Port-to-domain routing declarations |
spec.minResources | object | yes | {cpuCores: int, memoryMB: int} |
spec.securityProfile | string | no | "secure", "advanced", or "raw" (variable override policy; runtime validation still applies) |
spec.recommendedVersion | string | no | The image tag the template installs. When the template has a VERSION variable, this must equal that variable's default, without any @sha256: digest (see Pinning the image version) |
spec.variables | Variable[] | no | User-configurable parameters |
spec.ai_managed | bool | no | Marks the service as AI-managed (shows AI badge in catalog) |
spec.aiInjection | object | no | Declares which of the app's own env vars receive the chosen AI source's credentials (see AI Source Injection) |
spec.firstRun | string | no | "default-password" or "first-visitor-admin". Declares that a fresh install can be taken over by whoever reaches it first. Every service starts private until its owner clicks Make public; this field only names the reason, so the service page tells the owner what to do first (change the default password, or create the admin account). Without it the page gives the general reason. Any other value is refused. The value is copied onto the service at deploy time, so editing the template later changes nothing for services that already run |
spec.backup | BackupSpec | recommended for templates with a database | Names the containers that hold a database and their engine, so service backups use that engine's dump tool (see BackupSpec Fields). Without it the backup looks at spec.secrets annotations of class postgres/mysql, then at the image name |
spec.gpu_required | bool | no | Indicates GPU hardware is required |
spec.ssoEnabled | bool | no | Keeps every route of the app behind panel sign-on for good. Make public is refused for such a service (409) and the proxy keeps the lock whatever its gate says. Required when the app takes the user's identity from a request header: a template that names X-Forwarded-Email or X-Forwarded-User anywhere (Compose, a variable default, an injected file), or sets an environment entry whose name contains TRUSTED and HEADER, is refused without it. Such an entry must name X-Forwarded-Email or X-Forwarded-User literally: those are the headers the panel's sign-on sets and Traefik overwrites, so a visitor cannot send their own. sso: true on the first route alone is not enough, because a second route could be made public |
spec.keySignedAPI | bool | no | The template's one routed port is an API that refuses every request not signed with keys the panel generates (RustFS's S3 API). A service deployed from it starts public instead of private, because its clients cannot sign in to the panel. Catalog only: it takes effect only for a built-in template on the panel's reviewed list in code (today RustFS); creating or updating a custom template with it is refused with 400. Also refused together with spec.firstRun, spec.ssoEnabled or spec.gitRepo, unless spec.domains lists exactly one port, and unless the compose file exposes exactly that port and publishes no host port, so no web console is published next to the API |
spec.recommended_vram_mb | int | no | Recommended GPU VRAM in megabytes |
*At least one of compose, gitRepo or image must be provided. If only image is set, the platform generates a minimal compose wrapper automatically.
Variable Fields
| Field | Type | Required | Description |
|---|---|---|---|
name | string | yes | Environment variable name (UPPER_SNAKE_CASE) |
displayName | string | yes | Label shown in the deployment form |
type | string | yes | "string", "integer", "boolean", "password", or "select" |
default | string | yes | Default value (use "" for empty) |
required | bool | no | Must be filled before deploy (default: false) |
description | string | no | Help text shown below the input field |
locked | bool | no | Read-only when security profile is secure |
hidden | bool | no | Only shown in Advanced mode (hidden from basic deploy form) |
options | SelectOption[] | no | For select type only: [{value: "x", label: "X Label"}] |
gpuAuto | string | no | A deploy-time default computed from the GPUs the app gets. The variable must be a select with an option auto; only auto is computed, any other option is kept as chosen. memoryShare: a GPU memory share by the smallest card's size (0.6 under 38 GiB, 0.7 from 38 GiB, 0.8 from 75 GiB; 0.6 when the size is unknown), leaving room for the panel's Local AI . tensorParallel: how many cards one model is split across, the largest power of two up to the cards the app gets, at most 8; 1 for one card or an unknown count. An explicit number above the cards the app gets is refused before the deploy |
commandFlag | string | no | A flag such as --tensor-parallel-size that the panel appends, with the variable's value, to the end of the command list of the template's only service. The variable must be a select and must not appear as ${NAME} in the compose. Must look like --lower-case-words. With gpuAuto: tensorParallel, a split also sets shm_size: 2gb unless the service sets its own |
omitFlagWhen | string | no | The value that leaves commandFlag out, so the default renders the command unchanged (for example "1"). Needs commandFlag |
DomainSpec Fields
| Field | Type | Required | Description |
|---|---|---|---|
port | int | yes | Container port to expose (1-65535) |
protocol | string | no | "https" (default) or "http" |
System Variables
System variables are auto-resolved by the platform at deploy time. Use them in your compose YAML with ${AAP_*} syntax. You never define these in the variables section — they are built-in.
Auto-Generated Credentials
| Pattern | Generates | Length | Use Case |
|---|---|---|---|
${AAP_PASSWORD_<ID>} | Random password: letters, digits and -_+= | 32 chars | Database passwords, admin passwords |
${AAP_SECRET_<ID>} | Random hex string | 64 chars | JWT secrets, API keys, encryption keys |
${AAP_BASE64_<ID>} | Base64-encoded random bytes | 44 chars | Credential encryption keys |
${AAP_HEX_<ID>} | Lowercase hex string (16 random bytes) | 32 chars | Keys an app accepts only as exactly 32 letters and digits, such as Activepieces' AP_ENCRYPTION_KEY |
Consistency rule: Use the same full token to reuse a value everywhere in one deployment. The generator kind is part of the key: PASSWORD_DB and SECRET_DB are distinct. For example, ${AAP_PASSWORD_DB} used in both the app service and the database service will produce the same password.
IDs must be: UPPER_SNAKE_CASE — e.g., DB, ADMIN, JWT, SESSION, ROOT, CREDS
Derived Keys (signed JWTs)
Some stacks need API keys that are JWTs signed with one of the generated secrets. Supabase's anon and service-role keys are an example. Write ${AAP_JWT_<ID>} where the key is needed, and declare how to sign it under spec.secrets:
spec:
secrets:
SECRET_JWT:
class: fixed # the signing secret
JWT_ANON:
class: fixed
jwt:
signedBy: SECRET_JWT # a ${AAP_PASSWORD_|SECRET_|BASE64_...} token used in the compose
claims: { role: anon, iss: supabase }
The platform generates the signing secret, signs an HS256 token with the claims plus iat and exp (5 years; a template may not set iat, exp, alg or typ itself), and stores both like any other generated secret. Both must be class fixed. A fixed secret is never rotated in place, because rotating the signing secret alone would invalidate every key signed with it. The template loader refuses a derived key without a valid declaration, so a mistake fails the build rather than a deploy.
Domain Variables
These are resolved at deploy time based on the service name and panel configuration:
| Variable | Resolves To | Example |
|---|---|---|
${AAP_FQDN} | Fully qualified domain name | myapp.panel.example.com |
${AAP_URL} | Full URL with protocol | https://myapp.panel.example.com |
${AAP_SERVICE_NAME} | Service slug name | myapp |
${AAP_FQDN_<ROUTE>} | Host of a named second route (see Several addresses); <ROUTE> is the route name in capitals | ${AAP_FQDN_HOOKS} → myapp-hooks.panel.example.com |
${AAP_URL_<ROUTE>} | The same with https:// | ${AAP_URL_HOOKS} → https://myapp-hooks.panel.example.com |
A route variable must name a route the template declares after the first entry; the loader refuses any other name. Use it when the app hands one of its addresses to someone else, for example a webhook URL it registers with a phone carrier.
Quick Reference: Which Variable to Use
| Need | Variable |
|---|---|
| Database password | ${AAP_PASSWORD_DB} |
| Admin password | ${AAP_PASSWORD_ADMIN} |
| JWT / session secret | ${AAP_SECRET_JWT} |
| Encryption key | ${AAP_SECRET_CREDS} or ${AAP_BASE64_CREDS} |
| Key that must be exactly 32 letters/digits | ${AAP_HEX_KEY} |
| Application URL (with https://) | ${AAP_URL} |
| Domain name only (no protocol) | ${AAP_FQDN} |
Leaving a reference for the app ($$)
In Compose, $$ is a literal $. Write $${NAME} when the app itself should expand ${NAME} at runtime, for example in a shell entrypoint or a config file the app reads. The panel leaves $${NAME} alone, even when NAME is a template variable or a system variable such as ${AAP_URL} or ${AAP_SECRET_KEY}. It does not fill in a value, generate a secret, or report the name as unresolved. $$${NAME} is a literal $ followed by a normal ${NAME}, which the panel fills in.
Domain Routing
Declare which port your service listens on:
spec:
domains:
- port: 3000
The platform automatically configures Traefik to route https://{service}.{panel-domain} to container:3000. Users never need to enter URLs or configure reverse proxy rules.
Only the ports listed under domains get an address. A port that the Compose file exposes but domains does not list is reachable by the app's other containers on its own network, never through the proxy. A catalog template with no domains entry at all gets no address: that is how a template keeps a service without its own login (a database, a vector store) off the internet.
Several addresses (named routes)
An app with a second web door on another port (an API next to a dashboard) declares one named entry per door. Each entry is a route with its own address and its own lock:
spec:
domains:
- name: api # required when there is more than one entry
port: 8888 # the first entry is the main address
- name: ui
port: 9999
sso: true # always behind panel sign-on; never offered "Make public"
- The first entry is the main address,
https://{service}.{panel-domain}, and uses the app's own lock (Make public). Every other route answers onhttps://{service}-{name}.{panel-domain}, one DNS label, so the wildcard certificate covers it. - A route without
ssostarts private and gets its own Make {name} public button. A route withsso: truestays private for good: use it for any page that controls the app (an admin console, a dashboard holding the API key). - Names are a lower-case letter followed by 1 to 14 lower-case letters or digits.
customandport<N>are reserved. Names and ports must be unique; at most 4 routes. - Every route port must be in the
expose:list of the same Compose service as the first route. Routes on another container are not supported. sso: trueon the first entry keeps the main address behind panel sign-on for good while the other routes can still be made public: an app whose UI must stay private but whose webhook route must answer a third party (Dograh's phone-carrier hooks). It is refused on a template with only one route and next tospec.ssoEnabled(which already locks every route); usespec.ssoEnabledto lock the whole app.ssoon any route is refused next tospec.ssoEnabled, which already locks every route.- With
spec.keySignedAPI, every route after the first must setsso: true, and the Compose file must expose exactly the route ports. - Only the declared routes get an address. A port the Compose file exposes without a route gets none.
A template with one entry needs no name and behaves as before. A template with several entries without names is refused when it is loaded or saved. (Before named routes, each extra entry got an address {service}-port2.{panel-domain}; services deployed that way keep it. A port that was exposed but not listed under domains also got one until AI-933; it loses it the next time the panel rebuilds the container (a redeploy, Make public, a secret rotation or an owner change).)
Tip: You do not need to add Traefik labels or configure SSL certificates. The platform handles all routing, TLS termination, and certificate provisioning automatically.
Compose Requirements
When writing the spec.compose section, follow these rules:
Must Do
- Use
expose:instead ofports:— Traefik handles external access. Never bind to host ports. - Include a
healthcheck:— The platform uses this to detect when the service is ready. - Use named volumes for persistence — not bind mounts.
- Use
restart: unless-stoppedon all services. - Use system variables for URLs — never hardcode domains (
${AAP_URL},${AAP_FQDN}). - Use
${AAP_PASSWORD_*}/${AAP_SECRET_*}for credentials — never hardcode secrets.
Must Not
- Do not use
ports:— this will conflict with Traefik routing. - Do not hardcode URLs or domains — they change per deployment.
- Do not use bind mounts (
./data:/app/data) — use named volumes. - Do not include Traefik labels — the platform adds them automatically.
- Do not use an image that itself carries
traefik.*oraiadminpanel.*labels (docker image inspect <image> --format '{{json .Config.Labels}}'shows them). The platform refuses such an image at deploy time, with no override, because image labels would otherwise become routing rules it did not generate. - Do not name a Compose service
panel,traefik,keycloak,openbao,openbao_log_rotatororvalkey, give it a name starting withaiadminpanel_, or a name containing a dot. Each service name is a host name for the app's own containers, and on an app that belongs to no customer it is also a name on the network the platform's proxy and AI gateway look names up on; the platform refuses these names at deploy time. - Do not set
network_mode: host— this breaks container isolation. - Containers of one app reach each other by their Compose service names (
db,redis), and only their own: for an app with several containers that belongs to a customer, those names live on a private network of that app alone. On the customer's shared network every container answers only<project>-<service>(see App access), so two apps that both name their databasedbnever reach each other's. cap_dropis optional. The panel drops its standard 16 capabilities on every container whatever the template says; a template's owncap_dropis added to that list and can only remove more.shm_size,tmpfsandulimitsare honoured within bounds (for exampleshm_size: 1gbandtmpfs: /tmp:size=256mfor a headless Chromium); see Validation limits for the maximums and what is refused. Sizes above the service's memory limit are lowered to it.- Every container gets a process limit of 4096 (processes and threads together). Set
pids_limitonly when the app's own documentation shows it needs more, at most 16384, with a comment saying why (ClickHouse and the code workspaces use 12288 and 8192). A raise above the default must also be listed ininternal/templates/ai2437_pids_limit_test.go. security_optmay only holdno-new-privileges; any other entry is refused. The panel setsno-new-privilegesitself and passes nothing from a template'ssecurity_optto Docker.user,working_dir,stop_signal,stop_grace_period,init,read_only,extra_hosts, allowlistedsysctlsand the template's own (non-traefik.)labelsare honoured; see Every Compose key for what is refused or ignored. An image that needs a setuid helper (sudo,su) as a non-root user will not start; use an entrypoint that starts as root and drops withgosu/su-exec, or one that needs no privilege change.
Pinning the image version
Every image a deployable template pulls must use a fixed release tag, never a moving one (latest, main-latest, stable, main, nightly). A moving tag means the same template installs a different app from one day to the next, sometimes an unreleased development build, and that is how a surprise PostgreSQL 18 broke fresh installs (AI-442).
The main image takes its tag from the VERSION variable. Its default is the release tag followed by the image digest, so every deploy gets exactly the build that was checked:
recommendedVersion: "0.40.3"
variables:
- name: VERSION
type: string
default: "0.40.3@sha256:adca95a12c2b386a8f9a995e7fa0600e187e3323b5e5522f5a6c3b1ec73eff99"
hidden: true
compose: |
services:
ollama:
image: ollama/ollama:${VERSION}
Take the digest of the multi-platform index, check that it lists linux/amd64 (docker manifest inspect ollama/ollama:0.40.3), and bump tag and digest together. recommendedVersion repeats the tag. A sidecar with a fixed image writes the same tag@sha256: form directly on its image: line. The test TestTemplatesPinVersion in internal/templates/ fails on a moving tag; its allow-list names the few templates that still wait for a decision.
How template versions stay current
Every template pins a release tag plus an image digest. Once a day an automated check compares each pin with the upstream release and upstream security advisories, using internal/templates/version-sources.yaml. Each template needs an entry there; the repository's checks fail without one.
The check proposes changes and never applies them. A newer patch or minor version becomes a pull request that deploys the template in a test run, a major version or a database migration becomes a ticket, and a critical or high advisory becomes an urgent pull request plus an issue. A security fix comes first: when only a pre-release fixes the advisory, the urgent pull request uses that pre-release, says so in its title, and is never merged automatically. The template returns to a stable release once one includes the fix. Services already running keep their version until you update them.
Health Check Examples
HTTP health check (most common):
healthcheck:
test: ["CMD-SHELL", "curl -sf http://localhost:3000/ || exit 1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
PostgreSQL readiness check:
healthcheck:
test: ["CMD-SHELL", "pg_isready -U myuser"]
interval: 10s
timeout: 5s
retries: 5
TCP port check (when no HTTP endpoint exists):
healthcheck:
test: ["CMD-SHELL", "nc -z localhost 6379 || exit 1"]
interval: 10s
timeout: 5s
retries: 3
Security Profiles
The securityProfile field controls how the platform handles template variable overrides:
| Profile | Behavior |
|---|---|
secure | Default for curated templates. Variables marked locked: true cannot be changed by the user — they always use the default value. |
advanced | Allows broader variable editing; Compose/runtime validation still applies. |
raw | Relaxes variable override restrictions; does not bypass Compose/runtime security validation. |
When authoring templates, prefer secure and lock any variables that could compromise security if changed (e.g., bind addresses, exec policies).
Variable Types in Detail
String
Free-text input. Validated against control character injection.
- name: APP_TITLE
displayName: Application Title
type: string
default: "My Application"
required: false
Integer
Numeric-only input. Only digits are accepted.
- name: WORKER_COUNT
displayName: Worker Threads
type: integer
default: "4"
required: false
Boolean
Toggle switch. Value must be exactly "true" or "false".
- name: ENABLE_REGISTRATION
displayName: Allow User Registration
type: boolean
default: "true"
required: false
Password
Masked input field. Validated against YAML injection. Good for API keys and tokens that users provide.
- name: OPENAI_API_KEY
displayName: OpenAI API Key
type: password
default: ""
required: false
description: "Your OpenAI API key. Get one at https://platform.openai.com/api-keys"
Note: For auto-generated passwords (database credentials, admin passwords), use system variables (
${AAP_PASSWORD_*}) instead of a password variable. Generated values are read in the service's Service Access card and the Secrets views, which check permissions and write an audit entry. The deploy completion screen lists only their names; usehideFromDeployCompletionmetadata to keep a name off that list as well.
Select
Dropdown with predefined options. The submitted value is validated against the options list.
- name: DEPLOYMENT_PROFILE
displayName: Deployment Profile
type: select
default: "solo"
required: true
description: "Resource allocation profile"
options:
- value: solo
label: "Solo Dev — 1 CPU, 512MB RAM"
- value: team
label: "Team — 2 CPU, 2GB RAM"
- value: production
label: "Production — 4 CPU, 4GB RAM"
Examples
Minimal: Single-Container Service
The simplest possible template — one container, one volume, one port.
apiVersion: v2
kind: Template
metadata:
name: uptime-kuma
displayName: Uptime Kuma
description: "Self-hosted uptime monitoring tool with a beautiful status page."
category: devtools
icon: ""
tags: [monitoring, uptime, status-page]
spec:
domains:
- port: 3001
minResources:
cpuCores: 1
memoryMB: 128
recommendedVersion: "1"
variables:
- name: VERSION
displayName: Uptime Kuma Version
type: string
default: "1"
required: false
hidden: true
compose: |
services:
uptime-kuma:
image: louislam/uptime-kuma:${VERSION}
expose:
- "3001"
volumes:
- uptime_kuma_data:/app/data
healthcheck:
test: ["CMD-SHELL", "curl -sf http://localhost:3001/ || exit 1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
volumes:
uptime_kuma_data:
Multi-Service: App + Database
A web application with a PostgreSQL database. Uses system variables for credential sharing between services.
apiVersion: v2
kind: Template
metadata:
name: my-webapp
displayName: My Web App
description: "Web app with PostgreSQL database. Zero-config deployment with auto-generated credentials."
category: business
icon: ""
tags: [web, database]
spec:
domains:
- port: 3000
minResources:
cpuCores: 1
memoryMB: 512
variables:
- name: VERSION
displayName: App Version
type: string
default: "latest"
required: false
hidden: true
compose: |
services:
app:
image: myapp/webapp:${VERSION}
environment:
DATABASE_URL: postgresql://app:${AAP_PASSWORD_DB}@db:5432/myapp
APP_URL: ${AAP_URL}
SESSION_SECRET: ${AAP_SECRET_SESSION}
expose:
- "3000"
depends_on:
db:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "curl -sf http://localhost:3000/health || exit 1"]
interval: 30s
timeout: 10s
retries: 3
restart: unless-stopped
db:
image: postgres:16-alpine
environment:
POSTGRES_USER: app
POSTGRES_PASSWORD: ${AAP_PASSWORD_DB}
POSTGRES_DB: myapp
volumes:
- db_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U app"]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
volumes:
db_data:
Note how ${AAP_PASSWORD_DB} appears in both the app and db services. The platform generates the password once and substitutes the same value in both places.
AI Service with User-Provided API Keys
An AI application where the user provides their own API key during deployment.
apiVersion: v2
kind: Template
metadata:
name: ai-chat
displayName: AI Chat
description: "AI chat application with configurable LLM provider. Bring your own API key."
category: ai-apps
icon: ""
tags: [ai, chat, llm]
spec:
ai_managed: true
domains:
- port: 3000
minResources:
cpuCores: 1
memoryMB: 512
variables:
- name: OPENAI_API_KEY
displayName: OpenAI API Key
type: password
default: ""
required: false
description: "Your OpenAI API key. Get one at https://platform.openai.com/api-keys"
- name: MODEL
displayName: Default Model
type: select
default: "gpt-4o"
required: true
options:
- value: gpt-4o
label: "GPT-4o (recommended)"
- value: gpt-4o-mini
label: "GPT-4o Mini (faster, cheaper)"
compose: |
services:
chat:
image: ai-chat/app:latest
environment:
OPENAI_API_KEY: ${OPENAI_API_KEY}
DEFAULT_MODEL: ${MODEL}
APP_URL: ${AAP_URL}
JWT_SECRET: ${AAP_SECRET_JWT}
expose:
- "3000"
healthcheck:
test: ["CMD-SHELL", "curl -sf http://localhost:3000/health || exit 1"]
interval: 30s
timeout: 10s
retries: 3
restart: unless-stopped
AI Source Injection (spec.aiInjection)
If your template is an AI app, declare spec.aiInjection so the panel can inject the operator's chosen AI source — Provider AI, the bundled Local AI (Ollama), or a bring-your-own key — into the variable your app actually reads. Without this block the panel never invents a variable for you; the deploy form simply marks the app "configure in-app" and shows the reachable endpoint.
At deploy, the operator picks the source in a AI source selector (shown only when this block is present). The panel resolves that source to {apiKey, baseURL, model} and maps it onto the vars you name below. The choice is saved on the service, so a later customer reassignment re-injects the same source.
Declare one shape that matches how your app consumes AI:
spec:
aiInjection:
# Shape A — OpenAI-compatible app (the common case: LiteLLM, most apps).
# Works for ANY OpenAI-compatible source (Provider AI, a vLLM Local AI,
# OpenAI/OpenRouter BYO, and Ollama's /v1 endpoint).
openaiCompatible:
apiKeyVar: OPENAI_API_KEY
baseURLVar: OPENAI_API_BASE # optional if the app defaults to api.openai.com
modelVar: OPENAI_MODEL # optional
# Shape B — Ollama-native app (e.g. open-webui) that takes a BARE Ollama
# base URL (no /v1). Satisfiable only by a Local-AI (Ollama) source.
ollama:
baseURLVar: OLLAMA_BASE_URL
# Shape C — per-provider key app (e.g. openclaw), keyed by the source's
# provider type ("openai" | "anthropic" | "openrouter" | "ollama").
byProvider:
openai: { apiKeyVar: OPENAI_API_KEY, baseURLVar: OPENAI_BASE_URL }
anthropic: { apiKeyVar: ANTHROPIC_API_KEY }
openrouter: { apiKeyVar: OPENROUTER_API_KEY }
ollama: { baseURLVar: OLLAMA_BASE_URL }
| Mapping field | Meaning |
|---|---|
apiKeyVar | The app's env var that receives the source's API key |
baseURLVar | The app's env var that receives the source's base URL (Ollama-native shapes get the bare base, no /v1) |
modelVar | The app's env var that receives the source's default model |
aiInjection.byoKeyVars is an optional list beside the three shapes. It names form variables in which the operator brings a provider key that your app reads directly and that no mapping names (for example byoKeyVars: [OPENAI_API_KEY, GEMINI_API_KEY]). Nothing is injected for it. The deploy page switches the AI source to "Bring your own key" when the operator types into one of these fields or into a key variable named by a mapping, because an app deployed with Local AI or Provider AI would otherwise leave the typed key unused. List only visible password variables of the same template.
aiInjection.required: true declares that your app cannot start without an AI model, for example because it exits at startup when its key is empty (Hindsight does). The deploy page then does not offer "Configure later", and the panel refuses the deploy, before anything is created, when no AI source is chosen, when "Bring your own key" is chosen and no key field is filled in, or when the chosen panel source gives the app nothing at deploy time (for example, Local AI is switched off and the customer has no metered AI). Leave it out for an app that runs unconfigured and lets the user set AI up inside it later.
Which sources the form offers is derived from the shape, so it never promises a source your app can't use:
| Your shape | Provider AI offered? | Local AI offered? | Bring-your-own offered? |
|---|---|---|---|
openaiCompatible | ✅ | ✅ | ✅ (it has a key var) |
byProvider (non-Ollama keys) | ✅ | only if an ollama entry exists | ✅ |
ollama only | ❌ (a remote endpoint can't be a bare Ollama base) | ✅ | ❌ (no key var) |
Only the values you actually set are written — an empty key is omitted, not set to "". The injected source lands in your app's own variable, overriding the compose default; an explicit bring-your-own key the operator types in the deploy form wins over an auto-injected source.
Using the Image Shorthand
For the simplest single-container services, you can use spec.image instead of spec.compose. The platform generates a minimal compose wrapper automatically.
apiVersion: v2
kind: Template
metadata:
name: simple-app
displayName: Simple App
description: "A stateless web application."
category: business
icon: ""
tags: [web]
spec:
image: myapp/simple:latest
domains:
- port: 8080
minResources:
cpuCores: 1
memoryMB: 128
This is equivalent to writing a full compose spec with a single service. Use the compose field instead when you need volumes, health checks, environment variables, or multiple services.
Input Validation and Security
The platform performs strict validation on all user-provided variable values before substituting them into compose YAML:
- String values are rejected if they contain control characters or newlines
- Integer values must match
^\d+$ - Boolean values must be exactly
"true"or"false" - Password values are rejected if they contain control characters or YAML structure characters (
:,#,-) - Select values are validated against the declared options list
These checks reject specific unsafe variable inputs. They complement Compose and runtime validation; they are not a security certification of the application.
Submitting to the Catalog
To contribute a template to the curated catalog:
- Fork the repository
- Create your template YAML in a folder under
internal/templates/catalog/ - Run
go test ./internal/templates/...to validate the template loads and passes all checks - Submit a pull request
All templates in the catalog are embedded into the panel binary at build time and seeded into the database on startup.
Optional: an Assistant runbook
The in-panel assistant can operate any app with its general method (see What the Assistant can do inside your apps). For an app with tricky parts you can add a short runbook as internal/templates/runbooks/<template name>.md: where the config lives, the app's own CLI or admin API, known problems, a safe restart and what not to touch. Its front matter names the template, a revision, the appVersion it was checked against (it must equal the template's recommendedVersion, so a version bump makes you re-check it), the reviewed date and the panel tools the text names. At most 6 KB. Write facts about the app; never claim a step needs no approval: the tests refuse such wording, and the panel asks anyway.
BackupSpec Fields
spec:
backup:
databases:
- container: db # compose service name
engine: mysql # postgres | mysql | mariadb | mongodb | redis
secret: PASSWORD_DB # key of spec.secrets, or the <KEY> of a ${AAP_<KEY>} token
user: ghost # optional; the engine's default otherwise
- container: cache
engine: redis
ephemeral: true # redis only: a cache or queue broker whose data is safe to lose
skipVolumes: [cache] # reserved; not applied by current capture
| Field | Type | Required | Description |
|---|---|---|---|
databases[].container | string | yes | A service of spec.compose |
databases[].engine | string | yes | postgres, mysql, mariadb, mongodb or redis (Valkey counts as redis) |
databases[].secret | string | no | The generated secret holding the database password |
databases[].user | string | no | The database user the dump connects as |
databases[].ephemeral | bool | no | redis only. Declares a cache, job-queue broker or session store whose data is safe to lose. The database backup lists it in the manifest as skipped and still dumps the PostgreSQL databases. Without it, a Redis/Valkey container makes the whole database backup fail |
skipVolumes | string[] | no | Reserved; current owned-volume capture includes every owned volume and does not apply this hint |
A wrong engine, a container that is not a compose service, a secret the template never generates, or ephemeral on an engine other than redis makes the template fail to load.
Set ephemeral only when the application's own documentation shows it keeps no lasting data in Redis: losing it may drop queued jobs or sign users out, but nothing a user created. A Redis that holds real data (the standalone Redis and Valkey templates, an app that stores records there) stays unmarked; such a service has no working database backup until the Redis dumper lands. Every catalog template with a database carries this hint.
System Variables
System variables are auto-resolved by the platform at deploy time. Use them in your compose YAML with ${AAP_*} syntax. You never define these in the variables section — they are built-in.