Nexus CMS

AI setup prompt

Frontend and backend prompts for Cursor, Claude, and similar tools.

Nexus CMS is in alpha. Usage is free until a stable release.

Prefer pasting these prompts into your coding agent after opening the target repo. Tell the agent to read this site’s docs (/docs/* in the Nexus monorepo, or your deployed docs URL) before changing code.

Suggested from Getting started.

Frontend startup prompt (Next.js)

Copy everything inside the fence:

You are wiring Nexus CMS (@nexus-cms/*) into this Next.js frontend. Product is alpha.

BEFORE coding:
1. Search/read Nexus docs in order: Getting started → Configuration → Comment directives → Next.js adapter → Filament backend → Troubleshooting → API reference.
2. Skim nexus.config.ts / next.config / app providers if they already exist.
3. Explain to the developer in plain language what Nexus does (compiler injects data-cms-* ids; overrides store edits; overlay edits in-context) BEFORE making large changes.

Goals:
1. Install: `npm i nexus-cms` (meta package = nextjs + cli; nextjs pulls core/react/compiler). Laravel/Filament is separate via Composer later.
2. `npx nexus init` if nexus.config.ts is missing. Set locales only if the site is bilingual.
3. Wrap next.config with `withNexus` from `@nexus-cms/nextjs/config` (NOT the package root).
4. `npx nexus generate` → keep `.nexus/cms-schema.json`.
5. Mount CmsProvider + NexusLayer (or NexusProvider from `@nexus-cms/nextjs/client`) with schema + adapter.
   - Local dogfood: createMemoryAdapter(schema).
   - Production content: createHttpAdapter({ baseUrl, projectKey, token }) pointing at Filament/API.
6. Flag UI for the compiler/editor:
   - Prefer normal React text/images/links so data-cms-* injects cleanly.
   - `// @cms-ignore` decorative/animation trees.
   - `// @cms-readonly` legal/computed values.
   - `{/* @cms-unite */}` / `@cms-richtext` for Highlighter/motion-split sentences.
   - Prefer `<section>` (or `{/* @cms-section */}`) for page blocks so editors can hide them.
   - `{/* @cms-layout(bento|stack|…) */}` on collection maps when needed.
   - `data-nexus-pointer-overlay` on follower overlays; `data-nexus-nav` on sticky nav if freeze should skip expanding it.
7. License: require a Dashboard key for Pro. Sign up at the hosted Dashboard (email/password), set `NEXUS_LICENSE_KEY`, pass `licenseKey` into CmsProvider. Without a key, Starter only (no versions/locales/collection add-remove). Do not set `unlicensedAllowsAll: true` unless the developer explicitly asks.
8. Edit mode via `?edit=1` (or enter-edit handshake). Verify text, images, hide, collections, SEO; Versions only with Pro key.
9. `npx nexus doctor` then `npx nexus check --ci` after UI refactors.
10. Alpha is free until stable — signup is free; do not require paid checkout.

TEACH THE DEVELOPER (required in your final message):
- What files you changed and why (3–8 bullets).
- What the compiler/schema/overlay each do in one sentence.
- Daily commands: generate / watch / doctor / check.
- NEXT STEPS TO CONNECT A BACKEND (Filament or any StorageAdapter HTTP API):
  a) Stand up nexus-cms/filament (or compatible API) — use the Backend prompt in /docs/ai-setup.
  b) Swap createMemoryAdapter for createHttpAdapter({ baseUrl: process.env.NEXT_PUBLIC_NEXUS_API_URL, projectKey, token from handshake }).
  c) Set NEXUS_API_TOKEN / NEXT_PUBLIC_NEXUS_* per Configuration + Filament docs.
  d) Import schema: `php artisan nexus:import-schema .nexus/cms-schema.json`.
  e) Confirm GET /api/nexus/content/_root and publish from the overlay.

Do not invent APIs. Prefer searching Nexus docs over guessing.

Backend startup prompt (Laravel / Filament)

Use this in the Laravel app (or a new API service implementing the same routes):

You are installing the Nexus CMS Filament backend (nexus-cms/filament) or an equivalent REST API.

BEFORE coding:
1. Read Nexus docs: Filament backend → Next.js adapter (handshake + force-update) → API reference → Configuration (backend.*).
2. Explain to the developer how the frontend HTTP adapter talks to this API (Bearer token, X-Nexus-Project, page encoding `/` → `_root`).

Goals:
1. `composer require nexus-cms/filament` (or vendor-path the monorepo package).
2. Publish migrations + config; migrate.
3. Register NexusCmsPlugin on the Filament panel.
4. `php artisan nexus:import-schema path/to/cms-schema.json`.
5. Configure project_key, route_prefix (default api/nexus), media disk, force-update / revalidate webhook URL for the Next app.
6. Issue an edit-mode token (handshake) the Next overlay can use as Authorization: Bearer …
7. Verify contract:
   - GET  /api/nexus/schema
   - GET  /api/nexus/content/_root
   - PUT  /api/nexus/content/_root/override (auth)
   - PUT  /api/nexus/content/_root/overrides (auth)
   - PUT  /api/nexus/content/_root/seo (auth) — draft SEO including ogImage
   - DELETE /api/nexus/content/_root/override?regionId=… (auth)
   - POST /api/nexus/content/_root/publish (auth)
   - GET/POST versions + restore (?publish=0 for draft-only)
   - POST /api/nexus/media (auth) multipart image upload
8. CORS / HTTPS so the Next origin can call the API from the browser or server.

TEACH THE DEVELOPER:
- Env vars to set on both apps.
- How editors enter edit mode (token handshake URL).
- How publish triggers force-update/revalidation on the frontend.
- Security: never put long-lived admin tokens in NEXT_PUBLIC_*.

Do not invent routes. Match packages/filament/routes/api.php and the HTTP adapter in @nexus-cms/react.

After either agent finishes

npx nexus generate
npx nexus doctor

Then open the site with ?edit=1. Backend: hit the REST table in Filament backend.

Set licenseKey from the Dashboard in nexus.config.ts / <CmsProvider> — see Licensing.

On this page