Examples
Copy-paste snippets for common scribe-cms workflows.
Install
Add scribe-cms to any Node 20+ project.
pnpm add scribe-cms zod better-sqlite3Config
Define content types with Zod — translatable, structural, and relation fields.
import { z } from "zod";
import { defineConfig, defineContentType, field } from "scribe-cms";
const blogSchema = z.object({
title: field.translatable(z.string().min(1)),
description: field.translatable(z.string().min(50)),
author: field.relation("author"),
});
const authorSchema = z.object({
name: field.structural(z.string().min(1)),
});
export default defineConfig({
rootDir: ".",
locales: ["en", "fr"],
types: [
defineContentType({
id: "blog",
path: "/blog/{slug}",
schema: blogSchema,
slugStrategy: "localized",
}),
defineContentType({
id: "author",
contentDir: "authors",
schema: authorSchema,
}),
],
});Content file
One .mdx file per document — the file name is the English slug.
---
title: "Hello, world"
description: "A first post that says hello to the world, at length, because the schema demands fifty characters."
author: jane
publishedAt: "2026-01-15"
---
The body is MDX. **Markdown** and components both work.Runtime
Read content with a typed client — list, resolve, and follow relations.
import { createScribe } from "scribe-cms/runtime";
import config from "./scribe.config";
const scribe = createScribe(config);
const posts = scribe.blog.list("fr");
const { document } = scribe.blog.resolve("hello-world", "fr");
const author = scribe.blog.related(document!, "author");CLI
Validate content before builds and translate stale pages with Gemini.
scribe validate
scribe translate --locale fr
scribe status