Query .md and .mdx files by frontmatter with a Firestore-style API. Works with Next.js App Router and server components.
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.
==Equal!=Not equal<Less than<=Less than or equal>Greater than>=Greater than or equalarray-containsArray includes valuearray-contains-anyArray includes any of valuesinValue is one ofnot-inValue is none ofFunctional query builder with where, orderBy, limit — compose constraints naturally.
Both extensions supported by default. No configuration needed.
Nested folder structures with path-based slugs like discovery/worth-building.
Full type safety with custom validators. Generics flow through repository to query to get.
Point at a directory, start querying. Sensible defaults for extensions and behavior.
One dependency (gray-matter). Synchronous reads — perfect for static site generation.
interface MarkdownItem {
slug: string; // filename without extension
content: string; // markdown body after frontmatter
excerpt: string; // auto-extracted excerpt
[key: string]: any; // all frontmatter fields
}