New Astro Site
Requires a deployed CMS (setup) or one running locally.
npm create @kenresoft-cms@latest my-site -- --astrocd my-sitecp .env.example .envpnpm installpnpm devSet your CMS API URL in .env:
PUBLIC_KENRESOFT_CMS_URL=https://your-cms-api.example.comThe default is http://localhost:8787, which is where wrangler dev serves the API locally.
What you get
Section titled “What you get”This copies a template bundled inside @kenresoft-cms/create (it does not clone the CMS) and starts a fresh Git repository with no shared history. It is a one-time starter, the same as npm create astro@latest: nothing updates it afterwards, and pnpm run update in the CMS never touches it.
The starter uses @kenresoft-cms/astro (the newest version at scaffold time) and @astrojs/cloudflare with output: 'server'. It includes:
src/lib/cms.ts: a public-content client andcmsForRequest(request)for server-side session checks.src/lib/browser-cms.ts:browserCms, a client that talks to your own/cmsproxy from the browser.src/middleware.ts: a per-request client bound to Live Preview tokens (Astro.locals.cms).src/pages/cms/[...path].ts: the same-origin proxy.src/pages/blog/,src/pages/contact.astro: examples against ablog-postcontent type and acontactform. Change the slugs and field names to match your CMS.src/pages/account/: register, sign in, verify email, forgot and reset password, and a protected account page (with two-factor and optional Turnstile).wrangler.jsoncwith theglobal_fetch_strictly_publicflag.
It is content-agnostic. It does not assume Commerce or any specific content model.
Before it works against a deployed CMS
Section titled “Before it works against a deployed CMS”- Add the site’s origin to the CMS API’s
CORS_ORIGINS. - Configure real email on the CMS. Accounts must verify their email before signing in.
- Recommended: set the same
TRUSTED_PROXY_SECRETon the CMS and on this site. See Same-origin proxy. - Optional bot protection: create a Turnstile widget at dash.cloudflare.com → Turnstile, set it up on the API with
pnpm run update -- --turnstile, and setPUBLIC_TURNSTILE_SITE_KEYhere to the widget’s site key. Both halves are required; the register page has no widget without the site key, even with the secret set on the API. On a Cloudflare Git build, add it as a build variable, the same way asPUBLIC_KENRESOFT_CMS_URL(see Deploying and updating Astro).
See Authentication and CORS if sign-in fails.