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
- Keystatic is an open‑source, git‑based CMS from Thinkmill.
- Content lives in your repo as Markdown, MDX, YAML or JSON — versioned, diffable, portable.
- The admin is generated from
keystatic.config.ts, mounted at/keystaticinside your Astro app. - Two storage modes: local filesystem while developing, GitHub commits in production.
- No server to run, but also no real‑time collaboration and no database‑style querying.
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
- Small teams and studios shipping marketing sites or blogs with no ops budget.
- Developers who want review on content, because every edit is a commit and can go through a pull request.
- Clients who need a UI, not a WordPress, and are comfortable with editors having GitHub access — or with Keystatic Cloud handling accounts.
- Documentation sites where content and code genuinely belong together.
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
- Zero infrastructure. No database, no CMS server, no patching schedule.
- Full version history. Every change is auditable, revertible and attributable.
- Typed end to end. The schema produces both the editor and the reader.
- Portable content. Plain files, so leaving is a
git clone. - Fast. Reading local files during a build beats any API call.
Weaknesses
- Content changes require commits. Non‑technical editors need GitHub accounts, or Keystatic Cloud in front of them.
- No real‑time collaboration in the self‑hosted setup; simultaneous edits collide.
- No query layer. Filtering, sorting and relations across thousands of entries are your build script’s problem.
- Media in the repository bloats clones unless you point images at external storage.
- Schema changes are code changes — which is fine for a developer‑owned site and slow for a marketing team that wants a new field today.
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
Founder, SEO & analytics
Runs Take the Space. Specialises in technical SEO, measurable analytics setups and AI search visibility.