Decap CMS

Decap CMS (formerly Netlify CMS) is a free, open-source, Git-based CMS. It gives non-technical editors a clean admin UI that commits content directly to your Git repo. No database, no API, no hosting costs.

Last updated: 2026-03-29

Setup

Add Decap CMS to your Astro project. It runs as a single-page app at /admin that writes Markdown files to your repository.

Terminal
# Create the admin page
# public/admin/index.html
<!doctype html>
<html>
<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>Content Manager</title>
  <script src="https://unpkg.com/decap-cms@^3.0.0/dist/decap-cms.js"></script>
</head>
<body></body>
</html>

Configure Collections

Define your content structure in a config.yml file. Decap generates editor forms from this config. Each collection maps to a folder of Markdown files.

Terminal
# public/admin/config.yml
backend:
  name: git-gateway
  branch: main

media_folder: public/images/uploads
public_folder: /images/uploads

collections:
  - name: posts
    label: Blog Posts
    folder: src/content/posts
    create: true
    slug: "{{slug}}"
    fields:
      - { name: title, label: Title, widget: string }
      - { name: excerpt, label: Excerpt, widget: text }
      - { name: date, label: Date, widget: datetime }
      - { name: image, label: Cover Image, widget: image }
      - { name: body, label: Body, widget: markdown }

Read Content in Astro

Decap writes standard Markdown with frontmatter. Use Astro's built-in content collections to read and render it. No special client needed.

Terminal
---
// src/pages/blog/index.astro
import { getCollection } from 'astro:content';

const posts = (await getCollection('posts'))
  .sort((a, b) => b.data.date.valueOf() - a.data.date.valueOf());
---

{posts.map((post) => (
  <a href={`/blog/${post.slug}`}>
    <img src={post.data.image} alt={post.data.title} />
    <h2>{post.data.title}</h2>
    <p>{post.data.excerpt}</p>
  </a>
))}

Best Practices

Decap is the simplest CMS to set up. No accounts, no API keys, no database. Perfect for small teams and personal sites.