Installation
Get up and running with Cmssy in under 5 minutes.
Prerequisites
A Cmssy site is a standard Next.js (App Router) project that renders your published content with the Cmssy SDK. You'll need:
- Node.js 20+ - we recommend nvm
- pnpm - our recommended package manager (npm and yarn also work)
- A Next.js App Router app - new or existing
- A Cmssy workspace - for the workspace slug and draft/editor settings
Install the SDK
Add the two SDK packages to your Next.js project:
Create a Next.js app
Starting fresh? Scaffold an App Router project, then add the SDK. (Or skip this and use your existing app.)
Configure
Create cmssy.config.ts that calls defineCmssyConfig, then add the keys below to your .env. Copy the values from your workspace's Settings → Headless page in the Cmssy dashboard. On cmssy cloud apiUrl and editorOrigin default automatically:
| Variable | What it is | Required |
|---|---|---|
CMSSY_ORG_SLUG | Your organization slug | Yes |
CMSSY_WORKSPACE_SLUG | Your workspace slug (resolves the workspace id) | Yes |
CMSSY_DRAFT_SECRET | Secret that unlocks draft / preview mode | Yes |
CMSSY_REVALIDATE_SECRET | Secret for the on-publish ISR revalidation webhook | Yes |
CMSSY_API_URL | GraphQL delivery endpoint. Defaults to https://api.cmssy.io/graphql | Self-host / staging only |
CMSSY_EDITOR_ORIGIN | Admin origin that frames your site. Defaults to https://www.cmssy.io | Self-host only |
Keep these secret - never commit .env to version control. In production, set the same variables in your hosting provider (e.g. your Vercel project settings).
Project structure
Every cmssy app has the same four pieces, whatever the framework:
your-app/
├── page entry # renders cmssy blocks into your components (catch-all route)
├── blocks # your block components + the blocks registry array
├── config # workspace slug, draft secret and delivery API
└── edit route # mounts the visual editor for live previewThe concrete files differ per framework - Next.js, Astro and Remix each lay these out their own way. See Rendering for the per-framework setup.
Start development
Run the Next.js dev server:
Open http://localhost:3000 - your site renders published Cmssy content.
Editor preview
To edit content visually with live preview, the Cmssy editor frames your deployed (or local) site in an iframe. For your project to show up in the editor, you need:
- Your workspace Preview URL (Settings → Headless) set to your site - e.g.
https://your-site.com, orhttp://localhost:3000while developing. - The draft route
app/api/draft/route.ts=createDraftRoute(cmssy)so the editor can enter preview / draft mode. proxy.tsapplying the CSP viaapplyCmssyCspin edit mode.
On cmssy cloud the editor origin is configured for you. If you self-host the admin, set CMSSY_EDITOR_ORIGIN to your admin origin - the SDK uses it for the postMessage bridge and the CSP frame-ancestors that lets the admin frame your site. Then open the page editor in the admin - your site loads in the canvas and edits appear instantly.
Deploy
Deploy like any Next.js app (e.g. Vercel). Set the same environment variables in your hosting provider, then point your workspace's Preview URL at the deployed site so the editor can frame it.
Updating the SDK
Bump both packages together to pick up SDK fixes, then redeploy:
Troubleshooting
Common issues
- "Preview didn't connect" - check the workspace Preview URL points at your site. If you self-host the admin,
CMSSY_EDITOR_ORIGINmust be your admin origin. - Blank page - check
CMSSY_WORKSPACE_SLUGmatches your workspace (and, if self-hosting, thatCMSSY_API_URLis the full GraphQL endpoint). - "Port 3000 already in use" - stop other dev servers or run
next dev -p 3001. - Node.js version error - upgrade to Node.js 20+ using
nvm install 20.
Next Steps
Now that you're set up, explore the following guides:
- Quickstart - build your first block end-to-end
- Block Development - block anatomy, schemas and field types
- Page Builder - editing content in the visual editor