Yuri Osipov · Founder, SEO & analytics

Keystatic: a CMS with git as the database

A CMS usually means a database, a server and a monthly invoice. Keystatic asks a different question: what if the content is just files in the repository, and the editing interface is generated from a schema? Then git becomes the database, pull requests become the review queue, and git revert becomes the undo button.

In short

What Keystatic actually is

You describe collections and singletons in a config file with typed fields — text, slug, date, image, array, object, conditional, Markdown, MDX with components. Keystatic generates the editing UI from that description, plus typed readers so the front‑end knows exactly what the content looks like.

// keystatic.config.ts
import { config, fields, collection } from '@keystatic/core'

export default config({
  storage: { kind: 'github', repo: 'your-studio/your-site' },
  collections: {
    posts: collection({
      label: 'Posts',
      slugField: 'title',
      path: 'src/content/posts/*',
      format: { contentField: 'content' },
      schema: {
        title: fields.slug({ name: { label: 'Title' } }),
        publishedAt: fields.date({ label: 'Published' }),
        content: fields.markdown({ label: 'Body' }),
      },
    }),
  },
})

This is the whole content model. Change a field, and the editor, the parser and the TypeScript types change with it — because they are all derived from the same declaration.

Who it fits

It fits badly when editors are numerous, when publishing is a daily newsroom operation, or when content needs relationships across thousands of records with filtering and sorting at runtime.

How it connects to Astro

Two lines of integration, then a reader:

// astro.config.mjs
import keystatic from '@keystatic/astro'
export default defineConfig({
  integrations: [keystatic()],
})
// src/lib/content.ts
import { createReader } from '@keystatic/core/reader'
import config from '../../keystatic.config'

const reader = createReader(process.cwd(), config)

export async function getPosts() {
  const posts = await reader.collections.posts.all()
  return posts.map(({ slug, entry }) => ({ slug, ...entry }))
}

reader runs at build time, reads the files, validates them against the field definitions and hands you typed objects. No network call, no token, no rate limit — the content is already on disk when the build starts.

Because content is in the repo, previews are deploy previews. Push a branch, your host builds it, and the editor sees the real page at a temporary URL. It is less immediate than an in‑editor preview and considerably more honest.

What an edit looks like

An editor opens /keystatic, picks Posts, clicks Create. They fill the title — the slug field generates itself — write the body, drop in an image, save. Behind the scenes Keystatic commits to a branch through the GitHub App. Depending on your settings that commit lands on main and triggers a deploy, or lands on a branch and waits for a pull request review.

Twenty minutes later the page is live, and the change is a commit with an author and a message. If the editor made a mistake, the fix is another commit — or a revert, which restores the previous state exactly. No export, no backup plugin, no “who changed this?” mystery.

Strengths

Weaknesses

When to choose Keystatic

Choose it when the site is small, the team is technical enough to review a pull request, and nobody wants to operate anything. A five‑page site with a blog, a landing page generator, a documentation section — all of these are a good fit, and the total cost of ownership is close to the hosting bill.

If editors need visual previews, look at Storyblok. If the content model is going to grow references, permissions and thousands of records, Payload is the next step up.

Summary

Keystatic is the least dramatic CMS in this series, and that is its argument: content as files, editing as a generated UI, history as git. For a studio or a small product site it removes an entire category of operational work.

See how it stacks up in the headless CMS comparison for Astro, or start from the headless CMS hub. We set up git‑based content workflows for clients as part of web development.

Screenshots in this series are placeholders — we will replace them with our own, taken on real projects.

Yuri Osipov

Yuri Osipov

Founder, SEO & analytics

Runs Take the Space. Specialises in technical SEO, measurable analytics setups and AI search visibility.

All posts by the author →
Is Keystatic free?
Keystatic is open source and free to self‑host: you add it to your Astro project, connect a GitHub repository and use it without a subscription. Keystatic Cloud exists as an optional paid layer for hosted collaboration and editor accounts — check the vendor for current terms.
Where does Keystatic store content?
In your repository, as Markdown, MDX, YAML or JSON files. In local mode the admin writes to your filesystem while you develop; in GitHub mode it commits to a branch through a GitHub App. There is no database.
Can non‑technical editors use it?
Yes, they get a normal admin interface at /keystatic with fields, image uploads and a rich text or Markdown editor. What they do not get is a page preview — Keystatic edits files, so the preview is your Astro dev server or a deploy preview.
What happens with two editors at the same time?
In self‑hosted GitHub mode there is no real‑time co‑editing: each save is a commit, and a conflicting edit surfaces as a merge conflict in the repository. That is fine for small teams and painful for a newsroom.
Does Keystatic scale to thousands of pages?
The content side scales because files are cheap; the build is what hurts. A few thousand entries are workable with caching and incremental builds, but every deploy still reads the repository, and repositories with large media get slow.

Want a high‑performance website?

Let’s discuss how we can help your business grow.