Overview / 01

Quickstart

Zole validates Markdown, MDX, and JSON files against Zod 4 schemas and compiles them into typed TypeScript modules, type declarations, and an optional Orama full-text search index.

Requirements: Node.js >=24 and Zod ^4.6.7. .md, .mdx, and .json parsing are built into @zolekit/core.

1. Install Zole

Install the runtime core alongside @zolekit/cli and zod:

pnpm add @zolekit/core zod
pnpm add -D @zolekit/cli

Or initialize an existing project directly with npx:

npx zolekit init

This creates a starter zole.config.ts alongside an example collection and output setup.

2. Configure a collection

Create zole.config.ts at the project root using defineConfig and defineCollection:

import { defineCollection, defineConfig } from "@zolekit/core";
import { z } from "zod";

const docs = defineCollection({
  schema: z.object({
    title: z.string().min(1),
    description: z.string(),
    order: z.number().int().min(1),
    draft: z.boolean().default(false),
  }),
});

export default defineConfig({
  collections: {
    docs: {
      path: "content/docs",
      schema: docs.meta,
    },
  },
  outputDir: "generated/content",
  search: {
    enabled: true,
  },
});

3. Author content files

Place Markdown or MDX files inside content/docs/. Frontmatter accepts standard YAML, indented maps, multiline JSON-like blocks, or MDX export const meta:

---
title: Hello Zole
description: First validated document in the docs collection.
order: 1
---

Your Markdown or MDX body is preserved alongside typed metadata.

4. Validate and build

Run zole lint to validate metadata, relations, and locale coverage, or zole build to emit typed artifacts under generated/content/ and .zole/search-index.json:

pnpm exec zole lint
pnpm exec zole build

You can also inspect workspace health (zole doctor), query the generated index (zole search "frontmatter"), or watch content files (zole watch).

5. Import generated output

Import strictly typed collection data directly in application code:

import { docs } from "./generated/content";

for (const entry of docs) {
  console.log(entry.slug, entry.meta.title);
}

Type a command, config option, or guide title.