# Markdown is perfect for (small) databases. Here's how ...

> Source: <https://dev.to/flowershow/markdown-is-perfect-for-small-databases-heres-how--1hgk>
> Published: 2026-11-27 20:31:28+00:00

**Recommendation:** Store small datasets as markdown files with YAML frontmatter so coding agents can read and edit records directly, and keep the folder in git to review each change.
More in the playbook "Designing agent systems": <https://wpnews.pro/playbooks/agent-architecture>

Here's a database: five markdown files about Harry Potter characters, sitting in a folder. No server, no schema. Obsidian shows it as a table I can sort and edit, ten lines of Python query it, and when I ask Claude Code in plain English to add Ron, it does.

The folder:

```
characters/
  harry-potter.md
  hermione.md
  malfoy.md
  dumbledore.md
  luna.md
```

And each file looks like this:

```
---
name: Harry Potter
house: Gryffindor
status: Alive
creature: Hedwig (Owl)
---

# Harry Potter

The boy who lived. Notes go here, as long as you like.
```

Characters without a pet get `creature: -`.

The bit between the `---` lines is frontmatter: plain YAML at the top of a markdown file. Almost every markdown tool understands it already.

That's it. You've made a database:

```
markdown file      →  record
frontmatter field  →  column
folder             →  table
```

No install, no schema. Want a new column? Add a field to a file.

Open the folder in Obsidian, add a [Base](https://help.obsidian.md/bases), and there it is:

Sort by house, filter to the living, edit a cell and it writes straight back to the file. This is the thing Notion is good at, structured fields *plus* free text in one place. Except here every record is a text file on your own disk, in git if you like, editable in any editor, and still there if Obsidian disappears tomorrow.

You don't need a database engine either. Frontmatter is so simple that a query is a list comprehension:

``` python
import pathlib

def records(folder):
    for f in sorted(pathlib.Path(folder).glob("*.md")):
        head = f.read_text().split("---")[1]
        yield dict(line.split(": ", 1) for line in head.strip().splitlines())

alive_with_pets = [r for r in records("characters")
                   if r["status"] == "Alive" and r["creature"] != "-"]

for r in alive_with_pets:
    print(f'{r["name"]:<18} {r["house"]:<11} {r["creature"]}')
Harry Potter       Gryffindor  Hedwig (Owl)
Hermione Granger   Gryffindor  Crookshanks (Cat)
```

No libraries. (That little parser only handles simple `key: value` lines and assumes every file has every field; for real YAML use a YAML library. You get the idea.) And for quick questions plain `grep` works fine:

``` bash
$ grep -l "house: Gryffindor" characters/*.md
characters/dumbledore.md
characters/harry-potter.md
characters/hermione.md
```

This is why I think the pattern has gone from "neat trick" to "obviously the right way" in the last year.

AI agents are brilliant at plain files. Point Claude Code or Cursor at the folder and the query language is English:

Which characters are dead? Add Ron Weasley with the same fields.

It reads the files, tells you Dumbledore, and writes `characters/ron.md`:

```
---
name: Ron Weasley
house: Gryffindor
status: Alive
creature: Scabbers (Rat)
---

# Ron Weasley

Harry's best friend. Sixth of seven Weasley children.
```

Run the Python again and Ron shows up. You and the agent are working on the same files, and git shows you exactly what it changed. With Notion you'd be wiring up an API integration before you got this far.

Hundreds of records, a few thousand, great. Millions of rows, lots of joins, many people writing at once: use Postgres.

But a surprising amount of life fits in a few thousand records: books you've read, recipes, people you've met, projects, a team's decisions, a product catalog, a blog.

I call this the Markdown Database Pattern. The full write-up, plus a step-by-step guide to building one from an empty folder, is on The Way of Markdown: [wayofmarkdown.com/markdown-database](https://wayofmarkdown.com/markdown-database)

What have you got in markdown that's secretly a database? 😎
