Configuration

All configuration can be managed from the cms.tsx file. This file is created in the project root (or your src folder if it exists) during alinea init.

cms.tsx
import {createCMS} from 'alinea/next'

export const cms = createCMS({
  schema, workspaces, ...
})

schema

Describe the structure of your content using a collection of Types.

workspaces

Content can be bundled in separate Workspaces. Defining at least one is required.

baseUrl

The URL of the frontend where Alinea is used.

preview

Display an iframe with live previews on the side of the editor.

syncInterval

Optionally set the interval in seconds at which the frontend will poll for updates.

Good to know

Dealing with errors

Your config file is read and executed during the alinea dev and alinea build CLI commands. If anything goes wrong, you might see an error such as:

Error: Fail
    at file:///home/alineacms/alinea/node_modules/@alinea/generated/config.js?1706175675574:419:7
    at ModuleJob.run (node:internal/modules/esm/module_job:194:25)

To debug these situations Alinea compiles your config file with an included source map. To enable node to read the source map and report correct positions you can enable the Node.js --enable-source-maps flag. You can add it to the scripts in package.json:

{
  "scripts": {
    "dev": "NODE_OPTIONS=--enable-source-maps alinea dev -- next dev",
    "build": "NODE_OPTIONS=--enable-source-maps alinea build -- next build"
  }
}

If you're developing on Windows you can use cross-env to achieve the same.

The error will now point to the right file:

Error: Fail
    at <anonymous> (/home/alinea/apps/dev/cms.tsx:278:7)
    at ModuleJob.run (node:internal/modules/esm/module_job:194:25)