Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/alineacms/alinea/llms.txt

Use this file to discover all available pages before exploring further.

Alinea is a modern, headless CMS built around a simple philosophy: your content belongs in your repository. Instead of syncing with an external database, Alinea stores all content as flat files committed directly to your git repo. A TypeScript schema defines every content type, so editors work through a visual dashboard while developers query fully-typed content with zero network overhead — no API round-trips, no cold starts, no data fetching waterfalls.

Git-Native Storage

Content lives as JSON and MDX files in your repository. Every edit is a commit. Branches, pull requests, and rollbacks all work exactly as expected.

Full TypeScript Types

Schemas defined with Config and Field generate precise TypeScript types. Every query result is fully typed — no casting, no any.

Zero-Latency Queries

Content is bundled with your application and queried from an in-memory database. No network call is made during static generation or server rendering.

Visual Dashboard

Editors get a first-class UI for creating, editing, and organizing entries. Launch it locally with npx alinea dev or deploy it alongside your app.

How Alinea Works

The entire system revolves around a single config file — conventionally cms.ts — where you define your content schema using Config and Field from the alinea package. That schema drives everything: the shape of stored JSON files, the structure of the visual dashboard, and the types returned by queries. Content storage. Each entry created in the dashboard is saved as a flat file (JSON by default, MDX for rich-text documents) inside a directory you choose — typically content/ at the root of your project. Those files are committed to git just like source code, giving you a full history of every content change. Querying content. Alinea compiles your content into an in-memory SQLite database at build time. Three primary methods are available on your cms instance:
  • cms.find({...}) — fetch an array of entries
  • cms.first({...}) — fetch the first matching entry, or null if none found
  • cms.get({...}) — fetch a single entry, throwing if not found
  • cms.count({...}) — count entries matching a query
All four accept a type, optional select, filter, orderBy, and take options, and return fully-typed results driven by your schema. The dashboard. Running npx alinea dev starts a local dashboard server. Editors can create new entries, edit fields, upload media, and publish changes — all without leaving the browser. In production you deploy the dashboard as part of your Next.js app using a route handler.

Schema Example

Define content types in cms.ts using Config.document and Field:
import {Config, Field} from 'alinea'
import {createCMS} from 'alinea/next'

const BlogPost = Config.document('Blog post', {
  fields: {
    title: Field.text('Title'),
    body: Field.richText('Body text')
  }
})

const Blog = Config.document('Blog', {
  contains: [BlogPost]
})

export const cms = createCMS({
  handlerUrl: '/api/cms',
  schema: {BlogPost, Blog},
  workspaces: {
    main: Config.workspace('Main', {
      source: 'content',
      roots: {
        blog: Config.root('Blog', {
          contains: [Blog]
        })
      }
    })
  }
})
Config.document declares an entry type that can hold child entries. Config.workspace groups one or more content roots, and Config.root is the top-level tree visible in the dashboard sidebar. The full suite of field types — Field.text, Field.richText, Field.select, Field.image, Field.date, and more — is described in the Field reference.
Alinea is a framework you add to your own project, not a hosted service you sign up for. You run the dashboard yourself and content stays in your repository. If you want a managed backend with authentication and file storage, Alinea Cloud provides those primitives on top of the same open-source core.

Next Steps

Quickstart

Install Alinea, scaffold a schema, and query your first typed content in under 10 minutes.

Configuration

Full reference for installation options, package exports, and Next.js integration setup.

Build docs developers (and LLMs) love