# percher.toml — full reference

Validation is strict: unknown keys in any section fail the parse instead of being silently dropped. Run `percher doctor` to surface validation issues before you publish.

```toml
[app]
name = "my-app"            # 3-40 chars, lowercase a-z 0-9 and hyphens
runtime = "node"           # node | bun | python | static | docker
framework = "nextjs"       # optional: nextjs, sveltekit, astro, remix, nuxt,
                           # vite, preact, solid, express, fastify, hono,
                           # elysia, fastapi, flask, django, eleventy, hugo,
                           # laravel, rails, phoenix, go, rust, dotnet, java,
                           # docker

[build]
command = "bun run build"  # optional
output = ".next"           # optional
pass_env = ["NEXT_PUBLIC_API_URL"]  # opt-in build-time env; values come
                                    # from "percher env set", not the TOML

[web]
port = 3000                # 1024-65535
health = "/health"         # default "/"
command = "npm start"      # optional container start command
visibility = "password"    # "public" (default) | "password" | "private"
                           #   "private" = Percher-login gate (owner + invitees)
password = true            # legacy alias for visibility = "password"
spa = false                # static apps: deep links fall back to index.html
rate_limit = { rps = 10, burst = 50 }
                           # optional per-app rate limit, keyed by client IP
                           # (default: unlimited). rps 1-100, burst 1-1000,
                           # rps <= burst <= rps*10. Over the ceiling -> 429.
                           # Needs the platform's rate-limit module (operator).

[resources]                # recommended sizing, not a pool charge — see note below
memory = "512mb"           # 256mb | 512mb | 1gb | 2gb
cpu = 0.5                  # 0.25 - 2.0
instances = 2              # static N containers; plan-gated
                           # (free=1, starter=1, maker=2, max=4)

[resources.autoscale]      # alternative to instances; CPU-based
min = 1
max = 4

[data]
mode = "pocketbase"        # pocketbase | postgres | sqlite | convex |
                           # supabase | external | none

[domain]                   # parsed but not applied today:
subdomain = "my-app"       # the app name sets name.percher.run
custom = "myapp.com"       # use "percher domains add" for a custom domain

[env]
STRIPE_KEY = "sk_live_..." # legacy KEY=VALUE shape (still supported); or use
                           # required/optional/ignore arrays (the env contract)

[crons]
cleanup = { schedule = "0 3 * * *", command = "node cleanup.js" }

[[redirects]]              # up to 32, served at the edge before your app
from = "/old-path"         # exact path, or a prefix ending in "/*"
to = "/new-path"           # relative path or absolute https:// URL
status = 308               # 301 | 302 | 307 | 308 (default 308)

[headers."/*"]             # response headers per path (16 paths x 16 headers)
X-Custom-Header = "value"  # platform security headers can't be overridden

[dev]
ignore = ["*.log", "tmp/"]
debounce = 300             # ms before rebuild (100-10000)
auto_open = true

# [addons.*] is reserved and has no effect today: use [data] mode and [crons]

[checks.health]            # the only checks name Percher reads
path = "/health"           # required by the parser, not used (see [web] health)
timeout = 90               # seconds to wait for healthy (default 30, max 300)
initial_delay = 20         # seconds before failed probes count (default 5, max 120)
```

## Static files

For `runtime = "static"`, keep public files in `public/` and set:
```toml
[build]
output = "public"
```
Do not add a build command. Keep `percher.toml` and `pb/schema.json` in the project root; schema application still reads the latter there. Without an output directory, ordinary project-root files are public. Reserved platform files are excluded and return 404, including on SPA routes; this is not a substitute for choosing a public-only directory.

## Complete field index

- `app.name` — required; 3–40 chars: Lowercase public app name; starts with a letter and uses a–z, 0–9, or hyphens.
- `app.runtime` — node | bun | python | static | docker: Required runtime/build path.
- `app.framework` — nextjs | sveltekit | astro | remix | nuxt | vite | preact | solid | express | fastify | hono | elysia | fastapi | flask | django | eleventy | hugo | laravel | rails | phoenix | go | rust | dotnet | java | docker: Optional detection override; normally leave it out.
- `build.command` — string: Optional custom build command; not allowed with runtime = static.
- `build.output` — relative path: Optional directory containing build output.
- `build.pass_env` — up to 50 key names: Encrypted runtime env keys also exposed during build; values never belong in TOML.
- `web.port` — 1024–65535: Container port. Required when a [web] table is present; otherwise the platform resolves 3000.
- `web.health` — path string: Health-check path; defaults to /.
- `web.command` — 1–1000 chars: Container start command, especially for Python; bind to 0.0.0.0.
- `web.visibility` — public | password | private: URL access policy. Public is the default.
- `web.password` — boolean: Legacy alias: true means visibility = password.
- `web.spa` — boolean: Static-only fallback from deep links to index.html.
- `web.rate_limit.rps` — integer 1–100: Sustained requests-per-second target.
- `web.rate_limit.burst` — integer 1–1000: Ceiling; must be between rps and 10 × rps.
- `data.superuser_env` — boolean (default true): Managed PocketBase only. False stops giving the app POCKETBASE_ADMIN_EMAIL and POCKETBASE_ADMIN_PASSWORD; it stays false until a new live publish explicitly sets true.
- `data.mode` — pocketbase | postgres | sqlite | convex | supabase | external | none: App data integration.
- `data.file` — non-empty path: Required when data.mode = sqlite.
- `data.convex.deployment_url` — URL: Required when data.mode = convex.
- `data.supabase.url` — URL: Required when data.mode = supabase.
- `data.supabase.anon_key` — non-empty string: Optional public Supabase anon key; keep privileged keys in env.
- `domain.subdomain` — valid app name: Parsed but not applied; the app name sets the percher.run subdomain (change it with percher rename <name>).
- `domain.custom` — hostname without https://: Parsed but not applied; add a custom domain with percher domains add <domain>.
- `resources.memory` — 256mb | 512mb | 1gb | 2gb: Per-container memory cap used for admission.
- `resources.cpu` — 0.25–2.0: Per-container CPU cap used for admission.
- `resources.instances` — integer 1–4: Static instance count, plan-capped and incompatible with autoscale.
- `resources.autoscale.min` — integer 1–4: Autoscaling floor; must not exceed max.
- `resources.autoscale.max` — integer 1–4: Autoscaling ceiling, plan-capped.
- `resources.autoscale.scale_up_cpu_percent` — integer 1–100: Optional scale-up CPU threshold.
- `resources.autoscale.scale_up_sustain_seconds` — 30–3600: Seconds above the scale-up threshold.
- `resources.autoscale.scale_down_cpu_percent` — integer 1–100: Optional scale-down threshold; lower than scale-up.
- `resources.autoscale.scale_down_sustain_seconds` — 60–86400: Seconds below the scale-down threshold.
- `resources.autoscale.cooldown_seconds` — 30–3600: Minimum delay between scaling actions.
- `env.<KEY>` — legacy string value: Backward-compatible seed value. Prefer the contract below and percher env set for real secrets.
- `env.required` — UPPER_SNAKE_CASE[]: Keys that must exist before deploy.
- `env.optional` — UPPER_SNAKE_CASE[]: Referenced keys that may be absent.
- `env.ignore` — UPPER_SNAKE_CASE[]: References intentionally ignored by the scanner; a key may appear in only one env list.
- `required_env.<KEY>` — secret | url | string: Older typed requirement map; validated before deploy.
- `dev.ignore` — string[]: File patterns ignored by percher dev.
- `dev.debounce` — 100–10000 ms: Delay before percher dev rebuilds.
- `dev.auto_open` — boolean: Open the URL automatically in dev mode.
- `crons.<name>.schedule` — cron expression or one-shot timestamp (UTC): Recurring runs must be at least one minute apart. Five-field cron, macros and six/seven-field cron with one fixed second are supported.
- `crons.<name>.command` — non-empty string: Required command for a named task.
- `crons.<name>.description` — up to 200 chars: Optional plain-language dashboard description.
- `addons.pocketbase.enabled` — boolean: Reserved; no effect today. Use data.mode = pocketbase.
- `addons.cron.enabled` — boolean: Reserved; no effect today. Declare jobs under [crons].
- `addons.storage.mode` — pocketbase | volume | s3: Reserved; no effect today.
- `addons.storage.max_size` — string: Reserved; no effect today.
- `checks.<name>.path` — non-empty path: Required by the parser but not used; the probe uses web.health.
- `checks.<name>.interval` — integer ≥ 1: Accepted but not used.
- `checks.<name>.timeout` — integer ≥ 1: Read only under checks.health: seconds the deploy waits for the container to become healthy (default 30, max 300). Other names have no effect.
- `checks.<name>.initial_delay` — integer ≥ 0: Read only under checks.health: seconds before failed probes count (default 5, max 120). Other names have no effect.
- `redirects[].from` — exact /path or /prefix/*: Source path; unique, no whitespace or placeholders.
- `redirects[].to` — /path or https:// URL: Destination; cannot equal from.
- `redirects[].status` — 301 | 302 | 307 | 308: HTTP status; defaults to 308. At most 32 rules.
- `headers.<path>.<name>` — string: Custom response header: up to 16 paths and 16 headers per path; platform security/transport headers are reserved.

**Redirects and headers are edge-served.** Caddy answers a matching redirect before the request reaches your container (on password-protected apps, before the login gate too), and response headers are applied when the response is written — a header set here wins over the same header set by your app. Platform-managed headers (Strict-Transport-Security, X-Frame-Options, X-Content-Type-Options, Referrer-Policy, Permissions-Policy, and transport headers) are rejected at parse time. Prefix rules ("/docs/*") send every matched path to the same `to` — no capture groups in v1. `percher import` maps `vercel.json` redirects/headers and Netlify `_redirects`/`_headers` into these sections.

**What the CLI uploads.** `percher publish` and `percher push` leave out `node_modules`, `.git`, `dist`, `.next`, `.svelte-kit`, `build`, `coverage`, `.env`, `.envrc`, `.env.*`, `.env-*` and `.env_*`, `.bun`, `*.log` and `.DS_Store`, plus whatever `.gitignore` excludes. A `.percherignore` in the project root (same syntax as `.gitignore`) drops more files from the upload, and a `!` line re-includes one — for example `!/dist` for a static site whose `[build] output` is `dist`. `.env` files can never be re-included; set secrets with `percher env set`.

**Pools are measured, not reserved (with caveats).** `[resources]` `memory` and `cpu` are *recommended sizing* — the per-container cap your app runs inside — not a standing reservation. In steady state your account pool (memory / CPU / disk) is charged on *measured* usage, so running apps occupy only what they actually use and a light idle app barely touches the pool; that's what lets you run many small apps or one heavy one. The cap isn't entirely free, though: when an app is *deployed, woken, or resized*, its requested cap is counted against the pool for that admission check, an app with no fresh sample (new/stale/mid-restart) falls back to its cap until measured again, and RAM caps are bounded by a hard 2× pool committed guard. Pick a cap that fits the app's real footprint (too low risks OOM-kill; much higher than needed only tightens deploy/wake/resize admission + the 2× RAM guard), then watch measured usage per app on its Resources tab and account-wide on the Account page.

Full reference: https://percher.app/docs/percher-toml
