SHADE is young: 0.1.0-next.2 is a pre-release, and 0.1.0 isn't out yet.

SHADE
Run SHADE

Setting up an instance (Coolify)

Each client gets their own server running Coolify. On it SHADE's template starts one Postgres database, one Redis, SHADE's image in three containers (the admin, the account API and the worker) and a small router in front of them. The static site and the preview server come after, as applications of their own. Nothing is shared between clients.

flowchart LR
  accTitle: One client's server on Coolify
  accDescr: Everything runs on the client's server, in Coolify. One domain, admin.example.com, goes to the router, a small Caddy in the same resource. The router sends /api/v1/account/* to shade-api in the public role (forms, checkout, webhooks) and everything else to shade-api in the admin role (the admin SPA, /api, MCP, /uploads). shade-api in the worker role has no domain (schedules, /health only). www.example.com goes to shade-site with target static (Caddy, files only). preview.example.com goes to shade-site with target preview (Node, /preview, the team). Postgres holds the records; Redis holds the work in flight and is required.
  subgraph server["Client's server (Coolify)"]
    domain["admin.example.com<br>(the one domain)"] --> router["router<br>Caddy, plain HTTP"]
    router -->|"/api/v1/account/*"| public["shade-api (role public)<br>forms, checkout, webhooks"]
    router -->|"everything else"| admin["shade-api (role admin)<br>admin SPA, /api, MCP, /uploads"]
    none["(no domain)"] --> worker["shade-api (role worker)<br>schedules, /health only"]
    www["www.example.com"] --> static["shade-site (target static)<br>Caddy, files only"]
    preview_domain["preview.example.com"] --> preview["shade-site (target preview)<br>Node, /preview, the team"]
    pg[("Postgres<br>records")]
    redis[("Redis<br>work in flight, required")]
  end

The SHADE repository's deploy/compose.yml is this setup as one Docker Compose resource, with the container settings every instance keeps: no published ports, a read-only filesystem for the API and Redis, every capability dropped, and limits (Hardening a production instance). On Coolify you paste it in, name the image, give one domain to the router, deploy and open the owner link. The template as one Docker Compose resource goes through it step by step; one application per role is the alternative for a rolling update.

Every instance has a worker. The worker role runs scheduled publishing, retention, email retries, clean-up of left-behind media files, security alerts and the modules' schedules. The other roles never run these, and there is no fallback: without a worker container, every admin screen shows Background work is not running: no worker container answers.

An instance runs admin, public and worker. A small one may run all three as one all container (the small profile); SHADE_API_ROLE=all is also the default when the variable is unset. Without Coolify, see Self-hosting without Coolify.

The template as one Docker Compose resource

Five steps get a running instance with its owner account. Nothing else is required for that; forms and account sign-in come once the modules are on (Configure SHADE for the site).

  1. Paste the template. In Coolify: New resource → Docker Compose Empty, and paste deploy/compose.yml from the SHADE repository (the small profile: deploy/compose.small.yml, see below). It needs Docker Compose 2.23.1 or newer.
  2. Name the image. Coolify's Docker Compose resource has no repository to build from, so the template names the image through ${SHADE_IMAGE}, and each of those services also has a build: block that Coolify cannot use. Delete the build: block and keep the image: ${SHADE_IMAGE} line above it. There are two such places: the x-api block at the top and the secrets service. The small profile needs the same in its secrets and shade services. Leave the other image: lines (Postgres, Redis, the router) as they are.
    No SHADE image has been released yet, so build and push your own, from the root of the SHADE repository:
    docker build --platform linux/amd64 -f apps/api/Dockerfile -t ghcr.io/<owner>/shade:<tag> .
    docker push ghcr.io/<owner>/shade:<tag>
    

    --platform linux/amd64 matters when you build on an ARM machine for an amd64 server; leave it out when both match. Pushing needs a Docker login on the build machine with a token that has the write:packages scope.
    Then open the resource's Environment Variables and give SHADE_IMAGE that image and tag. It is the one variable you must set: the containers don't start without it. Everything else has a default or is generated. The template has no ${VAR:?message}, since Coolify would store the message as the value.
    A private registry needs a login on the server. Coolify pulls as the user it connects to the server as (root by default), with that user's Docker login. For GitHub's registry, make a classic personal access token with only the read:packages scope (fine-grained tokens don't cover packages), then on that server, as that user:
    docker login ghcr.io -u <GitHub user> --password-stdin
    

    Paste the token, press Enter, then Ctrl+D. The login stays in that user's ~/.docker/config.json; every later deploy uses it.
  3. Give the domain to the router. The template has a router service: Caddy, speaking plain HTTP behind Coolify's proxy, with the same routes shade install uses on a server of your own. It sends /api/v1/account/* to public and everything else to admin, retries a read that arrives while a container restarts, and answers "starting" instead of a bare 502 while none is up. In Coolify, under Domains, give the domain to router and write the port it listens on after it: https://admin.example.com:8080. For a compose service, Coolify routes to the port written on the domain; visitors still use the normal HTTPS port, 443. The template names the same port through SERVICE_URL_ROUTER_8080. admin, public and worker get no domain, and there is no path or "strip prefixes" setting to set anywhere. SHADE_API_URL and SHADE_ADMIN_URL default to that domain; set them only to use another address, such as an admin on its own address. The small profile has no router: give its shade service the domain, and set SHADE_API_URL yourself.
    In production SHADE refuses to start when SHADE_API_URL is empty, so a router without a domain stops the containers with a message that says so.
  4. Deploy, then check https://admin.example.com/health: {"ok":true,"role":"admin","checks":{"redis":"up","database":"up","started":"up","migrations":"up","running":"up","maintenance":"off"}}. /health is the readiness answer: 200 only when this container can do its work, else 503 with the failing check set to down (redis, database, migrations while the image's migrations are not all applied, started while it starts, running once it is stopping). maintenance says whether maintenance mode is on and never makes it 503. /health/live only says the process runs and never causes a restart over a database or Redis outage. The API refuses to start when Redis does not answer, and says so in its log. The one-shot secrets service shows as exited once it has written the secrets: that is expected.
    Then, in the admin service's Terminal, run node console/doctor.mjs. Its account-route check asks the account API on the public address and says what is wrong when the route is not right (The doctor). The template sets restart: unless-stopped; keep it, since Restart now on the Modules screen, after installing a server package, stops the API gracefully and relies on it starting again. Afterwards request a form's published address from outside the server (/api/v1/account/forms/published/<form>) and expect 200, not 404.
  5. Open the owner link. While nobody has an account yet, the admin's log (in Coolify: the admin service's Logs) shows a block with the address to open and a one-time code, between two marker lines. It prints at start and again every five minutes until the owner exists:
    =================== SHADE: CREATE THE OWNER ACCOUNT ===================
    No team member yet. Open https://admin.example.com/create-owner and enter this code to create the owner account: 7KQM-4XZP-93RT
    The code works once, until 14:32 UTC. This message repeats every 5 minutes until the owner exists.
    =================== SHADE: CREATE THE OWNER ACCOUNT ===================
    

    Request logs can bury it, so search the log for No team member yet instead of scrolling (on the server, docker logs <the admin container> 2>&1 | grep "No team member yet"). Open that address, enter the code, your name, your email address and a password. You are signed in as the first admin, and the admin takes you to set up two-factor or a passkey: do that now. Once this account exists, the page is gone and the admin's address shows the sign-in page. Only someone who can read the server's logs gets the code, so nobody who happens on a fresh instance first can make themselves its owner. A nearly expired code is replaced in the block. node console/create-admin.mjs in the container's terminal still makes an admin, for a script, or behind a proxy that changes the Host header (the page answers only on the admin's own address).

What to do next, and what the template does for you:

Set the backup target in the admin, not in Coolify. Coolify gives every variable to every service. Its generated compose file passes the whole environment of the resource to each container, so a variable you set for the admin reaches public and worker too. So keep the backup settings out of Coolify's environment. Once the resource runs, open the admin service's Terminal in Coolify and set the bucket and its keys there (node console/backup-target.mjs is in the image, next to the other console commands):

node console/backup-target.mjs set --url s3://<bucket>/<prefix> --access-key-id <key id> --endpoint <the service's address>

It asks for the secret access key, checks that the bucket answers, and saves the settings in the secrets-backup volume, which only the admin, the worker and the rehearsal's Postgres mount (Setting the target). Then restart the resource. The public container never holds the bucket's keys or the backup key this way: it ignores every SHADE_BACKUP_* variable it is given. A target you do put in Coolify's environment still works (it reaches the admin and the worker, and wins over the file) and public starts all the same, but then public holds the bucket's keys too. Leave SHADE_BACKUP_URL and SHADE_BACKUP_S3_* empty in Coolify when you use the command: a value set there wins over the command's file.

The bucket's endpoint is the service's address without the bucket. Cloudflare R2 shows a bucket's S3 address with the bucket on the end (https://<account id>.r2.cloudflarestorage.com/<bucket>): leave /<bucket> off, or SHADE refuses to start and says so. A bucket made with EU jurisdiction has an address of its own, https://<account id>.eu.r2.cloudflarestorage.com, with --region auto; the address without .eu. does not find it.

The secrets are generated on the first start. The template's secrets service runs once before the others. It writes APP_SECRET, SHADE_BACKUP_KEY and the passwords of its Postgres roles, the rehearsal's Postgres and Redis, one file each, into five volumes by who reads them:

VolumeHoldsMounted by
secretsAPP_SECRET, SHADE_DB_PASSWORD, the Redis passwordevery SHADE container, Postgres, Redis
secrets-ownerthe owner's passwordadmin, Postgres
secrets-backupthe backup key, the rehearsal's passwordadmin, worker, the rehearsal's Postgres
secrets-backup-rolethe backup role's passwordworker, Postgres
secrets-databasePostgres's superuser passwordPostgres alone

The public container never holds the backup key, the owner's or backup role's password, or the superuser's password. Leave the secrets unset in Coolify: a later start reuses the files, and a value you set wins. The doctor's secrets check says which were generated and which set. If the secrets service warns that it generated a password for a database that already holds data (a Postgres volume older than the secrets' volumes), set that password to the old one.

Keep a copy of APP_SECRET and the backup key apart from the server, and confirm it once. The volumes go when the server goes, and a backup restored on a new instance opens neither its files without the backup key nor its stored secrets (email and payment keys, two-factor secrets) without the APP_SECRET they were sealed with. A signed-in admin confirms the copy with POST /api/backups/kept-copy. Until then the doctor's kept-copy check warns; a new value of either secret needs confirming again. To read them once, on the server:

docker exec <the admin container> cat /app/secrets/app/APP_SECRET /app/secrets/backup/SHADE_BACKUP_KEY

Removing a set secret later brings back the generated one. A value you set wins over its file, but the file stays, so unsetting it makes the next start read the generated value again. For APP_SECRET that signs everyone out and leaves stored secrets sealed with the set one unreadable (see Rotating APP_SECRET). For the backup key, backups made meanwhile no longer open. For a database or Redis password, the containers can no longer connect, since the database keeps the password it was made with. Keep a set secret set, or rotate it.

Defaults stay defaults. Coolify lists each variable the template names, empty when you give none. SHADE reads empty as unset, so the template's default applies (SHADE_BACKUP_CRON 0 3 * * *, keep counts 7, 4 and 6, SHADE_BACKUP_BEFORE_MIGRATE true, SHADE_PACKAGE_APPROVAL and SHADE_OIDC_REQUIRED false), and a value you set wins. Other settings, such as SHADE_TRUSTED_MODULE_KEYS, the identity providers' SHADE_OIDC_* or the usage limits, go into Coolify's environment as they are; the table under API and admin lists them, with what each does.

  • The rehearsal's database address is written out in the template (postgres://rehearsal@postgres-rehearsal:5432/rehearsal, with the generated password added). To use a scratch database of your own, edit that value in the compose file.
  • The rest default to empty (${VAR:-}).

The database roles. The template makes SHADE's three Postgres roles (The database's roles) with an init script of its postgres service. A Postgres resource you add yourself needs them made the same way.

Redis is Valkey in the template (valkey/valkey:9.1-alpine, BSD-licensed). It holds only work in flight, so it needs no backup and no volume; what a restart loses is listed under Project, database and Redis.

Stop grace. The template gives admin 130 seconds and public and worker 40 seconds (stop_grace_period). A stopping container turns /health to 503 and goes on serving for 3 seconds (SHADE_DRAIN_DELAY_MS). Then it finishes its requests and closes live streams, and a schedule's run in progress gets SHADE_STOP_GRACE_MS (30 seconds) less five, counted from the signal, to end before it is aborted and rolled back. A container still busy at the deadline exits with code 1 and logs what was running. An upload that takes longer than the admin's 120 seconds fails, and the admin tells the person to try again. A Coolify Docker Compose resource restarts in a few seconds on an update. The router is recreated on a deploy too, so requests in those seconds can fail. The router keeps no admin cookie stickiness, which only matters while two admin containers run; a Coolify resource runs one.

The admin on an address of its own

The team can open the admin at its own subdomain, such as https://admin.example.com, while frontends, payment providers and MCP clients use https://api.example.com:

  1. Give the router both domains in Coolify (Domains: https://admin.example.com:8080,https://api.example.com:8080, each with the router's port): it answers any host, and the same containers answer both. Without the template, give the admin application both domains.
  2. Set SHADE_API_URL=https://api.example.com and SHADE_ADMIN_URL=https://admin.example.com in Coolify's environment (on the admin, public and worker applications, when you run one application per role).
  3. Deploy. Opening https://api.example.com/ now leads to https://admin.example.com/. The team signs in there: its session, passkeys and the links in password and address emails belong to the admin's address. A passkey made on the old address does not work on the new one; set it up again on the account page.

Use a subdomain of the same domain as the API. Hosting the admin's files somewhere else (a CDN) is not supported yet.

Configure SHADE for the site

  1. Sign in. Under Team, create Site build (role editor, no password). Under API tokens, make a build token for it. It reads published content like a read token, and the site runner reports each build with it (a read token cannot).
  2. Settings: site name, language and the Site URL, the site's address (https://www.example.com). It is set only here. Canonical links, the sitemap and the site's build use it, and visitor routes and account sign-in accept browsers only from there (and from the frontends listed below it). Set it before the first build.
    Choose the default language now, before any module goes on. Switching the website module on creates its default header and footer parts in the instance's language at that moment, and they count as content. The site seed then no longer sees an empty instance and refuses to set the language.
  3. Get the modules on. A module installs only when signed with a key the instance trusts. For your own modules, and for now the official ones too:
    1. Make two key pairs, a main and a backup (Keeping a signing key).
    2. Put both public keys in SHADE_TRUSTED_MODULE_KEYS (name=<public key>,name2=<public key>) on the admin, public and worker applications and redeploy.
    3. Build the module's package, sign it with the main key and install it on the Modules page (Packaging and signing). A catalogue baked into the image (SHADE_MODULE_CATALOGUE) does this for several at once.

    The website and forms modules are the usual first two, and the project module too if the site's pages read its data. Installed modules start after a restart and stay off until you switch them on, which you do after the language is set. Install every module the site's seed reads before running it.

Site (static) and preview

A site's pages, navigation, footer and theme belong to the website module: install it on the Modules page and switch it on first. Its settings there hold the Preview address and the build hook.

  1. Static site: an application from the site's repository, shadehq-dev/shade-site. Its image builds on SHADE's packages next to it, not on the pre-releases on npm, so build it from the SHADE workspace (with its submodules). Dockerfile site/Dockerfile, build context the repository root, build target static, port 8080, domain https://www.example.com. Build variables: SHADE_API_URL (https://admin.example.com) and SHADE_API_TOKEN (the build token; prefer a build secret).
  2. Preview: same Dockerfile, build target preview, port 4321, domain https://preview.example.com. Runtime variables SHADE_API_URL and SHADE_API_TOKEN. Only the team uses it, inside the admin: set the website module's Preview address to https://preview.example.com.
  3. Publish at least the home page (the page with an empty address; a new instance has no pages), then rebuild the static site once.

Or: one site container that builds itself (Dockerfile target runner). The same image serves every client. On start, and on every publish, it builds the site from the client's SHADE instance into a fresh folder and switches to it in one step. Caddy serves it on :8080 and the site's Node server (islands, /preview) runs beside it, so this one container replaces both the static site and the preview.

  • Runtime variables: SHADE_API_URL, SHADE_API_TOKEN (the build token), SHADE_ACCOUNT_URL (https://www.example.com), ACCOUNT_API_URL, ASTRO_KEY, and SITE_REBUILD_TOKEN (openssl rand -hex 24).
  • The website module's Preview address: the site's own address (https://www.example.com), where this container serves /preview too.
  • The website module's Build hook URL: http://<site container>:8081/rebuild?token=<SITE_REBUILD_TOKEN>. Port 8081 stays internal; GET :8081/health reports the last build. SHADE calls an internal address only for the path /rebuild; any other build hook must be public.
  • A volume on /app/site/builds keeps the current build and the one before across restarts, so the site is served at once while the next build runs. Use a named volume (Coolify's default), which takes the folder's owner from the image. A bind mount must be writable by uid 1000.
  • Builds run one at a time. Publishes during a build give one more build after it. A failed build keeps the previous site online.

Visitors' personal parts and routes. The static site's Caddy sends two paths on, so visitors only talk to www.example.com. That matters for accounts: their cookie must belong to the site.

  • /_server-islands/* goes to the site's Node server (SITE_SERVER_URL, default http://shade-preview:4321). It renders the parts of pages made per visitor, such as the Account greeting. Without it they keep their empty placeholder.
  • /api/v1/account/* goes to the API's public role (ACCOUNT_API_URL, default http://shade-api:4000; with the template, the router's domain, which sends the account route on to public). Build the site with SHADE_ACCOUNT_URL=https://www.example.com, so forms and the account page post to the site's own domain.
  • Set the same ASTRO_KEY (npx astro create-key) as a build variable of both the static site and the Node server. It encrypts what those parts receive. The static site is rebuilt on every publish while the server keeps running, so a key that changed per build would break them.

The static site contains every image its pages use, so it never calls SHADE. A static host can serve it instead of the static image: Hosting the site on a static host.

Both site images send Strict-Transport-Security: max-age=31536000; includeSubDomains. After a first visit, browsers use only HTTPS for the domain and all its subdomains for a year, so serve every subdomain (also ones outside SHADE) over HTTPS before going live. The other security headers are in Request protection.

Publishing → rebuild

  1. Static site application → Webhooks → Deploy webhook (Coolify's name for the site's build hook). Copy the URL: it contains a token, so it is a secret.
  2. Paste it into the website module's Build hook URL (Modules page, its Settings) and save.
  3. Publishing triggers one rebuild after a 30-second quiet period, however many pages were published.

Client programs (optional: shade-programs)

Only when the client runs programs of their own beside SHADE (Client programs). Without a host the instance still runs: client programs can be approved, but not run or called.

One host serves one instance. It holds the server's Docker socket, which is as good as root on that server, so it gets no domain and no published port. Only the instance reaches it, on the instance's network.

  1. The image. Until the first shade-programs release, build it from shadehq-dev/shade-programs: New resource → Application, build pack Dockerfile. After the release, use ghcr.io/shadehq-dev/shade-programs:<version>.
  2. gVisor. Install runsc on the server and register it with Docker (runsc install, then restart Docker), so untrusted client programs run under it. Without it, leave SHADE_PROGRAMS_GVISOR on: approved client programs are trusted and run either way, and an untrusted one refuses to start until gVisor is installed. off runs untrusted programs in plain containers, for development only.
  3. A shared token: openssl rand -hex 32, kept only in Coolify's environment settings.
  4. The host as a Docker Compose resource on the same server, on the instance's network (find it with docker inspect --format '{{json .NetworkSettings.Networks}}' <shade-api admin container>):
    services:
      shade-programs:
        image: shade-programs
        restart: unless-stopped
        # The Docker socket and its group (stat -c %g /var/run/docker.sock): the one container that holds it.
        group_add: ['<socket group id>']
        volumes:
          - /var/run/docker.sock:/var/run/docker.sock
          - shade-programs-data:/data
        environment:
          SHADE_PROGRAMS_TOKEN: ${SHADE_PROGRAMS_TOKEN}
          # The API as the client programs reach it: the admin container, which serves the content and data APIs.
          SHADE_API_URL: http://<shade-api admin container>:4000
          # This container's own name, so the host joins each client program's network for the egress proxy.
          SHADE_PROGRAMS_CONTAINER: ${SHADE_PROGRAMS_CONTAINER}
        networks:
          - shade
    networks:
      shade:
        external: true
        name: <the instance's network>
    volumes:
      shade-programs-data:
    

    Deploy it once, read the container's name (docker ps --format '{{.Names}}' | grep shade-programs), set SHADE_PROGRAMS_CONTAINER to it and deploy again. The host logs listening on 8090 and egress proxy on 3128.
  5. The instance: in the environment of the admin, public and worker applications, set SHADE_PROGRAMS_URL=http://<shade-programs container>:8090 and SHADE_PROGRAMS_TOKEN (the same token). Set both or neither: with one alone SHADE refuses to start. Redeploy and open Programs in the admin. No notice about the host means it answers.

Every setting of the host is in shade-programs' README. Adding, approving and starting a client program are on the Client programs page.

One application per role

The template is one resource, which restarts in a few seconds on an update. A rolling update, with no gap, needs a resource of its own for each container role. This section is that setup. The template's steps above do not apply to it: here Coolify's proxy sends the traffic to the applications itself, so each application gets its port and domain, and the account route needs a path on the admin's domain. The sections on the site, the modules and client programs hold as they are; where they name the router's domain, use the admin application's domain.

Project, database and Redis

  1. Projects → New, named after the client.
  2. New resource → Database → PostgreSQL, image postgres:18-alpine. Postgres 18 keeps its data in /var/lib/postgresql/18/docker, so mount its persistent storage at /var/lib/postgresql, not /var/lib/postgresql/data. Make SHADE's three roles in it (The database's roles; SQL under Self-hosting by hand). Keep the internal address, which each role's address is built from.
  3. Enable scheduled backups, to storage the client owns.
  4. Redis. Every instance has one; the API does not start without it. Any server that speaks the Redis protocol works. The template ships Valkey (valkey/valkey:9.1-alpine), which is BSD-licensed (Redis 8 is AGPLv3, RSALv2 or SSPL). Add it as New resource → Docker Image with no domain and no published port, the start command below, and a password of letters and digits (openssl rand -hex 32; it goes into the address as it is).
    environment:
      VALKEYCLI_AUTH: ${REDIS_PASSWORD}
    command: ['sh', '-c', 'exec valkey-server --requirepass "$$VALKEYCLI_AUTH" --maxmemory 64mb --maxmemory-policy noeviction --appendonly no --save ""']
    

    The password comes from REDIS_PASSWORD, never written into the command; the health check valkey-cli reads the same variable. Coolify's own Database → Redis resource works too: set the same in its Custom Redis Configuration, without requirepass, which Coolify sets.
    Redis holds only work in flight (leases, the queue, messages between containers, rate-limit counters, the cache), so it needs no backup and no volume. A restart loses for good only the health history of modules and features, up to five minutes of request counts, and the tickets of a module approval or take-data export in progress (start those again). Queued jobs under way are sent again from Postgres within seconds. noeviction matters: a full Redis then refuses writes loudly, instead of quietly dropping a lease, which would let a schedule run twice.

API and admin

  1. New resource → Application from this repository. Build pack Dockerfile, location apps/api/Dockerfile, base directory /.
  2. Port 4000. Domain https://admin.example.com.
  3. Storage: a persistent volume at /app/data (uploaded media).
  4. Environment variables (.env.example lists all). The API reads an empty variable as unset and takes its default; only the required ones need a value. The site's build reads an empty variable as empty, so leave out there the ones it doesn't need.
    VariableValue
    SHADE_API_ROLEadmin
    DATABASE_URLinternal Postgres URL, as the running role shade_app
    DATABASE_OWNER_URLthe same address as the owner shade, on the admin only: it applies migrations (required with MIGRATE_ON_START)
    REDIS_URLredis://:<password>@<redis host>:6379 (required)
    APP_SECRETopenssl rand -base64 48. Keep it stable (sessions, preview links) and the same on every application. The template generates it
    APP_SECRET_PREVIOUSempty; only while you replace APP_SECRET (Rotating APP_SECRET)
    SHADE_API_URLhttps://admin.example.com: where the API answers, and the team opens the admin
    SHADE_ADMIN_URLoptional: the admin's own address (see above). Empty: SHADE_API_URL
    SHADE_ACCOUNT_URLhttps://www.example.com, the same as the site's (visitor email links point here)
    MIGRATE_ON_STARTtrue
    STORAGE_DRIVERlocal, or s3 with STORAGE_S3_* and STORAGE_PUBLIC_BASE_URL (examples per provider in .env.example)
    SHADE_TRUSTED_MODULE_KEYSoptional: name=<public key> pairs for keys that signed modules may carry (the official modules' key, or your own). Server packages need one to install as trusted modules
    SHADE_PACKAGE_APPROVALoptional, false: true lets an admin approve a server package no trusted key signed, after signing in again with two-factor or a passkey (Approving a server package). Environment only. Switched off again, approved packages stop running at the next start. Same value everywhere
    SHADE_MODULE_CATALOGUEoptional: a folder in the image with signed module packages and purposes.json. While no module is installed, the admin's first step asks what the site is for and preselects modules (Setting up a new instance). Admin only
    SHADE_UPDATE_FEED_URLoptional: https address of an update feed you choose; Settings → Updates then says when it lists a newer SHADE. Nothing is downloaded (Knowing when there is a new version). Admin only
    SHADE_OIDC_*optional: the team's identity providers, with SHADE_OIDC_DOMAINS and SHADE_OIDC_REQUIRED (Identity providers)
    SHADE_SECURITY_CONTACToptional: where security reports go, served at /.well-known/security.txt (mailto:, https: or tel:, comma-separated). Set your own address: empty sends reports to the SHADE project (mailto:security@shadehq.dev)
    SHADE_SMTP_ALLOW_INTERNALoptional, false: true lets the email settings' SMTP server be inside the server's own network. Off, such a server is refused (Email). Environment only; same value everywhere
    SHADE_PROVIDER_URLSoptional: <plugin>.<provider>=<url> pairs, such as payments.mollie=http://localhost:4343/v2, sending a module's outside provider to another address. Only for a local stand-in in tests or a proxy of your own; that module alone may then call it over http. Environment only; empty in production
    SHADE_PROXY_SECREToptional, public role: for a site on a static host that forwards the account API (Cloudflare with forwarding, or Netlify). The same secret as the Worker's or Netlify site's, at least 32 characters (Hosting the site on a static host)
    SHADE_ACCOUNT_COOKIE_DOMAINoptional: the domain of the account sign-in cookie, so subdomains of SHADE_ACCOUNT_URL's host get it too (api.example.com, for a static-host site whose personal parts render at islands.api.example.com). Must be SHADE_ACCOUNT_URL's domain or a parent of it, never the site's own (SHADE warns). Same value everywhere (Hosting the site on a static host)
    SHADE_LOG_FORMAToptional, json: one JSON object per line. text for development (Logs, request ids and traces)
    SHADE_TRUST_PROXY_IDSoptional, false: true keeps an incoming X-Request-Id (up to 64 letters, digits, -, _) and continues a valid traceparent from a proxy of yours. Otherwise each request gets a new id and trace
    OTEL_EXPORTER_OTLP_ENDPOINToptional: your OpenTelemetry collector (http://otel-collector:4318). Set, SHADE sends traces and logs over OTLP/HTTP; the host must be yours or in the EU (Traces)
    OTEL_EXPORTER_OTLP_HEADERSoptional: headers for every export, name=value pairs, comma-separated
    OTEL_SERVICE_NAMEoptional, shade: the service name on spans and log records
    SHADE_METRICS_PORToptional: a port (9464) for GET /metrics (Prometheus) on its own server. Keep it inside the network: no published port, no domain (Metrics)
    SHADE_METRICS_TOKENrequired with SHADE_METRICS_PORT: Prometheus's bearer token, at least 32 characters (openssl rand -hex 32)
    SHADE_ERROR_REPORTING_DSNoptional: DSN of a GlitchTip or Sentry project (https://<key>@<host>/<project>) that each stored error is also sent to, scrubbed. The host must be yours or in the EU, and the client must know of it (Error reporting)
    SHADE_ERROR_REPORTING_SITEoptional, false: true also sends errors browsers wrote (sites, modules' admin parts)
    SHADE_ERROR_REPORTING_ENVIRONMENToptional: environment name on each report (production)
    SHADE_STOP_GRACE_MSoptional: how long a stopping container waits for requests and background work before exiting with code 1. Default 120000 on admin (uploads can be long), 30000 on public and worker (30000 everywhere in development). Keep the container's stop_grace_period (130 s on admin, 40 s elsewhere in the template) above it plus the drain delay
    SHADE_DRAIN_DELAY_MSoptional, 3000: how long a stopping container keeps serving before it stops listening, so a proxy that hasn't noticed yet doesn't find its connection cut. 0 skips it
    SHADE_MIGRATION_WAIT_MSoptional, 300000 (5 minutes): how long public and worker wait for the admin to apply migrations before stopping with an error. While waiting, /health answers 503
    SHADE_MAINTENANCEoptional, false: true keeps this container in maintenance mode without a database or Redis, for a restore. Remove it afterwards
    SHADE_LIMIT_STORAGE_MB, SHADE_LIMIT_DATABASE_MB, SHADE_LIMIT_ENTRIES, SHADE_LIMIT_TEAM_MEMBERS, SHADE_LIMIT_ACCOUNTS, SHADE_LIMIT_EMAILS_PER_DAY, SHADE_LIMIT_QUEUED_JOBS, SHADE_LIMIT_API_REQUESTS_PER_MONTHoptional, empty (no limit): usage limits, each a whole number from 1. Environment only; same values everywhere
    KEEP_ALIVE_TIMEOUT_MSoptional, 125000: how long the API keeps an idle connection. It must exceed the proxy's idle timeout so the proxy closes first (Coolify's Traefik: 90 s)

    Several variables name addresses. SHADE_API_URL is where the API answers, SHADE_ADMIN_URL is where the team opens the admin, and SHADE_ACCOUNT_URL is where visitors' browsers reach the account API. On the site, SHADE_API_URL is where its build reaches the API (on Coolify's network it may be http://shade-api:4000) and ACCOUNT_API_URL is where its Caddy forwards visitors (the API's public role). The site's own address is the Site URL setting (Configure SHADE), not a variable.
  5. Deploy, then check https://admin.example.com/health:
    {"ok":true,"role":"admin","checks":{"redis":"up","database":"up","started":"up","migrations":"up","running":"up","maintenance":"off"}}
    

    /health is the readiness answer: 200 only when the container can do its work, else 503 with the failing check set to down (redis, database, migrations while migrations are unapplied, started while starting, running once stopping). maintenance shows whether maintenance mode is on and never causes a 503. Coolify and the image's HEALTHCHECK call it. /health/live only says the process runs and never causes a restart over a database or Redis outage.
    The API refuses to start when REDIS_URL is missing, has no password or Redis does not answer, and logs Cannot reach Redis at redis://:***@…. "redis":"down" later means it lost Redis while running; it is out of service until Redis is back.
  6. Create the owner's account in the browser. While nobody has an account, the admin application's log (in Coolify: Logs) shows this block and repeats it every five minutes until the owner exists:
    =================== SHADE: CREATE THE OWNER ACCOUNT ===================
    No team member yet. Open https://admin.example.com/create-owner and enter this code to create the owner account: 7KQM-4XZP-93RT
    The code works once, until 14:32 UTC. This message repeats every 5 minutes until the owner exists.
    =================== SHADE: CREATE THE OWNER ACCOUNT ===================
    

    Search the log for No team member yet (on the server: docker logs <the admin container> 2>&1 | grep "No team member yet"). Open the address, enter the code, your name, email address and a password. You are signed in as the first admin; set up two-factor or a passkey now. Afterwards the page is gone. Only someone who can read the server's logs gets the code, so nobody who finds a fresh instance first can own it. A nearly expired code is replaced in the block. node console/create-admin.mjs in the container's terminal still makes an admin, for a script or behind a proxy that changes the Host header (the page answers only on the admin's own address).
  7. Keep Coolify's restart policy on unless stopped (the default). Restart now on the Modules screen, after installing a server package, stops the API gracefully and relies on Coolify starting it again. Packages are unpacked into /app/data/module-packages at every start.

Public role (visitor-facing routes)

Needed only when modules expose public routes (forms, appointments, commerce) and you want visitor traffic isolated from the team.

  1. Add a second application from the same repository and Dockerfile.
  2. Set SHADE_API_ROLE=public and MIGRATE_ON_START=false. Copy DATABASE_URL (as shade_app, never the owner's address), REDIS_URL, APP_SECRET, SHADE_API_URL, SHADE_ADMIN_URL, SHADE_ACCOUNT_URL, SHADE_TRUSTED_MODULE_KEYS, SHADE_PACKAGE_APPROVAL and any SHADE_OIDC_*. No volume: it never touches uploads. It loads the same server packages and restarts with the admin when asked.
  3. Route https://admin.example.com/api/v1/account/* (account sign-in included) to it with path-based routing in Coolify, or give it its own domain (such as https://api.example.com) and point the site's forms there.
  4. Scale with replicas if a campaign or sale needs it.

Worker (background work)

Required: without it nothing scheduled runs.

  1. Add a third application from the same repository and Dockerfile, with no domain and no published port. It serves only /health.
  2. Set SHADE_API_ROLE=worker and MIGRATE_ON_START=false (the admin migrates; start the worker after it). Copy the same variables as for the public role.
  3. Storage. With STORAGE_DRIVER=local, mount the admin's volume at /app/data: the worker removes left-behind media files and applies retention to them. Set MODULE_PACKAGES_DIR=/app/packages/module-packages (inside a writable /app/packages), so it unpacks server packages into its own folder instead of emptying the admin's at every start.
    Backups (optional). The worker takes an encrypted backup every night (Updating and backups) once it has the target and the key. Add these on the worker and the admin both, then deploy: SHADE_BACKUP_URL without SHADE_BACKUP_KEY stops the API.
    VariableValue
    SHADE_BACKUP_URLs3://<bucket> or s3://<bucket>/<prefix>
    SHADE_BACKUP_KEYopenssl rand -base64 32, the same on both. Keep a copy with APP_SECRET, never in the bucket (the template generates it; keep the copy anyway)
    SHADE_BACKUP_S3_ACCESS_KEY_ID, SHADE_BACKUP_S3_SECRET_ACCESS_KEYthe bucket's keys, apart from the media's
    DATABASE_BACKUP_URLworker only: the address as the backup role shade_backup, which runs the dump
    SHADE_BACKUP_S3_ENDPOINT, SHADE_BACKUP_S3_REGIONthe service's address and region, as in .env.example (AWS needs only the region)

    The endpoint is the service's address without the bucket. Cloudflare R2 shows https://<account id>.r2.cloudflarestorage.com/<bucket>: leave /<bucket> off, or SHADE refuses to start. A bucket with EU jurisdiction has its own address, https://<account id>.eu.r2.cloudflarestorage.com, with SHADE_BACKUP_S3_REGION=auto.
    With the template as one resource, set the target with node console/backup-target.mjs set in the admin container instead, so the public container never holds the keys.
    • The admin takes a backup before it applies migrations (SHADE_BACKUP_BEFORE_MIGRATE=false skips it).
    • After both have deployed, the doctor (node console/doctor.mjs) passes its backup-key check.
    • The weekly restore rehearsal needs a scratch database: the template's postgres-rehearsal service, which the worker reaches through SHADE_BACKUP_REHEARSAL_DATABASE_URL. Without the template, add a second small Postgres and set that address.
    • The admin card's Back up now queues a job the worker runs; it needs no setting.
    • A client who leaves gets the latest backup with node console/restore.mjs handover <folder>. The key and APP_SECRET go to them apart from the folder.
    • Client programs keep their data in volumes of their own. Cover those with Coolify's volume backups: the built-in backup holds only the database and media.

    The database's roles. The template uses three Postgres roles (The database's roles), made once on an empty volume by an init script of its postgres service (POSTGRES_PASSWORD is the bootstrap superuser's).
    RoleDoesVariableWhere
    shade_appruns every request and jobDATABASE_URLevery container
    shadeowns the database, applies migrationsDATABASE_OWNER_URLadmin only
    shade_backupreads everything for the dumpDATABASE_BACKUP_URLworker only

    Their passwords are SHADE_DB_PASSWORD, SHADE_DB_OWNER_PASSWORD and SHADE_DB_BACKUP_PASSWORD, each generated on the first start when not set. The script needs Docker Compose 2.23.1 or newer (configs: content). A Postgres resource you add yourself needs the roles made the same way. A database made before the three roles needs a fresh one: nothing is converted.
  4. Stop grace: 130 seconds on admin, 40 on public and worker (stop_grace_period in deploy/compose.yml). A stopping container turns /health to 503 and keeps serving for 3 seconds (SHADE_DRAIN_DELAY_MS), then finishes its requests and closes live streams. A schedule's run in progress gets SHADE_STOP_GRACE_MS (30 seconds) less five, counted from the signal, before it is aborted and rolled back; schedules stop at once. A container still busy at the deadline exits with code 1 and logs what was running. An upload longer than the admin's 120 seconds fails, and the admin asks the person to try again.
  5. Deploy, then check from its terminal:
    node -e "fetch('http://127.0.0.1:4000/health').then(r => r.text()).then(console.log)"
    

    Expect {"ok":true,"role":"worker","checks":{…}} with every check up. Within ten seconds the worker writes its first heartbeat and the admin's background-work error goes away.

Untrusted modules run in its sandbox too, so a schedule that publishes delivers the same events as the admin would. Several worker copies may run; a schedule's due time runs on one of them (see Scaling).

The small profile

An instance whose traffic one process carries (a brochure site, a small shop) may run SHADE as one container. deploy/compose.small.yml has Postgres, Redis and one shade container with SHADE_API_ROLE=all, which serves the admin, the content API and the visitor routes and runs the background work itself. It is supported and tested like the full template (same hardening, template test and release smoke test) and needs less memory: one API process instead of three, and no second Postgres. Give the shade service the admin's domain; /api/v1/account is on it too.

What it gives up:

  • Visitors and the team share one process. A spike on the account API or on a server-rendered frontend's content reads slows the admin, and the reverse.
  • One restart takes everything down at once: admin, visitor routes and background work. There is no update without a gap, and public cannot be scaled alone.
  • No weekly restore rehearsal. There is no scratch database. Backups still run and are checked but never restored on their own, so restore one by hand now and then (Updating and backups).

The admin never shows Background work is not running. Moving to the full template later keeps the same database, Redis and data volume: deploy deploy/compose.yml with the same variables and volumes.

Scaling and small servers

  • Memory: a small server (1–2 vCPU, 2 GB RAM) is enough. The images set NODE_OPTIONS=--max-old-space-size (192 MB for the API, 128 MB for preview); adjust per server. Roughly:
    ProcessApprox. memory
    Coolify (app, proxy, Postgres, Redis)0.5–1 GB
    Postgres for the client100–250 MB
    Redis for the clientcapped at 64 MB (maxmemory); the container at 128 MB
    API admin, public and worker~85 MB each (the worker more while a schedule runs)
    Site static (Caddy)~20 MB
    Site build on publish300–800 MB for a minute
  • Site builds are the largest spike. On a very small server, build the site in CI (GitHub Actions) and deploy only the static image.
  • Heavy traffic: the site is static files. Put a CDN in the client's own account in front of www.example.com if needed, or move the site to its own server.
  • Visitor-facing load (forms, checkout, and the content reads of a server-rendered frontend) goes to the public role: add replicas.
  • Background work can run on several workers. Each due time of a schedule runs on one of them, which holds a Redis lease meanwhile, so more workers never run a schedule twice. One is enough for most instances; a second keeps schedules running while the first restarts. Once an instance runs containers on more than one server, media go to S3: a local volume is seen by one server only.

Updating and handover

  • Push to the tracked branch or Redeploy. The API applies new migrations on start.
  • Redeploy the site after an update that changes how pages render.
  • A developer taking over needs repository access, the Coolify server, APP_SECRET and the database backups. Redis needs nothing: everything in it is rebuilt after a restart.

Before each release

Each SHADE release is first checked by its release gates (pnpm release:gates):

  • Better Auth's security advisories against the pinned version (pnpm advisories:better-auth);
  • the dependencies (pnpm security:audit) and the image (pnpm security:scan image <image>) scanned;
  • the image started with the deployment template's settings (pnpm deploy:smoke --image <image>);
  • every package packed and checked (pnpm release:packages --dry-run);
  • the tests green.

The security checks around a release, and the server's hardening, are in Security.

Details

  • Sandbox caps for untrusted modules, per instance: SANDBOX_MEMORY_MB (default 128, the heap cap of each module's workerd process) and SANDBOX_CPU_PERCENT (default 50, of one core, averaged over a minute). CPU watching works on Linux only (it reads /proc); elsewhere only the memory cap applies.
  • Payments module: needs SHADE_API_URL. Without it checkouts are refused, because Mollie needs the webhook address <SHADE_API_URL>/api/v1/account/payments/webhook (served only where the instance runs the public role).
  • BODY_LIMIT_BYTES (optional, default 1 MiB, at least 1024) caps every request under /api, user API and webhooks included. Over it the answer is 413.
  • Container roles and what each serves:
    • admin: admin screens, admin API /api/* (session cookie), content API /api/v1/content/* (read or build token), data API /api/v1/data/* (data token), MCP /api/mcp (MCP token), module routes /api/packages/*, /uploads, /health.
    • public: /api/v1/account/* (forms, user accounts, payment webhook, modules' public and user routes), the content API /api/v1/content/* with its search (read token only) and /health. Everything else is 404: a build token, the data API and MCP stay on admin.
    • worker: only /health. Runs scheduled publish, retention and the modules' schedules; needs no address.
    • all (default): development and the small profile.

    An admin route on a public process, or an account API route on an admin process, answers 404. So visitor traffic and floods hit processes that cannot reach editor routes or uploads, and the public role scales on its own.
  • A server-rendered frontend reads the content API from the public container with a read token, so its traffic never loads the admin: on Coolify's network at http://<public service>:4000, or at a domain of the public application's own. Its /health is the readiness answer, so a proxy stops sending reads while it cannot reach Postgres. Builds keep the admin's address: a build token and /api/v1/content/module-sites are refused on public, so never route /api/v1/content on the admin's domain to it. Module routes are served only under the prefix matching their auth mode: a public route is never reachable under /api/packages, and vice versa.
  • Site Docker targets:
    • static: Caddy on :8080 (Caddyfile). Assets and /media/* cached for a year, HTML must revalidate (Cache-Control: max-age=0, must-revalidate), /preview* answers 404, /_server-islands/* goes to SITE_SERVER_URL and /api/v1/account/* to ACCOUNT_API_URL.
    • preview: the Node server (dist/server/entry.mjs) on :4321.
    • runner: runner/runner.mjs builds into a new builds/build-<time> folder, switches the current link in one step, restarts the Node server and keeps the newest two builds (SITE_KEEP_BUILDS). After a restart the previous build's Node server starts at once, so /preview and islands work while the new build runs. Caddy (Caddyfile.runner) serves current/client and proxies /preview* and islands to the Node server in the same container.

    The read token is a BuildKit secret in the static build, so it is not stored in an image layer. Changing the Site URL reaches forms and sign-in at once (within a minute if Redis was away). The build takes Astro's site from the Site URL setting. It fails on an API error other than 404 for pages, site data, data sources, forms, the styles or the header and footer, on a missing media file, or on a Pagefind error (/preview and the canvas show what they can instead). Building uses a read or build token whose services check content.read and media.read. Preview links are signed for 10 minutes.
  • Runner rebuild endpoint: SHADE posts to http://<site container>:8081/rebuild?token=<SITE_REBUILD_TOKEN> without headers, so the token goes in the query (Authorization: Bearer also works).
    • A wrong or missing token answers 401. Without SITE_REBUILD_TOKEN set, every rebuild is refused. Accepted: 202 {"queued":true}.
    • A server that stops on its own is started again (up to five times in a row, waiting longer each time). A failed build leaves no folder.
    • The build and the server never see SITE_REBUILD_TOKEN.
    • GET :8081/health answers { ok, busy, builds, failures, lastError, lastBuiltAt, server }. ok is false until a first build succeeded and after a failed one. The status is 503 (Docker's HEALTHCHECK marks the container unhealthy) only while no build is served: a failed build after a good one keeps the previous site online and the container healthy, with the failure in lastError, the log and the report to SHADE.
    • After each build the runner reports the outcome to SHADE with SHADE_API_URL and SHADE_API_TOKEN.
  • Rebuild timing: the quiet period is REBUILD_DEBOUNCE_MS (default 30 seconds) and the capped wait REBUILD_MAX_WAIT_MS (default 2 minutes, never less than the debounce).