Query .md and .mdx files by frontmatter with a Firestore-style API. Built for the Next.js App Router. An open source npm package.
import { MarkdownRepository, get } from "markdown-repository";
const repo = new MarkdownRepository("./content");
const posts = get(repo);Create a MarkdownRepository with the path to your .md or .mdx files. Both extensions are supported by default.
Compose constraints with where(), orderBy(), and limit() — the same pattern as Firestore's modular SDK.
Call get() to read files, parse frontmatter, and return typed results. Get all items, one by slug, or query results.
Varstatt is a one-person product studio run by Jurij Tokarski, product engineer since 2011. These tools are free and open — no signup, no catch.
import { MarkdownRepository, get } from "markdown-repository";
const posts = new MarkdownRepository("posts");
const all = get(posts);All Firestore comparison operators, applied to frontmatter fields.
| Operator | Meaning |
|---|---|
| == | Equal |
| != | Not equal |
| < | Less than |
| <= | Less than or equal |
| > | Greater than |
| >= | Greater than or equal |
| array-contains | Array includes value |
| array-contains-any | Array includes any of values |
| in | Value is one of |
| not-in | Value is none of |
interface MarkdownItem {
slug: string; // filename without extension
content: string; // markdown body after frontmatter
excerpt: string; // auto-extracted excerpt
[key: string]: any; // all frontmatter fields
}