Alinea separates two concerns: the canonical content store (your git repository) and the editing backend (draft storage, publishing, and authentication). By default, Alinea Cloud handles the editing backend for you. If you prefer to self-host, you can supply aDocumentation 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.
BackendOptions object to createHandler that points to your own GitHub repository and a database of your choice.
Architecture
When an editor saves a draft, Alinea writes it to the configured database. When they publish, Alinea calls the GitHub API to commit the changed files to your repository. Your Next.js build then picks up those committed files on the next deployment. The database is used only for ephemeral draft state and is never the source of truth for published content.BackendOptions
Pass BackendOptions to createHandler via the backend field:
app/api/cms/route.ts
Connection details for the GitHub repository where Alinea commits published
content. See
GithubOptions below.The database to use for draft storage. Specify a
driver string and a
client instance matching that driver. See
Supported database drivers for the full list.Optional basic authentication callback. Receives the username and password
from the login form and should return
true to allow access. Use this for
simple single-user setups. Omit when using oauth2.Optional OAuth2 configuration for delegating authentication to an external
provider. When both
auth and oauth2 are absent, createBackend throws at
request time. Provide exactly one of the two.GithubOptions
GithubOptions extends GithubSourceOptions with an optional author field:
The GitHub organisation or user that owns the repository, e.g.
"acme-corp".The repository name, e.g.
"my-website".The branch to read from and commit to, e.g.
"main".A GitHub personal access token or app installation token with read and write
access to repository contents.
The path within the repository to treat as the project root. Pass an empty
string (
"") when your content lives at the repository root.The directory (relative to
rootDir) where Alinea stores content files,
e.g. "content".Default commit author. When a logged-in user has a name and email set,
Alinea uses their identity instead and appends the configured author as a
Co-authored-by trailer.Supported database drivers
DatabaseDeclaration is a discriminated union — set driver to one of the strings below, and set client to the corresponding database client instance for that driver.
driver | Client type | Typical use |
|---|---|---|
"d1" | Cloudflare D1 binding | Cloudflare Workers / Pages |
"mysql2" | mysql2 connection or pool | MySQL on any host |
"@neondatabase/serverless" | Neon serverless client | Neon Postgres (serverless) |
"@vercel/postgres" | @vercel/postgres client | Vercel Postgres |
"pg" | pg Client or Pool | Standard PostgreSQL |
"@electric-sql/pglite" | PGlite instance | In-process SQLite-compatible Postgres |
"sql.js" | sql.js Database | In-memory SQLite (testing) |
"@libsql/client" | libSQL client | Turso / libSQL |
D1 example (Cloudflare)
app/api/cms/route.ts
Neon / Vercel Postgres example
app/api/cms/route.ts
OAuth2Options
The OAuth2 client identifier issued by your identity provider.
Client secret. Required for
client_secret_basic authentication methods
such as client_credentials and password flows, but not for
authorization_code.The JWKS endpoint URI used to verify access token signatures.
The
/authorize endpoint. Required for the browser-side of the
authorization_code flow.The
/token endpoint. Required for most grant types and for refreshing
tokens.The
/revoke endpoint. Used to revoke tokens on logout. Not supported by
all providers.Optional callback to enforce extra JWT claim checks such as
iss or aud.
Throw an error inside the callback to reject the token.