This guide covers how to set up your environment and run the docs locally, run tests, and work with code samples and the OpenAPI spec.
- Technical requirements
- Install
- Docs writing
- Run the docs locally
- Tests
- Code samples
- OpenAPI Mintlify file
- Deployment
- Node.js 18+ (LTS recommended)
- npm (comes with Node.js)
From the root of the repository:
npm installBefore writing or editing documentation content:
- If you use a generative AI tool: an AGENTS.md file exists in this repo with instructions for agents. Point your AI tool to it so that it follows our documentation philosophy, quality checklist, and writing-style rules.
- Otherwise: read AGENTS.md carefully. In particular, use the documentation philosophy and quality checklist when writing or reviewing docs, and follow the prose and writing-style rules (spelling, terminology, grammar, style, and wording).
To preview the documentation site and see your changes as you edit:
- Start the dev server:
npx mintlify dev- Open http://localhost:3000 in your browser. The preview updates automatically when you save MDX files.
Check for broken links in the doc site:
npx mint broken-links| Script | What it does |
|---|---|
npm run check-code-samples-usage |
Ensures every entry in .code-samples.meilisearch.yaml is either mapped to an OpenAPI route or used in an MDX snippet. Exits with error if not. |
npm run check-openapi-code-samples |
Checks the Mintlify OpenAPI file for missing cURL code samples per route. Use with curl-check or info (see script header). |
npm run check-unused-sdk-samples |
Fetches each SDK’s .code-samples.meilisearch.yaml and reports samples that are not used in this repo (candidates for removal in SDKs). |
npm run check-missing-sdk-samples |
Informational only. Compares doc snippet imports to each SDK’s samples and lists, per SDK, which imported keys are missing on the SDK side. |
Code samples are stored in .code-samples.meilisearch.yaml (and in each SDK repo). They map operation names (e.g. get_indexes) to code snippets in multiple languages. The docs use them in the API reference (via the OpenAPI Mintlify file) and in guides (via generated MDX snippets).
When adding a cURL example in /learn/ or /reference/api/: prefer adding a new entry in .code-samples.meilisearch.yaml, then running the snippet generator and importing the generated snippet in the page, rather than writing the example inline in the MDX.
- Edit samples for the docs (cURL): update
.code-samples.meilisearch.yamlin this repo. Keys should match OpenAPI operation IDs or be referenced explicitly in MDX. - Regenerate the MDX snippets used in the site (e.g. in
snippets/generated-code-samples/):
npm run generate-code-sample-snippets-fileThis script reads the local .code-samples.meilisearch.yaml and fetches each SDK’s .code-samples.meilisearch.yaml from GitHub, then generates one MDX file per operation in snippets/generated-code-samples/ with a <CodeGroup> for all languages.
The API reference is built from a Mintlify-ready OpenAPI file that includes injected code samples and cleaned metadata.
The base spec is Meilisearch’s OpenAPI file from the latest Meilisearch GitHub release. It is shipped as the asset meilisearch-openapi.json in that release.
- Fetch the latest OpenAPI file from the Meilisearch release (writes to
assets/open-api/meilisearch-openapi.json):
npm run fetch-meilisearch-openapi-fileOptional: set GITHUB_PAT or GH_TOKEN for higher API rate limits.
- Generate the Mintlify-ready file (reads
assets/open-api/meilisearch-openapi.json, injects code samples from this repo and SDK repos, cleans null descriptions; writesassets/open-api/meilisearch-openapi-mintlify.json):
npm run generate-mintlify-openapi-fileOptional: set GITHUB_PAT or GH_TOKEN when the script fetches SDK code sample files from GitHub.
The docs are deployed by Mintlify when changes are pushed to main. After each deployment, the post-deployment workflow runs (on every push to main, on workflow_dispatch, and daily at 23:00 UTC).
It does the following:
-
Build code samples — Runs
generate-code-sample-snippets-file. Ifsnippets/has changes, it commits and pushes them tomain(which triggers a new Mintlify deployment). This keeps generated snippets in sync with.code-samples.meilisearch.yamland the SDK repos. -
Fetch OpenAPI file (only if
docs.jsonhasinternal-meili-fetch-automation: true) — Fetches the latestmeilisearch-openapi.jsonfrom the Meilisearch GitHub release. If the file changed, it commits and pushes tomain. To disable this (e.g. if the latest release OpenAPI causes issues), set the flag tofalseor update the OpenAPI file manually. -
Generate and check Mintlify OpenAPI (same condition) — Runs
generate-mintlify-openapi-file, validates withnpx mint openapi-check, then commits and pushesmeilisearch-openapi-mintlify.jsonif it changed.
Each step commits separately so the history stays clear. Contributors don’t need to run these steps manually for normal edits; the workflow keeps code samples and OpenAPI files up to date after merges to main.
A concurrency group ensures only one run executes at a time, so multiple triggers (many commits merged on main) do not run in parallel and cause conflicting commits.