sitecms for SvelteKit

A headless CMS for SvelteKit sites where the client edits the content

By Updated

Short answer

sitecms is a hosted headless CMS where your client edits text, images, posts and prices on a SvelteKit site in a ready-made panel. Run npx sitecms-sveltekit init, read content with sitecms(event) in a server load, and the created endpoints handle the webhook, preview and analytics. It needs SvelteKit 2 or 3 with Svelte 5. The panel is in Swedish.

Who is sitecms for SvelteKit for, and who is it not for?

  • It fits a small business site made with SvelteKit, where the client changes text, images, news, services, prices and simple lists (team members, case studies, opening hours) without calling you.
  • It fits developers and agencies who want a hosted panel instead of running a CMS per client, at a fixed monthly price by number of sites and with unlimited editors.
  • It fits when the editor reads Swedish, and the site may still publish content in up to 10 languages.
  • It does not fit when the editor needs an English panel.
  • It does not fit when the content needs relations between content types, a GraphQL API, a visual page builder or more than 20 content types, 30 fields per type or 2,000 entries per type.
  • It does not fit when the CMS must run on your own server: sitecms is a hosted service only.

How do I connect a SvelteKit site?

  1. Create an account and a site in the panel and copy the API key from the site's Integration page.
  2. Run npx sitecms-sveltekit init in the project root and paste the key (or pass it: npx sitecms-sveltekit init <key>).
  3. Read content in a server load function and render it, as below.
  4. For live preview and visitor statistics, add the layout data and the two components shown further down. Init prints these steps but never changes your layout.
  5. Add CMS_API_KEY as an environment variable where the site is hosted, deploy, and invite the client by email as an editor.
bash
npx sitecms-sveltekit init
src/routes/+page.server.tsts
import { sitecms } from "sitecms-sveltekit/server";

export const load = async (event) => {
  const cms = sitecms(event); // reads CMS_API_KEY, takes the preview token from the request
  return { content: await cms.getContent(), posts: await cms.getPosts() };
};
src/routes/+page.sveltesvelte
<script lang="ts">
  import { editable, text } from "sitecms-sveltekit";
  let { data } = $props();
</script>

<h1 {...editable("home", "hero.title")}>{text(data.content, "home", "hero.title", "Welcome")}</h1>

The init command checks the key first, saves CMS_API_KEY in .env.local (and makes sure .gitignore covers it), installs the package, and creates three small endpoints under src/routes/api/sitecms/ (revalidate, events, preview), src/hooks.server.ts with sitecmsHandle and, in SvelteKit 3, src/env.ts that declares the variables. It also creates sitecms.config.ts and adds the prebuild sync. Existing files are never overwritten; if hooks.server exists without sitecmsHandle, init prints what to add.

src/routes/+layout.sveltesvelte
<script lang="ts">
  import { SitecmsPreview } from "sitecms-sveltekit/preview";
  import { SitecmsAnalytics } from "sitecms-sveltekit/analytics";
  let { data, children } = $props();
</script>

{@render children()}
<SitecmsPreview preview={data.sitecmsPreview} />
<SitecmsAnalytics disabled={!!data.sitecmsPreview} />

The layout data comes from src/routes/+layout.server.ts: export const load = (event) => sitecmsLayoutData(event);, imported from sitecms-sveltekit/server. Everything that calls sitecms(event) belongs in server code, so the key never reaches the browser. More in the documentation.

What does sitecms-sveltekit give you?

WhatIn sitecms-sveltekitGood to know
Page contentsitecms(event).getContent() with the helpers text, image, block and seoThe helpers come from sitecms-sveltekit and can be imported anywhere.
PostsgetPosts() and getPost(slug)Published posts only. getPost returns null for a missing post.
Custom content typesgetEntries(key) and getEntry(key, slugOrId)Published entries only.
Languagessitecms(event, { locale: "en" }) or per callOn a prerendered page, take the language from a route parameter, not from url.searchParams.
Revalidate webhooksrc/routes/api/sitecms/revalidate/+server.tsSigned. Runs your onRevalidate, a Vercel ISR bypass or a deploy hook if configured.
Live previewThe preview endpoint, sitecmsHandle and <SitecmsPreview />Pages that render on request only, and pages only, not posts or entries.
Visitor statisticsThe events endpoint and <SitecmsAnalytics />No cookies, no local storage.
Quote requestssubmitQuoteRequest() on the client from sitecms(event)In server code, such as a form action.
CLIsitecms-sveltekit init, sync, check, doctor, pullsync never breaks a build: without a key it skips with a warning.

How does the site update on each adapter?

You runWhen the client saves or publishes
adapter-node, SSR without a cacheThe next request shows the change. Nothing to configure.
Prerendered pages (prerender = true) on a site with a serverBaked in at build time. Set SITECMS_DEPLOY_HOOK_URL and the revalidate endpoint triggers a rebuild.
adapter-staticNo endpoint can receive the webhook. Paste a deploy hook URL as the revalidate URL in the panel.
adapter-vercel with ISRSet SITECMS_ISR_BYPASS_TOKEN and SITECMS_ISR_PATHS, and the revalidate endpoint asks Vercel to rebuild those paths.
adapter-netlifyNo built-in ISR. If you cache with Netlify cache tags, purge them in onRevalidate.
adapter-cloudflareNot tested. Pass env explicitly, because process.env is not always there.

The Vercel and Netlify recipes follow those platforms' documentation but have not been run against a real deployment in the package's tests. The README lists tests with SvelteKit 3.4 and 2.70 on adapter-node.

What are the limits?

Read from the code. The limits are the same in every plan.
WhatLimit
Pages per site100
Custom content types (collections) per site20
Fields per content type30
Entries per content type2,000
Entries per API request1 to 200 (default 100), paged with offset
Languages per site10
Custom roles per site20, built from 11 permissions
Version historyThe 50 latest versions of each item, plus every version from the last 90 days
Scheduled publishing2 minutes to 1 year ahead, published with a few minutes' delay
Posts and editorsNo limit
  • Field types in custom content types: text, richtext, image, number, boolean, date, select, url. There are no relations between content types and no GraphQL API.
  • Only pages can be previewed on your site. Posts and entries in custom content types cannot: their drafts are visible in the panel only.
  • Routing, the language switcher and hreflang tags for a multilingual site are yours to build. sitecms delivers the content per language with ?locale=.
  • sitecms-sveltekit is version 0.1.1, released with sitecms 1.0, so expect changes. The package and its CLI run on Node 18.17 or later; SvelteKit 3 itself needs Node 22.17 or later.

What does it cost?

The price is the full amount: no VAT is added, because the company behind sitecms is not VAT-registered. Annual billing costs ten months instead of twelve.
PlanSitesPer monthPer year
Solo1SEK 149SEK 1,490
Studio5SEK 499SEK 4,990
Byrå20SEK 1,490SEK 14,900

The price is per account, by number of sites. Every feature, every framework package and every limit above is the same in every plan, and editors cost nothing extra. The first 30 days are free with up to 20 sites and no card. If you do not pay when the trial ends, the panel is locked so nobody can edit. The website keeps showing the content that was saved last. More on the pricing page.

Frequently asked questions

Does it work with SvelteKit 2 and SvelteKit 3?

Yes. The peer dependencies are @sveltejs/kit 2 or 3 and svelte 5. In SvelteKit 3, init also creates src/env.ts, which declares CMS_API_KEY and CMS_API_URL.

Does it work with prerendered pages?

Yes, the content is fetched at build time. A prerendered page changes only with the next build, so set SITECMS_DEPLOY_HOOK_URL (or, on adapter-static, paste the deploy hook as the revalidate URL). Live preview needs pages that render on request.

Does init change my layout?

No. It creates the endpoints, hooks.server.ts, sitecms.config.ts and, in SvelteKit 3, src/env.ts if they are missing, and prints the steps for the layout. You add the layout data and the preview and analytics components yourself.

Does my client need to understand Swedish?

Yes, the person who edits should be comfortable reading Swedish, because the panel, the emails and support are only in Swedish. You as the developer do not need Swedish to integrate, and the field labels the editor sees are the ones you write in sitecms.config.ts.

Can the client preview a post before publishing it?

Not on your site. Live preview works for pages that render on request. Drafts of posts and entries in custom content types are visible in the panel only.

What does it cost?

Solo (1 site) SEK 149 per month, Studio (5 sites) SEK 499 per month, Byrå (20 sites) SEK 1,490 per month. The price is the full amount: no VAT is added, because the company behind sitecms is not VAT-registered. Annual billing costs ten months instead of twelve. The first 30 days are free and need no card.

Sources

Read more