Documentation

Guides and reference for building with kitcms on Cloudflare Workers, D1 and R2.

Getting started

  • What is kitcms A lightweight, Payload-style CMS for SvelteKit that runs only on Cloudflare Workers, D1 and R2.
  • Requirements What you need on Cloudflare and on your machine to build and deploy a kitcms app.
  • Installation Create a kitcms project with create-kitcms.
  • Project tour The files in a scaffolded kitcms app and which ones are yours to edit.
  • Your first collection Add a collection to the schema, migrate the database and read it from a route.
  • Deploy in 5 minutes The shortest path from a local project to a live Worker.

Configuration

  • Configuration The kitcms.config.ts file, where collections, globals and every top-level option are defined.
  • Collections Define a collection with collection() and set its admin, access, hooks, sorting and indexes.
  • Fields Every field type kitcms supports, with its options and how it is stored.
  • Globals Define single documents such as site settings with global().
  • Blocks Build page sections from block types with block() and the blocks field.
  • Orderable and locked collections Let editors sort documents by drag and drop, or fix the set of documents in a collection.
  • Drafts and versions Keep version history, save drafts, autosave in the admin and restore old versions.
  • Live preview Show a preview pane beside the edit form with components registered in kitcms.admin.ts.
  • Admin branding Set the admin title, logo and accent colours.
  • Per-request values Make a few config values functions of the Worker env and the site's content, so one build can serve many deployments.

Access control & hooks

  • Access control and hooks How every operation passes through access rules, hooks, validation and D1, whichever way it arrives.
  • Access rules Write collection, field and admin access rules, and learn the defaults and how rules merge with queries.
  • Hooks Run your code before and after reads, writes and deletes, in a defined order.

Auth & users

  • Auth and users How the first admin is created, how roles and the users collection work, how users get passwords and how sign-in is protected.
  • Email Send email through Cloudflare Email Sending, covering the sender domain, the binding, the config, validation and development behaviour.
  • Passwords and invites Reset a forgotten password and invite new users by email, with single-use links, lifetimes and rate limits.

Media

  • Media Store files in R2 with upload collections, and control types, size and public URLs.
  • Images Serve resized AVIF and WebP images through Cloudflare Image Transformations and /cdn-cgi/image.

Using content

  • Using content The ways to read and write content from your site and other Workers, and when to use each.
  • The Local API Read and write content with locals.cms, including where, sort, depth, drafts and every method.
  • REST The JSON API under /api/collections and /api/globals, with its routes, parameters, auth and errors.
  • Headless over RPC Read and write content from other Workers through a Service Binding and the typed @kitcms/client.
  • Generated types Generate document types for consumers that do not have your config, with kitcms generate:types.

Plugins

  • Plugins How plugins extend a kitcms config, and the official plugins.
  • SEO plugin Add SEO fields, redirects, a sitemap and robots.txt with @kitcms/plugin-seo.
  • Enquiries plugin Add contact and booking forms defined in code, with spam protection and email notification, using @kitcms/plugin-enquiries.
  • Entitlements plugin Gate collections, globals and plugins behind add-ons and enforce usage limits with @kitcms/plugin-entitlements.
  • Writing a plugin Build a plugin with a config transform, a site handle, API endpoints and read-only admin panels.

Deploy & operate

  • Deploy & operate Create the Cloudflare resources, migrate, set secrets, deploy and create the first admin.
  • Custom domains Serve your kitcms app on your own domain with a custom_domain route.
  • Edge cache Cache anonymous published reads in the Workers Cache API with cache.ttl, and know what it does and does not cover.
  • Read replication and Smart Placement Speed up reads for visitors far from your D1 database with D1 read replication and Smart Placement.
  • Upgrading Move a kitcms app to a newer version safely, and what the semver policy promises.
  • System setup Provision a deployment from a script with the token-protected seed and user endpoints, for platforms that run one Worker per customer.
  • Read-only mode Switch a deployment to read-only with one Worker variable, for a paused or over-quota site.

Reference

  • Reference The kitcms CLI, the create-kitcms scaffolder and the versioning policy.
  • CLI Every kitcms command and option, with what it reads and writes.
  • create-kitcms Every create-kitcms flag, the prompts and the files it writes.
  • Semver and upgrade policy What counts as public API, what may change in a release and how versions are numbered.