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 build compiles your cms.ts schema, indexes all content files, and writes the output to the @alinea/generated module inside node_modules. This generated module is what your application imports at build time to get fully-typed content queries and the pre-indexed content cache. Run alinea build as the first step of your CI/CD pipeline, before next build or any other framework build command.
Usage
Generate types and content cache
alinea dev, the -- <command> separator lets you chain a downstream build command that runs after generation completes.
Options
Path to the Alinea config file. Defaults to auto-detection: Alinea searches for
cms.ts (or cms.js) starting from the project root. Use this flag when your config file lives in a non-standard location.Root directory of the project. Defaults to
process.cwd(). All relative paths in the config are resolved from this directory. Useful in monorepos where the Alinea project is not at the repository root.Watch schema and content source files for changes and regenerate automatically. This flag only takes effect when combined with
--fix; without --fix, the build process runs through the internal server pipeline which controls watching independently.Scan all content files and overwrite any missing or incorrect properties with their default values. For example, if a content entry is missing a required
path field, --fix will compute and write the correct default. Use this after schema migrations that introduce new required fields.The --fix Flag in Detail
When you add a new required field to an existing content type, existing content files will be missing that field. Running alinea build --fix iterates over every content file, detects missing or invalid properties, and writes the corrected defaults back to disk before generating the output module.
Fix content files then exit
--fix is provided, the CLI runs the generator directly (bypassing the local server) and exits with code 0 after the fix pass completes. This makes it safe to run as a one-off migration step without leaving any background processes running.
CI Usage
In a typical CI pipeline, runalinea build before your framework’s build command. The -- separator is the cleanest way to chain them:
Build for production (CI)
Forward to next build
NODE_ENV is set to production automatically — you do not need to set it manually.
package.json example
If you ranalinea init, your build script was already patched:
package.json
What Gets Generated
alinea build writes its output to node_modules/@alinea/generated/. The key output files are:
source.js— a serialized snapshot of all indexed content, used by the query engine at runtime.settings.json— dashboard configuration derived from yourcms.ts(e.g. the admin path).- Dashboard bundle — if
dashboardFileis set in your config, the admin HTML file is bundled into yourpublicdirectory.
alinea build can also be invoked as alinea generate — both names run the exact same command. The generate alias exists for backwards compatibility with earlier Alinea versions. Either form works in scripts and CI configurations.