Frameworks

Which frameworks work with sitecms?

By Updated

Short answer

sitecms has one npm package per framework: sitecms-next for Next.js, sitecms-astro for Astro, sitecms-nuxt for Nuxt, sitecms-sveltekit for SvelteKit, sitecms-js for plain JavaScript. Each package is a typed client that is set up with one command, for example npx sitecms-astro init, and the environment variable CMS_API_KEY. All of them are MIT-licensed.

Which package should I use?

FrameworkPackageVersionRequirementsSet up with
Next.jssitecms-next0.7.1Next.js 14.2 or later with the App Router. Node 18.17 or laternpx sitecms-next init
Astrositecms-astro0.1.1Astro 5 or later. Node 18.17.1 or laternpx sitecms-astro init
Nuxtsitecms-nuxt0.1.1Nuxt 4. Node 20.19 or laternpx sitecms-nuxt init
SvelteKitsitecms-sveltekit0.1.1SvelteKit 2 or 3 with Svelte 5. Node 18.17 or laternpx sitecms-sveltekit init
Plain JavaScriptsitecms-js0.1.1No framework needed. Node 18.17 or laternpx sitecms-js init

Run the init command in the project root, where package.json is, and paste in the API key from the Integration page of the site in the panel. You can also pass the key on the command line: npx sitecms-astro init <key>. The command checks the key before it writes anything, saves CMS_API_KEY, installs the package, creates a sitecms.config file and adds a prebuild script that syncs the fields. It can be run again and never overwrites your config. Then add CMS_API_KEY as an environment variable where the site is hosted and deploy.

All the packages give you the same things: a typed client for content, posts and collections, ?locale= support, helpers (text, image, block, seo, editable), the revalidate webhook, live preview in the panel, cookie-free visitor statistics, quote requests and the CLI. The four framework packages depend only on sitecms-js, which has no dependencies.

How do I start with Next.js?

Next.js 14.2 or later with the App Router, and Node 18.17 or later. The init command also creates the revalidate, preview and events routes as files in app/api/sitecms/.

bash
npx sitecms-next init
app/page.tsxtsx
import { getContent, text } from "sitecms-next";

export default async function Home() {
  const content = await getContent();
  return <h1>{text(content, "home", "hero.title", "Welcome")}</h1>;
}

Read content in server components only. Saving in the panel, or publishing on a site with draft mode, clears the cache tag sitecms, so the page updates without a deploy.

Who it fits, what the package covers, limits and pricing: headless CMS for Next.js.

How do I start with Astro?

Astro 5 or later and Node 18.17.1 or later. The init command adds sitecms() to integrations in astro.config, and the integration adds the revalidate, events and preview routes, so nothing is written into src/pages.

bash
npx sitecms-astro init
src/pages/index.astroastro
---
import { getContent, text } from "sitecms-astro";
const content = await getContent({ request: Astro });
---
<h1>{text(content, "home", "hero.title", "Welcome")}</h1>

Astro builds statically by default. Live preview, visitor statistics and the instant refresh need an adapter so that pages and routes render on request. A fully static site without an adapter is rebuilt through a deploy hook that you paste in as the revalidate URL in the panel.

Who it fits, static versus server output, limits and pricing: headless CMS for Astro.

How do I start with Nuxt?

Nuxt 4 and Node 20.19 or later (on Node 22, 22.12 or later). Nuxt 3 is not supported. The init command saves the key in .env, which Nuxt reads, and adds sitecms-nuxt to modules in nuxt.config.ts. The module adds the routes itself.

bash
npx sitecms-nuxt init
pages/index.vuevue
<script setup lang="ts">
import { text } from "sitecms-nuxt/helpers";
const { data: content } = await useSitecmsContent();
</script>

<template>
  <h1 v-if="content">{{ text(content, "home", "hero.title", "Welcome") }}</h1>
</template>

The content is fetched on the server through a route of the module itself, so the API key never reaches the browser.

Who it fits, caching on serverless, limits and pricing: headless CMS for Nuxt.

How do I start with SvelteKit?

SvelteKit 2 or 3 with Svelte 5, and Node 18.17 or later for the package and the CLI (SvelteKit 3 itself needs a newer Node). The init command creates three small endpoints under src/routes/api/sitecms/ and a src/hooks.server.ts with sitecmsHandle, unless they exist; in SvelteKit 3 it also creates src/env.ts.

bash
npx sitecms-sveltekit init
src/routes/+page.server.tsts
import { sitecms } from "sitecms-sveltekit/server";

export const load = async (event) => ({ content: await sitecms(event).getContent() });
src/routes/+page.sveltesvelte
<script lang="ts">
  import { text } from "sitecms-sveltekit";
  let { data } = $props();
</script>

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

A page that renders on every request shows a change as soon as it is saved or published. A prerendered page is baked in at build time and needs a deploy hook (SITECMS_DEPLOY_HOOK_URL) to be rebuilt.

Who it fits, each adapter, limits and pricing: headless CMS for SvelteKit.

How do I start without a framework?

sitecms-js is the core that the other four are built on. It needs no framework and runs on Node 18.17 or later, and in runtimes with Web Crypto such as Deno, Bun and Cloudflare Workers. It includes route handlers that take a web-standard Request and return a Response.

bash
npx sitecms-js init <api-key>
ts
import { createSitecms, text } from "sitecms-js";

const cms = createSitecms(); // reads CMS_API_KEY
const content = await cms.getContent();
console.log(text(content, "home", "hero.title"));

Where there is no process.env, pass the key explicitly: createSitecms({ apiKey: env.CMS_API_KEY }).

What should I know before I choose?

  • The panel is in Swedish whichever framework you use.
  • Routing, language switcher and hreflang tags on the customer's site are the developer's job, for every framework.
  • Current versions: sitecms-next 0.7.1, sitecms-astro 0.1.1, sitecms-nuxt 0.1.1, sitecms-sveltekit 0.1.1, sitecms-js 0.1.1. Four of the five are at 0.1, so expect changes.
  • sitecms is offered as a hosted service and cannot be run on your own server.
  • Not covered by a package? The REST API works from any server, and a deploy hook rebuilds a static site when the customer saves or publishes.

Frequently asked questions

Does sitecms work without a framework?

Yes. The core package sitecms-js is a client without dependencies that the other packages are built on, and the REST API can be called directly from the server.

Which frameworks does sitecms support?

Next.js (sitecms-next, Next.js 14.2 or later with the App Router); Astro (sitecms-astro, Astro 5 or later); Nuxt (sitecms-nuxt, Nuxt 4); SvelteKit (sitecms-sveltekit, SvelteKit 2 or 3 with Svelte 5); Plain JavaScript (sitecms-js, no framework needed).

Which command sets sitecms up?

npx sitecms-next init, npx sitecms-astro init, npx sitecms-nuxt init, npx sitecms-sveltekit init, npx sitecms-js init, depending on the framework. There is no package called sitecms.

Does sitecms work with Nuxt 3?

No. sitecms-nuxt needs Nuxt 4.

Does it work with a fully static site?

Yes, for reading content at build time. A static site cannot receive the revalidate webhook, so a deploy hook from your host rebuilds it when the customer saves or publishes. Live preview and visitor statistics need pages or routes that render on request.

Sources

Read more