Headcode CMS is intentionally split into two small, independent pieces:
apps/backend— a single-tenant Rust MCP server built on mstack usingaxum,rmcp, and native embeddedturso. No external database server, ~14 ms boot time, ~8 MB of RAM.apps/base(or your own Next.js site likeapps/www) — a plain Next.js app with typed Zod sections inheadcode/sections.ts, a built-in/adminUI, and instant cache revalidation on publish.
Prerequisites
- Node.js + pnpm for the Next.js site
- Rust (
rustup) for the single-tenant backend
1. Clone and run locally
Clone main and start both the Rust backend (:3080) and the Next.js starter (:3082):
Start Headcode CMS locally
Runs the Rust MCP backend on localhost:3080 (with embedded Turso) and the Next.js starter on localhost:3082.
git clone https://github.com/headcodecms/headcodecms.git cd headcodecms pnpm install pnpm dev
2. Claim your first zero-PII admin invite
The invite create admin "Owner" command prints a one-time link:
http://localhost:3082/admin?invite=<one-time-token>Open that link in your browser, sign in with Better Auth, and Headcode hashes and redeems the token — mapping your verified (iss, sub) identity to the admin role without ever storing your email address inside the CMS database.
On first boot in production (when no member exists yet), the backend also automatically writes a 24-hour bootstrap invite file (0600) to /data/bootstrap-invite.txt and deletes it as soon as it is redeemed.
3. Connect your AI over MCP
Point Claude Code, Codex, or OpenCode at http://localhost:3080/mcp (or your deployed domain https://cms.yourdomain.com/mcp):
Connect your local or deployed MCP server
Replace the URL with your deployed domain when you move to production.
opencode mcp add --global headcode --url http://localhost:3080/mcp opencode mcp auth headcode
Once authenticated, your agent has access to all 23 MCP tools (schema_get, entries_list, entry_get, entry_update, publish, preview_link, rollback, invite_create, backup_snapshot, and more) plus the 3 shipped MCP skills (editorial, publish, admin).
4. Deploy to production (Uncloud + Vercel)
Our recommended production setup keeps operations tiny and bills predictable:
- Backend + shared Better Auth: one €4/month ARM64 VPS (for example Hetzner
cax11) running Uncloud. Uncloud handles Caddy HTTPS and WireGuard networking in ~70 MiB of RAM; Headcode itself uses ~8 MiB. - Frontend: deploy
apps/base(or your custom site app) to Vercel. Live pages read fromHEADCODE_URL/livewith Next.js'use cache', images load fromHEADCODE_URL/media/**via Vercel Image Optimization, and every publish fires an HMAC-signedPOST /api/revalidate.
Deploy the backend container
Use the bundled auth profile for a standalone single-site setup, or omit it to share one mstack-auth service across your cluster.
uc deploy -f compose.yaml
Want to inspect a running instance first? Try the read-only Headcode demo, or read why Headcode moved to single-tenant Rust on mstack.