Repolode
sdorra

sdorra/content-collections

A TypeScript tool that turns local Markdown, MDX, JSON and YAML files into type-safe data collections for web apps.

Stars
1,203
Forks
53
Open issues
54
Last commit
yesterday

What is it?

Content Collections loads files from a directory and turns them into typed data collections that your app can import directly. Instead of writing code to fetch and parse content files, you define collections in a config file with a schema, and the content is parsed and validated during the build.

The schema validates each entry, so incorrect or missing fields are caught at build time. Entries can be transformed before they reach the app, for example to render Markdown, join collections or fetch data from a server. During development, changes to content update the collections without restarting the server or refreshing the browser.

Adapters are available for Next.js, Remix (Vite), SvelteKit, Solid Start, Qwik and Vite, and a CLI covers other frameworks.

Key features

  • 01Defines typed collections from a config file with a schema.
  • 02Validates content during the build so errors surface early.
  • 03Updates collections automatically when content changes during development.
  • 04Supports transforming entries before they reach the app.
  • 05Provides adapters for several frameworks and a CLI for others.

Use cases

  • Building a blog or docs site from Markdown or MDX files in a Next.js or SvelteKit project.
  • Loading structured YAML or JSON data as typed objects in a Vite app.
  • Validating a content directory so malformed entries fail the build.

Quick start

  1. 1

    Choose a framework adapter and follow its install guide from the README links

  2. 2

    Create a content-collections.ts file at the project root that defines your collections

  3. 3

    Write Markdown content in your collection directory, then import the generated collection in your app

In collections

Topics

FAQ

What is content-collections?
A TypeScript tool that turns local Markdown, MDX, JSON and YAML files into type-safe data collections for web apps. Content Collections loads files from a directory and turns them into typed data collections that your app can import directly. Instead of writing code to fetch and parse content files, you define collections in a config file with a schema, and the content is parsed and validated during the build.
Is content-collections free to use? What license does it have?
content-collections is open source under the MIT license. Check the license terms before using it in commercial products.
Is content-collections still maintained?
Actively maintained. The last commit to content-collections was on Nov 6, 2026.
What can I use content-collections for?
Building a blog or docs site from Markdown or MDX files in a Next.js or SvelteKit project. Loading structured YAML or JSON data as typed objects in a Vite app. Validating a content directory so malformed entries fail the build.
How do I install content-collections?
Choose a framework adapter and follow its install guide from the README links Create a content-collections.ts file at the project root that defines your collections Write Markdown content in your collection directory, then import the generated collection in your app
Where can I get content-collections?
The source code and installation instructions are on GitHub: https://github.com/sdorra/content-collections

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects