sitecms for Astro

A headless CMS for Astro 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 an Astro site in a ready-made panel. Run npx sitecms-astro init, read content with getContent() in the frontmatter, and the integration adds the webhook, preview and analytics routes. It needs Astro 5 or later. The panel is in Swedish.

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

  • It fits a small business site made with Astro, 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 an Astro 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-astro init in the project root, where package.json is, and paste the key (or pass it: npx sitecms-astro init <key>).
  3. Read content in the frontmatter of a page, as below. Mark editable elements with editable(page, key) if you want click-to-edit in the live preview.
  4. Add CMS_API_KEY as an environment variable where the site is hosted, and deploy.
  5. Invite the client by email as an editor.
bash
npx sitecms-astro init
src/pages/index.astroastro
---
import { getContent, getPosts, text, image, editable } from "sitecms-astro";

// { request: Astro } lets the page show unsaved changes in the panel's live preview.
const content = await getContent({ request: Astro });
const hero = image(content, "home", "hero.image");
const posts = (await getPosts()).slice(0, 3);
---
<h1 {...editable("home", "hero.title")}>{text(content, "home", "hero.title", "Welcome")}</h1>
{hero && <img src={hero.src} alt={hero.alt} />}
<ul>{posts.map((p) => <li><a href={`/news/${p.slug}`}>{p.title}</a></li>)}</ul>

The init command checks the key against sitecms before it writes anything. It saves CMS_API_KEY in .env.local (and makes sure .gitignore covers it), installs the package, adds sitecms() to integrations in astro.config, creates sitecms.config.ts and adds "prebuild": "sitecms-astro sync" to package.json. The routes are added by the integration, so nothing is written into src/pages. It can be run again and never overwrites sitecms.config.

Call the client in the frontmatter, in an endpoint or in middleware, never in a client <script>: the API key must stay on the server. The full walkthrough, including the config format and collections, is in the documentation.

What does sitecms-astro give you?

WhatIn sitecms-astroGood to know
Page contentgetContent() with the helpers text, image, block and seoFields are declared in sitecms.config.ts and synced before each build.
PostsgetPosts() and getPost(slug)Published posts only. getPost returns null for a missing post.
Custom content typesgetCollections(), getEntries(key) and getEntry(key, slugOrId)Not the same thing as Astro content collections. Published entries only.
LanguagesgetContent({ locale: "en" }) or createSitecms({ locale })A missing translation falls back to the default language.
Revalidate webhookPOST /api/sitecms/revalidate, added by the integration when the site has an adapterSigned. Clears the optional memory cache and calls a deploy hook if SITECMS_DEPLOY_HOOK_URL is set.
Live previewGET /api/sitecms/preview, middleware and editable()Pages that render on request only, and pages only, not posts or entries.
Visitor statisticsPOST /api/sitecms/events and a small script on every pageNo cookies. Needs an adapter, because the route renders on request.
Quote requestssubmitQuoteRequest() and uploadQuoteAttachment()From an endpoint that renders on request.
CLIsitecms-astro init, sync, check, doctor, pulldoctor also checks the integration, the adapter, output and the deploy hook.

Does it work with a static Astro site?

Yes. Astro builds statically by default and sitecms can read content at build time. Three things need pages or routes that render on request, which means an adapter: live preview, visitor statistics and refreshing the site without a rebuild. Without an adapter the integration adds no routes and says so in the build log.

Static, no adapter`output: "static"` with an adapter`output: "server"` with an adapter
Content is fetchedAt build timeAt build time, or per request on pages with prerender = falseOn every request
The client saves, or publishes on a site with draft modePaste a deploy hook from your host as the revalidate URL in the panel, and the site is rebuiltThe revalidate route calls your deploy hook (SITECMS_DEPLOY_HOOK_URL)Shows on the next request, or once the revalidate route has cleared the memory cache if you turned it on
Live previewNoOnly pages with prerender = falseYes
Visitor statisticsNoYesYes

The package README lists builds and smoke tests against Astro 5, 6 and 7 with the Node adapter. The Vercel and Netlify adapters have not been run in those tests; the routes are ordinary Astro endpoints and middleware.

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-astro is version 0.1.1, released with sitecms 1.0, so expect changes. sitecms-next is at 0.7.1.

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 sitecms work with a static Astro site?

Yes, for reading content at build time. To update the site when the client saves or publishes, paste a deploy hook URL from your host as the revalidate URL in the panel, and the site is rebuilt. Live preview and visitor statistics need an adapter so that pages and routes render on request.

Which Astro versions are supported?

Astro 5 or later (the peer dependency is astro >= 5.0.0), on Node 18.17.1 or later. Astro itself may need a newer Node.

Are sitecms collections the same as Astro content collections?

No. sitecms collections are custom content types that you declare under collections in sitecms.config.ts and that the client edits in the panel, up to 20 per site. You read them with getEntries(key) and getEntry(key, slugOrId). Astro content collections are files in your repository.

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