sitecms for Astro
A headless CMS for Astro sites where the client edits the content
By Oskar ÖstlindUpdated
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?
- Create an account and a site in the panel and copy the API key from the site's Integration page.
- Run
npx sitecms-astro initin the project root, wherepackage.jsonis, and paste the key (or pass it:npx sitecms-astro init <key>). - 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. - Add
CMS_API_KEYas an environment variable where the site is hosted, and deploy. - Invite the client by email as an editor.
npx sitecms-astro init---
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?
| What | In sitecms-astro | Good to know |
|---|---|---|
| Page content | getContent() with the helpers text, image, block and seo | Fields are declared in sitecms.config.ts and synced before each build. |
| Posts | getPosts() and getPost(slug) | Published posts only. getPost returns null for a missing post. |
| Custom content types | getCollections(), getEntries(key) and getEntry(key, slugOrId) | Not the same thing as Astro content collections. Published entries only. |
| Languages | getContent({ locale: "en" }) or createSitecms({ locale }) | A missing translation falls back to the default language. |
| Revalidate webhook | POST /api/sitecms/revalidate, added by the integration when the site has an adapter | Signed. Clears the optional memory cache and calls a deploy hook if SITECMS_DEPLOY_HOOK_URL is set. |
| Live preview | GET /api/sitecms/preview, middleware and editable() | Pages that render on request only, and pages only, not posts or entries. |
| Visitor statistics | POST /api/sitecms/events and a small script on every page | No cookies. Needs an adapter, because the route renders on request. |
| Quote requests | submitQuoteRequest() and uploadQuoteAttachment() | From an endpoint that renders on request. |
| CLI | sitecms-astro init, sync, check, doctor, pull | doctor 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 fetched | At build time | At build time, or per request on pages with prerender = false | On every request |
| The client saves, or publishes on a site with draft mode | Paste a deploy hook from your host as the revalidate URL in the panel, and the site is rebuilt | The 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 preview | No | Only pages with prerender = false | Yes |
| Visitor statistics | No | Yes | Yes |
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?
| What | Limit |
|---|---|
| Pages per site | 100 |
| Custom content types (collections) per site | 20 |
| Fields per content type | 30 |
| Entries per content type | 2,000 |
| Entries per API request | 1 to 200 (default 100), paged with offset |
| Languages per site | 10 |
| Custom roles per site | 20, built from 11 permissions |
| Version history | The 50 latest versions of each item, plus every version from the last 90 days |
| Scheduled publishing | 2 minutes to 1 year ahead, published with a few minutes' delay |
| Posts and editors | No 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-astrois version 0.1.1, released with sitecms 1.0, so expect changes.sitecms-nextis at 0.7.1.
What does it cost?
| Plan | Sites | Per month | Per year |
|---|---|---|---|
| Solo | 1 | SEK 149 | SEK 1,490 |
| Studio | 5 | SEK 499 | SEK 4,990 |
| Byrå | 20 | SEK 1,490 | SEK 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
- Every featureDrafts, scheduling, history, languages, content types and roles, with limits.
- All frameworksFive packages, versions and requirements side by side.
- DocumentationConfig, content, collections, ?locale=, drafts, preview and the REST API.
- Pricing
- Compare with other CMSsIncluding when another CMS fits better.