Where the server runs
A CaraCMS site runs on any host that keeps one Node server running behind HTTPS. This is the same for CaraCMS Cloud and Standalone sites: the mode only changes which variables go on the server.
What every host needs
- One instance. The drafts and several caches live in the server’s memory. On Fly that means one machine; on Render, no autoscaling.
- HTTPS. Editors’ sessions only travel over https.
- A deploy whenever main changes. A Publish commits to main, and the host has to deploy it. Railway and Render deploy on a push. On Fly or a plain VPS, add a GitHub Action that does.
- SITE_URL, the same at build and at run time. A www address in one place and the bare domain in the other is the likeliest setup mistake.
- Redis. Any Redis works by its address, including Upstash, in the site’s region.
- Started with caracms start. That’s the site’s start script.
npm run buildnpm startThe visitor’s IP
The server limits sign-in attempts, form submissions and downloads per visitor, so it needs to know each visitor’s IP. CARACMS_CLIENT_IP_HEADER says where that comes from. Railway, Fly and Render have a default. Anywhere else the server won’t start without it.
Value | When |
|---|---|
x-real-ip | nginx, passing the header on as shown below |
x-forwarded-for | Caddy |
fly-client-ip | Fly |
socket | Nothing sits in front of the server |
Railway
CaraCMS can write the whole Railway project for you:
npx caracms init --railwayIt writes .railway/railway.ts, which describes the site and Redis and, on a standalone site, the buckets and imgproxy. It never rewrites one that’s already there.
- Read what an apply would do before running one. Applying makes the project match the file, deleting what the file no longer declares.
- After the first apply, disconnect the repo from the site’s service in Railway’s dashboard and connect it again. Until you do, Railway holds every Publish at “needs approval”, because a Publish is a commit by the GitHub App and not by a member of your workspace.
- For the editor’s Try again, set CARACMS_RAILWAY_TOKEN to a project token.
Render
- A web service with build command npm ci && npm run build and start command npm start.
- Don’t turn on autoscaling.
- For Try again, set CARACMS_DEPLOY_HOOK_URL to the service’s deploy hook.
Fly
- One machine. Fly starts two by default.
- Fly doesn’t deploy on a push. Add a GitHub Action that deploys on a push to main.
- Fly’s variables and secrets are for run time only. Pass SITE_URL, and the image variables if the site has images, as build arguments too.
- Fly doesn’t say which commit is running. Pass it as a build argument:
fly launch --ha=falsefly deploy --build-arg CARACMS_RUNNING_COMMIT=$(git rev-parse HEAD)A VPS, behind Caddy or nginx
With nginx, set CARACMS_CLIENT_IP_HEADER to x-real-ip and pass the headers on:
location / { proxy_pass http://127.0.0.1:8080; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-Proto $scheme;}Caddy passes the host and the scheme on by itself. Set CARACMS_CLIENT_IP_HEADER to x-forwarded-for.
reverse_proxy 127.0.0.1:8080- Keep the server running with systemd or similar. It listens on PORT, 8080 by default.
- Deploy with Coolify, or a GitHub Action that pulls, builds and restarts on a push to main.
Behind Cloudflare
CaraCMS sees through Cloudflare’s proxy by itself on the site’s own domain. A few things to watch:
- Leave CARACMS_CLIENT_IP_HEADER alone. Don’t set it to Cloudflare’s header unless the server accepts Cloudflare’s traffic alone.
- Don’t put a Cache Everything rule over /admin or /_caracms/.
- Cloudflare gives up on an answer after 100 seconds. Publish answers within 60 and carries on if it needs longer.
llms.txt · llms-full.txt: this site for AI tools