Skip to content

Repository files navigation

staticmint

Export a documentation site built with the Mintlify framework into a fully static bundle: plain HTML, assets, RSC payloads for client-side navigation, sitemap, robots.txt, llms.txt and materialized redirects. Host the result on any static server or CDN with no runtime dependencies.

staticmint drives your own local mint dev preview (a production Next.js server) and crawls it, so pages come out exactly as Mintlify renders them.

staticmint runs docs.miget.com in production.

Why

mint dev gives you a full local preview of your docs, but there is no self-serve way to turn it into files you can host yourself. staticmint fills that gap: run it against your docs repo and get a deployable directory.

Requirements

  • The mint CLI (Node.js), logged-out local usage is fine
  • Go 1.23+ to install the tool

Install

Download a prebuilt binary for Linux, macOS or Windows (amd64/x86_64 and arm64) from the releases page:

curl -fsSL -o /usr/local/bin/staticmint https://github.com/migetapp/staticmint/releases/latest/download/staticmint-linux-amd64
chmod +x /usr/local/bin/staticmint

Or build from source:

go install github.com/migetapp/staticmint@latest

Usage

From your docs repo (the directory containing docs.json):

staticmint -start-server -site-url https://docs.example.com

This starts mint dev, waits for it, exports everything into ./out, stops the server and verifies the result. Alternatively run against an already running preview:

mint dev --no-open &
staticmint -site-url https://docs.example.com -out dist

The exit code is non-zero if any page or referenced asset failed to export, which makes it safe to gate CI and image builds on.

Flags

-base string          mint dev server origin (default "http://127.0.0.1:3000")
-out string           output directory, deleted and recreated (default "out")
-site-url string      canonical site URL for sitemap.xml, robots.txt and llms.txt (required)
-docs string          docs repo directory (default ".")
-client-dir string    mintlify client app directory (default "~/.mintlify/mint/apps/client")
-mint-bin string      mint CLI binary (default "mint")
-inject-head string   extra HTML injected before </head> in every page
-start-server         start "mint dev" and stop it when done
-copy-md              copy source .mdx files as <route>.md companions (default true)
-keep-preview-badge   keep the floating Mintlify preview toolbar (default false)
-allow-indexing       robots.txt allows indexing (default true)
-rsc                  export RSC payloads for client-side navigation (default true)
-wait-tries int       2s-interval readiness checks (default 60; raise in CI)
-concurrency int      parallel page fetches (default 8)

What it does

  1. Enumerates every route from the fully resolved navigation (generatedDocsNav.json, which includes pages auto-generated from OpenAPI specs) plus every .mdx file in the repo, since hidden pages are routable without being in the navigation.
  2. Saves each route as route/index.html, plus route/index.rsc, the React flight payload the Next router requests during client-side navigation.
  3. Copies the entire _next/static build tree from disk, so lazy-loaded chunks and fonts always resolve, and fetches every asset referenced by the exported HTML.
  4. Exports the styled 404 page as 404.html and favicon.ico.
  5. Copies each page's MDX source as route.md and generates llms.txt and llms-full.txt when the server does not provide them.
  6. Materializes docs.json redirects as static stubs, and generates sitemap.xml and robots.txt from the real exported route list.
  7. Hides the local-preview toolbar the client mounts on every page, and injects any -inject-head HTML.
  8. Verifies that every internal link and asset reference in the bundle resolves, and reports what does not.

Hosting

The bundle uses clean URLs (route/index.html), so any host that serves index.html for directory paths works. For the best result your server should also:

  • Serve 404.html as the custom 404 page.
  • Serve route/index.rsc with content type text/x-component when a request carries the RSC: 1 header. This keeps Mintlify's instant client-side navigation working. Without it, every click degrades gracefully to a full page load. CDN caching stays correct either way because the Next router appends a ?_rsc= cache-buster to those requests.

See examples/nginx.conf for a complete config implementing both.

Re-run the export on every content change; the bundle is a snapshot.

Limitations

  • The search box posts to /api/search, which needs a backend you provide (any search service behind that path), otherwise search does not function in the static bundle.
  • .md links on pages auto-generated from OpenAPI specs return 404, since those have no MDX source and the hosted .md renderer is not part of the local preview.
  • staticmint depends on Mintlify internals: the ~/.mintlify layout, generatedDocsNav.json and the flight payload behavior. Tested against mint 4.2.800 with client 0.0.3447. Pin your mint version for reproducible builds; a breaking upstream change fails the export loudly rather than producing a broken site.
  • Windows binaries are provided and cross-compile cleanly (-start-server stops the mint dev process tree via taskkill), but Windows is not yet tested end to end; Linux and macOS are. WSL is the well-trodden path on Windows.

Licensing

staticmint itself is MIT licensed and contains no Mintlify code.

The exported bundle embeds the compiled Mintlify client runtime, which is licensed under the Elastic License 2.0 by Mintlify, Inc. Hosting your own documentation with it is fine. Do not use the export to offer Mintlify's functionality to third parties as a hosted or managed service, and do not remove license or copyright notices from the bundle.

staticmint is not affiliated with, sponsored by, or endorsed by Mintlify, Inc. "Mintlify" is a trademark of Mintlify, Inc., used here only to identify the software this tool works with.

About

Export docs built with the Mintlify framework to a fully static site: HTML, RSC payloads for client-side navigation, sitemap, llms.txt and redirects

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages