Skip to content
Margin

Configuration

Configure a site with files, frontmatter, and optional docs.json.

docs.json is optional and lives at the root of the folder named by DOCS_DIR. It extends supported Mintlify fields. Unknown fields produce diagnostics; a malformed known field falls back independently. Unparseable JSON and unsafe or invalid content can fail the build.

Files and titles

index.mdx becomes its directory’s landing page. Other .md and .mdx files become paths based on their filenames. A title comes from frontmatter, then the first Markdown H1, then the filename. For example:

# Quickstart

Follow these steps to make a request.

Use meta.json to order a directory’s sidebar entries. "..." includes remaining pages:

{ "title": "Guides", "pages": ["index", "quickstart", "..."] }

An explicit navigation block in docs.json controls the sidebar. Pages left out of it can still be reached by URL; hiding a page is not access control. Do not put confidential content in a public documentation tree.

Site configuration

{
  "name": "Example Docs",
  "theme": "aspen",
  "colors": { "primary": "#2563EB" },
  "navigation": {
    "groups": [{ "group": "Start", "pages": ["index", "quickstart"] }]
  },
  "x-margin": {
    "search": { "mode": "static" },
    "layout": { "sidebarWidth": "300px" }
  }
}

Mintlify themes map to framework-owned layout presets. They approximate the upstream layout rather than reproduce it pixel for pixel. Colors, logos, fonts, navigation, OpenAPI references, redirects, and supported analytics settings remain data. Local snippet components can add executable page content, but they do not replace server code or the configuration schema.

Framework extensions

The vendor namespace is x-margin. Common settings include:

FieldEffect
search.modeai, static, or off; AI search also needs a Gateway credential.
tokensTheme token values, including light/dark pairs.
cssExplicit stylesheet paths, or null to disable stylesheet injection.
layoutContent, sidebar, TOC, and header dimensions; tab/chrome mode.
head.metaAdditional static meta tags.
assets.allowExternalHosts allowed for supported remote asset resolution.
versions.defaultDefault product documentation version.
seoTitle template, publisher, language, and provenance facts.
agentsContent signals, index preamble, Markdown behavior, and MCP instructions.

These fields belong inside x-margin; for example, x-margin.search.mode. Server modules selected by DOCS_EXTENSIONS use a separate TypeScript contract.

Product versions

Product versions such as v1 and v2 are path partitions inside one content snapshot. They are separate from deployment versions keyed by commit. Directory conventions or explicit navigation can define them. A version root’s meta.json can label it and choose a default:

{ "title": "Version 2", "x-margin-version": "v2", "x-margin-version-default": true }

Assets and styling

Keep images, logos, and fonts inside the docs folder. Ingest rewrites admitted asset references to content-addressed URLs. SVGs are sanitized; CSS is parsed and sanitized before serving. Stylesheets cannot introduce arbitrary scripts. Inter and Geist Mono are the bundled text fonts; OG cards use Geist Sans.

Icons

Builds use the MIT-licensed Hugeicons Free set. To use a licensed Hugeicons Pro set, set HUGEICONS_PRO_TOKEN in the build environment, optionally choose HUGEICONS_PRO_STYLE, then run bun run icons:build or redeploy. The script fetches Pro into a temporary directory; it is never a manifest dependency. A missing content glyph falls back to the default icon; a missing chrome glyph fails the build. Never commit the token, the Pro package, or generated Pro SVGs. Your Pro license governs deployment and redistribution.

Environment variables

Outside Vercel, only the database URL and SITE_ORIGIN are required. Empty strings count as unset. Keep secrets in your environment or Vercel project, never in docs.json or a committed environment file.

VariableDefault / requirementPurpose
DATABASE_URL / POSTGRES_URLRequired; first non-empty winsPostgres connection.
DATABASE_URL_UNPOOLED / POSTGRES_URL_NON_POOLINGConnection URL aboveDirect connection for migrations and the ingest advisory lock; supply it when using a transaction-mode pooler.
DATABASE_POOL_MAX2 (range 1–20)Connections per server instance.
NODE_EXTRA_CA_CERTSUnsetPath to a PEM CA bundle for Postgres signed by a private CA. Set before starting the process, including migrations and ingest; this keeps TLS certificate verification enabled.
POSTGRES_PORT5440Host port of the Compose database. Update the connection URL too.
SITE_ORIGINRequired outside Vercel; production project URL or deployment URL on VercelCanonical URLs, sitemaps, and OG images.
SITE_SLUGdocsSingle-site database slug and cache tag; lowercase letters, digits, and inner hyphens, at most 55 characters.
SITE_NAMEdocs.json name, then slugDisplay name. Read at build time, so a change takes effect on the next deployment.
SITE_SECRETDatabase URLSalt for hashed visitor identifiers.
DOCS_DIRdocs/, else . when it contains docs.jsonFolder to ingest.
DOCS_CONTENT_SHAVercel commit SHA, then git HEAD, then dev-<ms>Content key, resolved once and baked into a deployment.
DOCS_INGESTonoff skips ingest; force replaces an already-ingested key.
DOCS_KEEP_VERSIONS20Number of other production versions retained in addition to the age window and protected versions.
DOCS_CANONICAL_REDIRECT10 disables production redirects to the SITE_ORIGIN host.
DOCS_CHAT_MODELopenai/gpt-5.6-terraAI Gateway model for the assistant.
AI_GATEWAY_API_KEYUnset; Vercel uses OIDCOptional assistant credential. Outside Vercel, search stays static without it. On Vercel, enable AI Gateway access for the deployment.
DOCS_LINK_RELATION_BASERepository’s docs/link-relations.md# URIBase for agent discovery relation URIs.
HUGEICONS_PRO_TOKEN / HUGEICONS_PRO_STYLEUnset / stroke-roundedOptional Pro icon set, fetched only while building icons.
BLOB_READ_WRITE_TOKENUnsetOptional Vercel Blob storage for large assets and the search corpus. Without it, both stay in Postgres within ingest size limits.
GITHUB_TOKENUnsetRaises the repository stars widget’s GitHub API rate limit.
SENTRY_DSNUnset; Sentry offOptional error reporting. Local development (VERCEL_ENV, else NODE_ENV, is development, as under bun run dev) stays silent even with a DSN unless SENTRY_ENVIRONMENT is set.
SENTRY_ORG, SENTRY_PROJECT, SENTRY_AUTH_TOKENUnsetSource-map uploads require all three and the DSN.
SENTRY_ENVIRONMENT, SENTRY_RELEASEDeployment environment / platform-derived release when availableOptional Sentry metadata overrides. Setting SENTRY_ENVIRONMENT also opts local development into reporting.
POSTHOG_KEY / POSTHOG_HOSTUnset / https://us.i.posthog.comAgent-journey analytics; off without a key.
DOCS_EXTENSIONSBuilt-in single-site moduleBuild-time path to a module exporting extensions: DocsExtensions.
NITRO_PRESETvercelServer build target; use node-server for self-hosting.
PORT / NODE_ENVVite default / developmentDev server port and runtime environment. The example uses port 3000.
VERCEL_ENV, VERCEL_URL, VERCEL_PROJECT_PRODUCTION_URLSupplied by VercelPreview behavior and inferred origin.
VERCEL_GIT_COMMIT_SHA, VERCEL_GIT_PULL_REQUEST_ID, VERCEL_OIDC_TOKENSupplied by VercelContent version, preview metadata, and Gateway authentication.

The deployment standard defines the supported field inventory, precedence, and MDX security contract; see also deployment and extensions.