headcode

Docs · Installation

Uncloud & Vercel

Our recommended production split: your single-tenant Rust backend and embedded Turso on a small ARM64 server with Uncloud, and your cached Next.js frontend globally on Vercel.

Installation/Uncloud & Vercel

What runs where

  • Backend on Uncloud (cms.mywebsite.com): one Rust container (~8 MB RAM) with a persistent /data volume for embedded Turso and /media. Uncloud handles Caddy HTTPS and the WireGuard mesh in ~70 MiB RAM.
  • Shared Auth (auth.mywebsite.com): Better Auth OAuth 2.1 (from mstack). Deployed once per cluster and shared across all your sites — or bundled via --profile with-auth if this is your first site.
  • Site on Vercel (mywebsite.com): plain Next.js reading live entries from /live with 'use cache', optimizing originals from /media/** via Vercel Image Optimization, and refreshing on signed webhooks.

1. Install the CLIs once

brew install psviderski/tap/uncloud && npm install -g vercel && vercel login

2. Hand the skill to your coding agent

Replace the domains with yours. Keep tokens in 1Password rather than shell config.

Prompt
Use skills/headcode-init/SKILL.md from github.com/headcodecms/headcodecms.
Deploy the Rust backend to my Uncloud cluster at cms.mywebsite.com (reuse existing auth service if present,
otherwise deploy auth at auth.mywebsite.com), deploy apps/base to Vercel at mywebsite.com,
wire HEADCODE_REVALIDATE_SECRET, push schema + seed, and run smoke.mjs.

3. What the agent executes

  1. Runs uc ls to detect whether an auth service already exists on the cluster
  2. Deploys headcode (and auth if needed) via uc deploy -f compose.yaml
  3. Generates a shared HEADCODE_REVALIDATE_SECRET and sets HEADCODE_URL on both Uncloud and Vercel
  4. Reads the one-time bootstrap invite from /data/bootstrap-invite.txt (never logged to stdout)
  5. Pushes your Zod-generated JSON Schema and seed entries into Turso
  6. Deploys apps/base to Vercel and runs node apps/backend/scripts/smoke.mjs against /mcp

Done

  • mywebsite.com: your cached live website, /admin for editors
  • cms.mywebsite.com/mcp: Streamable HTTP MCP endpoint for connecting your AI

Full environment variables and compose options live in the README.