1. Install the tools
- Node.js and pnpm for the Next.js site
- Rust with rustup for the
mstackbackend
2. Start backend and site
git clone https://github.com/headcodecms/headcodecms.git
cd headcodecms
pnpm install
pnpm devTwo local processes start together:
localhost:3080: the single-tenant Rust MCP backend (/mcp,/live,/media,/health) with an embedded Turso.dbfilelocalhost:3082: the Next.js website and its/adminUI
3. Push schema, seed content, and mint your admin invite
Generate headcode.schema.json and headcode.seed.json from your Zod definitions, load them into Turso, and create your first zero-PII admin invite:
pnpm --dir apps/base schema
cd apps/backend
cargo run -- schema ../base/headcode.schema.json
cargo run -- seed ../base/headcode.seed.json
cargo run -- invite create admin "Owner"Open the printed http://localhost:3082/admin?invite=<token> URL in your browser to sign in through Better Auth and claim the admin role.
4. Enable signed cache revalidation
When you publish in Headcode, the backend sends an HMAC-signed webhook (x-mstack-signature / x-mstack-timestamp) to refresh cached Next.js pages immediately:
echo "HEADCODE_REVALIDATE_SECRET=$(openssl rand -hex 32)" >> apps/base/.env.local
cd apps/backend
HEADCODE_REVALIDATE_SECRET="$(grep ^HEADCODE_REVALIDATE_SECRET= ../base/.env.local | cut -d= -f2)" \
cargo run -- site http://localhost:3082/api/revalidateOr let your agent do it
Run Headcode CMS locally from github.com/headcodecms/headcodecms.
Export the schema and seed entries, load them into embedded Turso, create an initial admin invite,
and configure signed cache revalidation for http://localhost:3082/api/revalidate.Verify everything end to end with pnpm lint && pnpm typecheck && pnpm test, or take it live with Uncloud & Vercel or full self-hosting. Full flags live in the README.