Cache & Environment

How Boltdocs caching works, what gets cached, and the environment variables that control it.

Boltdocs caches parsed files and transformations so subsequent builds and dev server restarts are fast. This guide covers how caching works and how to configure it.

Cache BehaviorLink

Development ModeLink

  • Cache is loaded at startup for instant navigation
  • Files are watched — changes invalidate relevant cache entries
  • Full rebuild only when the configuration or plugins change

Production BuildLink

  • Cold start builds from scratch
  • Cache written to disk for future use
  • CI/CD environments get consistent builds

Environment VariablesLink

Configure cache behavior through environment variables:

VariableTypeDefaultDescription
BOLTDOCS_CACHE_DIRstring.boltdocs/cacheDirectory for main processing cache files
BOLTDOCS_NO_CACHEbooleanfalseSet to 1 to disable all caching
BOLTDOCS_CACHE_LRU_LIMITnumber2000Maximum entries in the in-memory LRU cache
BOLTDOCS_CACHE_LRU_TTLnumber14400000TTL in ms (default 4 hours)
BOLTDOCS_CACHE_COMPRESSbooleantrueEnable gzip compression for cache files

Integration Environment VariablesLink

In addition to cache options, Boltdocs resolves integration-specific keys from your environment variables safely:

VariableScopeDescription
BOLTDOCS_GITHUB_TOKENCustom FeedbackA personal access token (PAT) with write access to GitHub Discussions.
BOLTDOCS_GITHUB_REPO_OWNERCustom FeedbackOverrides the owner username or organization of the target repository.
BOLTDOCS_GITHUB_REPO_NAMECustom FeedbackOverrides the name of the target repository.
GITHUB_APP_IDGitHub App AuthThe unique App ID generated by your GitHub App.
GITHUB_PRIVATE_KEYGitHub App AuthThe RSA private key of the GitHub App.
GITHUB_INSTALLATION_IDGitHub App AuthThe installation ID associated with your target repository.

Usage ExamplesLink

bash
# Disable all caching (useful for debugging)
BOLTDOCS_NO_CACHE=1 pnpm docs:dev

# Use custom cache directory
BOLTDOCS_CACHE_DIR=.cache/boltdocs pnpm docs:dev

# Increase cache size for large projects
BOLTDOCS_CACHE_LRU_LIMIT=5000 pnpm docs:dev

Cache InvalidationLink

The cache is invalidated automatically when:

  1. The file content changes — Detected via content hash
  2. The file is deleted — Cache entry removed
  3. The configuration changes — Full invalidation triggered
  4. The plugin version changes — MDX cache invalidated

Manual InvalidationLink

Delete the cache directory:

bash
rm -rf .boltdocs

Or in development, the dev server invalidates automatically on file changes.


Cache LocationLink

By default, the cache lives in .boltdocs/ at the root of your project:

text
my-docs/
├── .boltdocs/
│   ├── build/
│   │   ├── framework-hash.txt
│   │   ├── template-index.html
│   │   ├── render-cache.json
│   │   └── pages/         ← cached HTML per page
│   ├── cache/
│   │   ├── parser/        ← Parser results (JSON)
│   │   ├── mdx/           ← Compiled MDX code
│   │   ├── routes/        ← Route metadata
│   │   └── assets/        ← Processed assets
│   ├── generated/
│   │   ├── types.d.ts
│   │   └── link-tree.json
│   ├── reports/
│   │   ├── doctor.json
│   │   └── performance.json
│   └── backups/           ← Doctor fix backups
├── docs/
└── boltdocs.config.ts

TroubleshootingLink

Corrupted cacheLink

If you suspect corrupted cache entries:

bash
# Clear all caches
rm -rf .boltdocs

# Restart dev server
pnpm docs:dev

Stale content in productionLink

Make sure your CI pipeline starts clean:

bash
# Clean before build
rm -rf .boltdocs
pnpm docs:build

Large cache sizeLink

For very large documentation sites:

bash
# Disable compression to save CPU at the cost of disk space
BOLTDOCS_CACHE_COMPRESS=0 pnpm docs:build

Performance NotesLink

  • First startup is slower — the cache is being populated
  • Subsequent startups are nearly instant (< 100ms)
  • The more pages you have, the more the cache helps
  • Cache compression adds ~10% CPU overhead but saves ~70% disk
Last updated on October 18, 2026

Was this page helpful?