ContentGraph turns Markdown and structured data into validated content that your application can query and render. Use it with your existing framework, through Vite, or as a standalone build step.

Features

  • Typed collections. Validate metadata with Zod or another Standard Schema library, with inferred TypeScript types.
  • Flexible sources. Load Markdown, JSON, YAML, and TOML, or use Astro-compatible and custom content loaders.
  • Computed fields. Derive validated metadata during preparation and query it like any other field.
  • Typed queries. Filter, sort, paginate, count, and select fields through fluent or object APIs.
  • Relationships. Connect collections, validate references, and select related entries in nested queries.
  • Markdown rendering. Get HTML, headings, and syntax highlighting, with article output loaded separately from metadata.
  • Vite and standalone workflows. Refresh content during development with Vite, or prepare portable runtime artifacts with the CLI.

The basic workflow

  1. Define content. Choose sources and validate their metadata with a schema.
  2. Query content. Select fields, filter entries, and load related content.
  3. Render content. Request a Markdown article's HTML and headings when you need them.

Metadata queries and rendered bodies are separate. A page listing can select titles without loading every article. Your application owns routes, layouts, and public URLs.

Start here

Follow the quick start to build a small content pipeline, or read how ContentGraph works to understand preparation and runtime behavior.