A CMS site is more than the CMS. Next Fold is a Next.js and Sanity CMS demo that runs the rest in public: guardrails, caching, i18n, security, CI, and releases.
Every page shows one part working and links to its code. Editors fill typed sections in Studio; developers own the schema, queries, and components.
- Typed sections: editors fill fields; developers own the schema, queries, and components
- Guardrails block publish until the page passes the rules
- Cache expires on publish, not on a timer
- English and German, Studio included
- Runs on seed pages with no Sanity project
- Every page also as Markdown, with
llms.txtand a sitemap - Playwright and axe in CI for every page, both languages
- Agent skills for coding agents
Live demo: nextfold.marcopontili.com
| Page | What it shows |
|---|---|
| Home | Three ways in, and the page's own sections as an editor sees them in the Studio |
| Inside a page | How a page gets built, and its sections as a sketch: pick one to see the fields an editor filled in |
| Guardrails | The rules the Studio checks before a page can publish, and a playground to break them |
| Caching | When this page entered the cache, what expires it, and the headers of a fresh request |
| How it's run | Hosting, DNS, security headers, analytics, CI, and the release flow, with a link to check each |
| For agents | Markdown versions, llms.txt, sitemap |
Every page also exists in German under /de.
Architecture follows a request through the code. Every page is listed in the docs index.
| Area | Technology |
|---|---|
| Language | TypeScript 5.9 |
| Framework | Next.js 16, App Router |
| UI library | React 19 |
| Styling | Plain CSS with cascade layers |
| CMS | Sanity Studio 6, GROQ queries, Visual Editing |
| Localization | English and German content and Studio UI |
| Caching | Next.js Cache Components, invalidated on publish |
| Testing | Playwright, axe accessibility checks |
| Code quality | ESLint, Sanity TypeGen, Dependabot |
| CI | GitHub Actions |
| Security | Security headers, CodeQL, OpenSSF Scorecard |
| Analytics | Self-hosted Matomo, cookieless |
| Hosting | Vercel |
| DNS | Cloudflare, DNS only |
Markdown skills for Claude Code, Cursor, and Codex ship in the repo and load when you open the clone. Each one points an agent at the right how-to and the checks CI runs.
Requires Node.js 22+.
npm install
cp .env.example .env
npm run devOpen http://localhost:3100. Without NEXT_PUBLIC_SANITY_PROJECT_ID, the bundled seed pages render.
| Command | Purpose |
|---|---|
npm run dev |
Dev server on port 3100 |
npm run lint |
ESLint |
npm run typecheck |
TypeScript, no output files |
npm run build |
Production build |
npm start |
Serve the production build on port 3100 |
npm run typegen |
Regenerate the Sanity schema and types after a schema or query change |
npm run seed:import |
Copy the seed pages and site settings into your Sanity dataset |
Create a project and dataset, add the CORS origin, and publish a first page with Sanity setup.
All variables are optional in local mode. Set them in .env to load content from Sanity:
| Variable | Used for | Default |
|---|---|---|
NEXT_PUBLIC_SANITY_PROJECT_ID |
Sanity content and the Studio | Empty: sample content only |
NEXT_PUBLIC_SANITY_DATASET |
Sanity content and the Studio | production |
SANITY_API_READ_TOKEN |
Draft mode, Presentation, and Visual Editing | Empty: published content only |
SANITY_REVALIDATE_SECRET |
Publish webhook at /api/revalidate |
Empty: the webhook answers 501 |
NEXT_PUBLIC_SITE_URL |
Canonical URLs, sitemap, JSON-LD | https://nextfold.marcopontili.com |
NEXT_PUBLIC_MATOMO_SITE_ID, NEXT_PUBLIC_MATOMO_CONTAINER_ID |
Cookieless analytics | Empty: no tracking |
Next Story is the Storyblok counterpart of this Sanity demo: same Next.js App Router approach with a different headless CMS. See Next Story.
Report bugs or propose features through Issues. For code or documentation changes, follow the contributing guide for local setup, checks, and pull requests.
Report vulnerabilities privately using the security policy, not a public issue.