create-spillway
v0.1.26
Published
Scaffold a front end of your own on Spillway CMS: `npm create spillway@latest` writes a Next.js, Astro, Nuxt or SvelteKit starter with routing, SEO, menus, redirects, search, a language switcher, the brand, previews and webhook revalidation wired up.
Maintainers
Readme
create-spillway
A front end of your own on a Spillway CMS site, in one command. MIT licensed.
npm create spillway@latest my-site
# or
pnpm create spillway my-siteIt asks for the framework, your Spillway site's address and, optionally, an API token for draft previews, then writes a starter that renders the site's published pages and keeps itself up to date:
- Next.js (App Router): Spillway's block library; every published path prerendered and revalidated by tag when Spillway's webhook arrives, draft mode previews.
- Astro (server output on the Node adapter): Spillway's block library; every page rendered on request, kept in an in-memory cache the webhook purges, cookie previews.
- Nuxt (Nuxt 4): the block area as Spillway renders it in HTML, inside Vue pages; an in-memory cache the webhook purges, cookie previews.
- SvelteKit (SvelteKit 3, Node adapter): the block area as Spillway renders it in HTML, inside Svelte pages; an in-memory cache the webhook purges, cookie previews.
Each has one catch-all route for every published path and a 404 for the rest, Spillway's redirects, the SEO data (title, description, canonical, hreflang alternates, Open Graph, JSON-LD), the main and footer menus, a search page with suggestions while visitors type, a language switcher on a site with several languages, the site's brand through @spillway-cms/brand, previews from release share links or drafts, a revalidation route that verifies the webhook signature, sitemap.xml and robots.txt. Each starter's README lists its files and the setup steps. Members (sign-in on the front end) come later, with Spillway as an OpenID Connect provider.
Options
npm create spillway@latest my-site -- --template astro --url https://cms.example.org --yes| Option | What it does |
| --- | --- |
| [dir] | The folder to create; it must be new or empty (a .git folder is fine) |
| -t, --template <next\|astro\|nuxt\|sveltekit> | The starter |
| -u, --url <url> | The Spillway site's address |
| --token <spw_...> | An API token with content.view_drafts, for draft previews |
| --deploy-url <url> | The address the front end will have once deployed; with a token that has site.settings, the command adds the webhook rules pointing at <url>/api/revalidate |
| --setup-token <spw_...> | A token with site.settings for those rules, used once and never written to disk (without it, --token is tried) |
| --no-brand | Do not fetch the brand stylesheet |
| -y, --yes | Do not ask; take the defaults (Next.js, my-spillway-site) for what the flags leave out |
Without a terminal (in CI) it never asks. The address, the token and two generated secrets (for the webhook rules and the preview route) go in the starter's env file (.env.local for Next.js, .env for the others), which its .gitignore keeps out of version control. With --url it fetches the brand stylesheet; when the site cannot be reached the starter keeps a placeholder and its first build fetches the brand. With --deploy-url and a token that has site.settings it adds the webhook rules. Nothing else touches the network.
After it runs
cd my-site, install, and run the dev server.- Unless the command added them, in Spillway, under Site settings → Notifications, add Webhook rules for published, unpublished, deleted, menu changed, redirects changed, site settings changed and brand published, pointing at
<your front end>/api/revalidatewith theSPILLWAY_WEBHOOK_SECRETfrom the env file. - Deploy it with the same variables and
SITE_URLset to its public address.
See the headless docs for the API, the adapters and how revalidation works.
