nexus-cms / laravel
Headless Laravel content store for Nexus CMS: REST API, edit-mode tokens, versioning, and force-update. No Filament dependency.
Requires
- php: ^8.1
- illuminate/contracts: ^10.0 || ^11.0
- illuminate/support: ^10.0 || ^11.0
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- orchestra/testbench: ^8.0 || ^9.0
- phpunit/phpunit: ^10.0 || ^11.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Headless Laravel content store for Nexus CMS.
It is the content store, the REST API the Next.js client talks to, the edit-mode token mint, and it manages versions and force-update.
Visual editing happens in the in-context overlay on the frontend. This package has no Filament dependency — drop it into any Laravel app and wire your own auth for token minting.
Docs: https://nexus.mkiteg.com/docs/laravel
Frontend packages: npm install nexus-cms
Migration:
nexus-cms/filamentis deprecated. Usenexus-cms/laravel.
Install
composer require nexus-cms/laravel php artisan vendor:publish --tag="nexus-cms-migrations" php artisan migrate php artisan vendor:publish --tag="nexus-cms-config"
The service provider auto-registers. Import the schema produced by nexus generate:
php artisan nexus:import-schema .nexus/cms-schema.json
REST API
Mounted at config('nexus-cms.route_prefix') (default api/nexus):
| Method | Path | Auth | Purpose |
|---|---|---|---|
| GET | /schema |
public | The cms-schema.json |
| GET | /content/{page} |
public (published) / token (draft) | Content document |
| POST | /tokens |
host-app auth (token_middleware) |
Mint edit-mode token (+ optional redirect) |
| PUT | /content/{page}/override |
Nexus token | Save one region override |
| DELETE | /content/{page}/override |
Nexus token | Revert one region (?regionId=) |
| PUT | /content/{page}/overrides |
Nexus token | Replace full override map |
| PUT | /content/{page}/seo |
Nexus token | Save draft SEO |
| POST | /content/{page}/publish |
Nexus token | Publish draft, create version, force-update |
| GET | /content/{page}/versions |
public | Version history |
| GET | /content/{page}/versions/{id} |
public | A version snapshot |
| POST | /content/{page}/versions/{id}/restore |
Nexus token | Roll back (?publish=0 = draft only) |
| POST | /media |
Nexus token | Upload an image |
| GET | /media |
public | Media library |
{page} is the encoded route: / → _root, /a/b → a~b (matches the
Next.js client).
Mint an edit token
curl -X POST "$API/api/nexus/tokens" \ -H "Authorization: Bearer $SANCTUM_TOKEN" \ -H "Content-Type: application/json" \ -d '{"page":"/"}'
Response:
{
"token": "…",
"editUrl": "https://yoursite.com/api/nexus/edit?token=…&to=/",
"expiresAt": "…",
"page": "/"
}
Pass "redirect": true to redirect the browser into editUrl instead of JSON.
Configure mint auth with NEXUS_TOKEN_MIDDLEWARE (default auth:sanctum).
Handshake + force update
- Open editor — your admin calls
POST /tokens, then sends the user toeditUrl(or opens it). The Next app exchanges the Nexus token withcreateHttpAdapter. - Publish / Force update — POSTs to
FRONTEND_URL/api/nexus/revalidatewith the webhook secret so the page is revalidated instantly.
Key env
NEXUS_FRONTEND_URL=https://yoursite.com NEXUS_WEBHOOK_SECRET=change-me NEXUS_SCHEMA_PATH=/path/to/.nexus/cms-schema.json NEXUS_MEDIA_DISK=public NEXUS_TOKEN_MIDDLEWARE=auth:sanctum
Development
composer install ./vendor/bin/phpunit