Alinea is an open source headless CMS written in Typescript.

  • Content is stored in flat files and can be committed to a git repository

  • Content is queryable through an in-memory SQLite database, zero network overhead

  • Content is fully typed when using Typescript

It can be installed as a single NPM package that provides a CLI which let's you get going without setting up databases, environments or any other services.

Getting started

Configuring the schema

The content schema is configured in a central config file with types. A type holds different fields — alinea ships with a lot of preconfigured field types that can be added to by creating custom fields.

const BlogPost = alinea.type('Blog post', {
  title: alinea.text('Blog entry title'),
  path: alinea.path('Url path'),
  body: alinea.richText('Body text')

On a higher level content can be structured into workspaces, which hold roots. This allows you to separate websites, apps or other publishing channels into logical categories.


Content structure

Published content is formatted into JSON files, typically in a /content directory (we're considering other formats as well). The JSON files are manually editable when needed. They can be checked into git, making it easy to collaborate.

Alinea indexes the JSON files into an embedded SQLite database. Having a database with indexed fields means querying content is fast and simple. The database and tools to query content are packaged into a Javascript library that sits next to your code and is aliased to @alinea/content.

import {initPages} from '@alinea/content/pages'
const pages = initPages()
  await pages
    .where(post =>'Me'))
    .select(post => ({title: post.title}))
Content structure
Querying content

Hosting the dashboard

While developing locally the alinea CLI starts a server with the dashboard for you. Changes are written to the file system and can be committed to git manually during the development process.

When your project is ready to deploy alinea exposes a handler that can be hosted on most Javascript runtimes (Node.js or edge/serverless functions). The handler needs access to a backend service that can authenticate users, store drafts and publish changes back to the git repository. Alinea ships with some packages that help you build a backend — or one can be hosted via our cloud service.

Deploying alinea