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({
  workspaces, schema, dashboard, preview
})

workspaces

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

schema

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

dashboard

All configuration to generate the dashboard UI for deployment goes here.

preview

A url which is used in the dashboard for live previews.

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)