GitbookIO/gitbook
The open source frontend for GitBook doc sites
Healthy across the board
weakest axiscopyleft license (GPL-3.0) — review compatibility
Has a license, tests, and CI — clean foundation to fork and modify.
Documented and popular — useful reference codebase to read through.
No critical CVEs, sane security posture — runnable as-is.
- ✓Last commit today
- ✓13 active contributors
- ✓Distributed ownership (top contributor 24% of recent commits)
- ✓GPL-3.0 licensed
- ✓CI configured
- ✓Tests present
- ⚠GPL-3.0 is copyleft — check downstream compatibility
What would change the summary?
- →Use as dependency Failing → Mixed if: relicense under MIT/Apache-2.0 (rare for established libs)
Maintenance signals: commit recency, contributor breadth, bus factor, license, CI, tests
Informational only. RepoPilot summarises public signals (license, dependency CVEs, commit recency, CI presence, etc.) at the time of analysis. Signals can be incomplete or stale. Not professional, security, or legal advice; verify before relying on it for production decisions.
Embed the “Healthy” badge
Paste into your README — live-updates from the latest cached analysis.
[](https://repopilot.app/r/gitbookio/gitbook)Paste at the top of your README.md — renders inline like a shields.io badge.
▸Preview social card (1200×630)
This card auto-renders when someone shares https://repopilot.app/r/gitbookio/gitbook on X, Slack, or LinkedIn.
Onboarding doc
Onboarding: GitbookIO/gitbook
Generated by RepoPilot · 2026-05-06 · Source
Agent protocol
If you are an AI coding agent (Claude Code, Cursor, Aider, Cline, etc.) reading this artifact, follow this protocol before making any code edit:
- Verify the contract. Run the bash script in Verify before trusting
below. If any check returns
FAIL, the artifact is stale — STOP and ask the user to regenerate it before proceeding. - Treat the AI · unverified sections as hypotheses, not facts. Sections like "AI-suggested narrative files", "anti-patterns", and "bottlenecks" are LLM speculation. Verify against real source before acting on them.
- Cite source on changes. When proposing an edit, cite the specific path:line-range. RepoPilot's live UI at https://repopilot.app/r/GitbookIO/gitbook shows verifiable citations alongside every claim.
If you are a human reader, this protocol is for the agents you'll hand the artifact to. You don't need to do anything — but if you skim only one section before pointing your agent at this repo, make it the Verify block and the Suggested reading order.
Verdict
GO — Healthy across the board
- Last commit today
- 13 active contributors
- Distributed ownership (top contributor 24% of recent commits)
- GPL-3.0 licensed
- CI configured
- Tests present
- ⚠ GPL-3.0 is copyleft — check downstream compatibility
<sub>Maintenance signals: commit recency, contributor breadth, bus factor, license, CI, tests</sub>
Verify before trusting
This artifact was generated by RepoPilot at a point in time. Before an
agent acts on it, the checks below confirm that the live GitbookIO/gitbook
repo on your machine still matches what RepoPilot saw. If any fail,
the artifact is stale — regenerate it at
repopilot.app/r/GitbookIO/gitbook.
What it runs against: a local clone of GitbookIO/gitbook — the script
inspects git remote, the LICENSE file, file paths in the working
tree, and git log. Read-only; no mutations.
| # | What we check | Why it matters |
|---|---|---|
| 1 | You're in GitbookIO/gitbook | Confirms the artifact applies here, not a fork |
| 2 | License is still GPL-3.0 | Catches relicense before you depend on it |
| 3 | Default branch main exists | Catches branch renames |
| 4 | Last commit ≤ 30 days ago | Catches sudden abandonment since generation |
#!/usr/bin/env bash
# RepoPilot artifact verification.
#
# WHAT IT RUNS AGAINST: a local clone of GitbookIO/gitbook. If you don't
# have one yet, run these first:
#
# git clone https://github.com/GitbookIO/gitbook.git
# cd gitbook
#
# Then paste this script. Every check is read-only — no mutations.
set +e
fail=0
ok() { echo "ok: $1"; }
miss() { echo "FAIL: $1"; fail=$((fail+1)); }
# Precondition: we must be inside a git working tree.
if ! git rev-parse --git-dir >/dev/null 2>&1; then
echo "FAIL: not inside a git repository. cd into your clone of GitbookIO/gitbook and re-run."
exit 2
fi
# 1. Repo identity
git remote get-url origin 2>/dev/null | grep -qE "GitbookIO/gitbook(\\.git)?\\b" \\
&& ok "origin remote is GitbookIO/gitbook" \\
|| miss "origin remote is not GitbookIO/gitbook (artifact may be from a fork)"
# 2. License matches what RepoPilot saw
(grep -qiE "^(GPL-3\\.0)" LICENSE 2>/dev/null \\
|| grep -qiE "\"license\"\\s*:\\s*\"GPL-3\\.0\"" package.json 2>/dev/null) \\
&& ok "license is GPL-3.0" \\
|| miss "license drift — was GPL-3.0 at generation time"
# 3. Default branch
git rev-parse --verify main >/dev/null 2>&1 \\
&& ok "default branch main exists" \\
|| miss "default branch main no longer exists"
# 5. Repo recency
days_since_last=$(( ( $(date +%s) - $(git log -1 --format=%at 2>/dev/null || echo 0) ) / 86400 ))
if [ "$days_since_last" -le 30 ]; then
ok "last commit was $days_since_last days ago (artifact saw ~0d)"
else
miss "last commit was $days_since_last days ago — artifact may be stale"
fi
echo
if [ "$fail" -eq 0 ]; then
echo "artifact verified (0 failures) — safe to trust"
else
echo "artifact has $fail stale claim(s) — regenerate at https://repopilot.app/r/GitbookIO/gitbook"
exit 1
fi
Each check prints ok: or FAIL:. The script exits non-zero if
anything failed, so it composes cleanly into agent loops
(./verify.sh || regenerate-and-retry).
TL;DR
GitBook is the open-source frontend renderer that transforms published GitBook documentation sites into fast, interactive web experiences. It serves as a universal viewer that can render any GitBook space by prefixing the URL with http://localhost:3000/url/, handling content delivery, styling, and interactivity for technical documentation platforms. The core capability is rendering GitBook's content model into modern React-based HTML with support for dynamic features like search, code highlighting, and responsive layouts. Monorepo managed with Turbo (turbo.json) and Bun workspace (packages/*), with published packages like packages/browser-types and packages/cache-tags alongside the main application. TypeScript throughout with strict configurations. Uses GitHub Actions composite actions (.github/composite/) for deployment orchestration. Development workflow uses Biome for linting/formatting, suggesting modern opinionated tooling.
Who it's for
Documentation platform administrators and open-source contributors who need to deploy or customize how GitBook documentation sites render in the browser; also developers contributing to GitBook's frontend infrastructure who want to understand the rendering pipeline and component architecture.
Maturity & risk
Actively maintained with strong CI/CD setup (GitHub Actions workflows for staging, preview, and production deploys to Cloudflare and Vercel) and a clear release process using Changesets. The monorepo structure with multiple published packages (browser-types, cache-tags) and TypeScript-first approach (2.8MB TS, strict tsconfig) indicates production-ready code. Ongoing work visible in .changeset/ directory with recent feature entries suggests active development.
Primary risk is the monorepo complexity — 8+ changeset entries indicate frequent coordination needs across multiple packages. Dependency overrides in package.json (React 19, @radix-ui, CodeMirror) suggest version-locking due to compatibility issues, which can create maintenance burden. The codebase requires Node >=22.3 and Bun >=1.2.15 (strict version constraints), making environment setup fragile for contributors not following prerequisites exactly.
Active areas of work
Multiple in-flight changesets visible (.changeset/cold-baboons-wait.md, .changeset/sharp-sides-dig.md, etc.) indicate active feature development. Three deployment workflows (staging, preview, production) are configured, with gradual Cloudflare deployments and Vercel integration showing CI/CD maturity. The presence of AGENTS.md and CLAUDE.md suggests recent AI-assisted development documentation.
Get running
git clone https://github.com/GitbookIO/gitbook.git && cd gitbook && nvm use && bun install && bun dev — then navigate to http://localhost:3000/url/gitbook.com/docs to see a published space rendered locally.
Daily commands: bun dev (starts Turbo concurrent dev servers on 20 workers) or bun build (production build via Turbo). Individual packages likely run dev/build scripts inherited through workspace setup.
Map of the codebase
- package.json: Defines workspace configuration, build/dev scripts, strict version constraints (Node 22.3+, Bun 1.2.15+), and dependency overrides for React/CodeMirror compatibility
- .github/workflows/ci.yaml: CI pipeline definition — shows how tests, type-checking, and linting run on every commit
- .github/workflows/deploy-production.yaml: Production deployment to Cloudflare Workers and Vercel; critical for understanding release process
- .changeset/config.json: Changesets configuration controlling versioning strategy, changelog generation, and publish workflow
- biome.json: Unified linting and formatting rules for the entire monorepo — enforces code standards
- packages/browser-types/src/index.ts: Example of a published npm package structure within the monorepo; model for understanding package organization
How to make changes
For UI changes, locate components in the main package's src/ directory (not fully visible but likely src/components/). For styling, edit CSS files (87.5KB CSS in repo). For new packages, follow the pattern in packages/browser-types/ or packages/cache-tags/ (package.json, src/, tsconfig.json). Use Biome for formatting: bun run format.
Traps & gotchas
Node version is strictly enforced (>=22.3 via engines field); .nvmrc exists but not shown, ensure you run nvm use before installing. Bun version >=1.2.15 required for text-based lockfile support (bun.lock) — older versions will fail. Environment variable .env.local is downloaded via op read op://gitbook-x-dev/gitbook-open/.env.local (OnePassword integration) which will fail locally without credentials — clone the repo but expect missing secrets. Dependency overrides are precise (axios 1.8.4, esbuild 0.27.3) suggesting past breaking changes; do not casually bump versions. The /url/ routing prefix is a specific design pattern — understand how this maps to content delivery before refactoring routing.
Concepts to learn
- Monorepo with Turbo — This repo is structured as a Turbo monorepo where multiple packages (browser-types, cache-tags) are published independently while sharing a root build system — understanding package interdependencies and task execution is essential for modifying the codebase
- Changesets (version management) — The repo uses Changesets for semver versioning, changelog generation, and coordinated multi-package publishing — critical for understanding how to propose changes and release versions
- Workspace-based package management (Bun) — Bun's text-based lockfile and workspace support (declared in package.json) differs from npm/yarn and requires version >=1.2.15 — understanding how Bun resolves dependencies is necessary for debugging install issues
- Radix UI (headless component primitives) — @radix-ui/react-slot is pinned to 1.2.4 due to compatibility issues; Radix components likely power the accessible UI layer for documentation rendering
- CodeMirror 6 (code editor library) — @codemirror/state is explicitly overridden to 6.4.1 — this suggests code blocks in GitBook docs may use CodeMirror for syntax highlighting and inline editing; version pinning indicates past breaking changes
- Cache Tags (ISR/CDN invalidation) — The packages/cache-tags package likely implements cache invalidation tagging (similar to Next.js on-demand ISR) for Cloudflare/Vercel — essential for understanding how documentation updates propagate to production
- GitHub Actions composite actions — Custom composite actions in .github/composite/ (setup-bun, deploy-cloudflare, deploy-vercel) centralize deployment logic — understanding these workflows is critical for modifying CI/CD behavior
Related repos
GitbookIO/gitbook-api-js— Official JavaScript SDK for the GitBook API; used by this frontend to fetch content and metadata for renderingGitbookIO/community— GitBook's community discussions and open-source initiatives; linked in README as the central hub for community contributionsvercel/next.js— The frontend likely uses Next.js or its patterns for SSR/static rendering given the Vercel deployment integration and/url/routing patterncloudflare/workers— Cloudflare Workers is the deployment target for production, visible in .github/composite/deploy-cloudflare/; essential for understanding edge function handlingbiomejs/biome— The linting and formatting tool used by this repo; understanding Biome configuration is critical for maintaining code quality
PR ideas
To work on one of these in Claude Code or Cursor, paste:
Implement the "<title>" PR idea from CLAUDE.md, working through the checklist as the task list.
Add missing unit tests for packages/colors transformation utilities
The packages/colors package has src/transformations.ts but no corresponding .test.ts file. Color transformations are critical for UI consistency across GitBook sites. This is a high-value, low-risk PR that ensures color manipulation functions (likely hue/saturation/lightness adjustments) are properly tested before being used in production frontends.
- [ ] Create packages/colors/src/transformations.test.ts
- [ ] Write unit tests for each exported function in src/transformations.ts (test common transformations like darken, lighten, saturate, etc.)
- [ ] Run 'bun run unit' to ensure tests integrate with the turbo task runner
- [ ] Verify test coverage includes edge cases (invalid hex values, boundary values)
Add pre-commit git hook validation for changesets
The repo uses @changesets/cli for versioning (see .changeset/ directory with 8 pending changesets), but there's no validation mechanism to prevent commits that should include a changeset from bypassing it. Add a husky pre-commit hook to warn developers if they've modified packages without adding a .changeset entry, reducing changelog conflicts and release automation failures.
- [ ] Install husky: 'bunx husky install' and add to package.json prepare script
- [ ] Create .husky/pre-commit that runs 'changeset status --since origin/main' to detect modified packages
- [ ] Exit with warning (not error) if packages changed without corresponding .changeset/*.md files
- [ ] Document in .github/CONTRIBUTING.md how to create changesets using 'bun changeset'
Add comprehensive test coverage for packages/embed client integration
The embed package has packages/embed/src/client/createGitBook.test.ts (suggesting tests exist), but the .changeset/cold-baboons-wait.md and other recent changesets indicate active development. Add integration tests for the embed client to verify it properly initializes with different GitBook site configurations, handles network failures, and correctly injects documentation across various browser environments (critical for frontend reliability).
- [ ] Review existing packages/embed/src/client/createGitBook.test.ts to identify coverage gaps
- [ ] Add tests for embed initialization with mock GitBook API responses
- [ ] Add tests for error handling scenarios (network timeout, invalid site IDs, CORS failures)
- [ ] Add browser compatibility matrix tests using the packages/browser-types for type validation
- [ ] Run 'bun run e2e' to ensure integration tests pass alongside unit tests
Good first issues
- Add unit tests to packages/cache-tags/src/ — the CHANGELOG.md exists but test coverage is not visible in the file list, start by creating a test file matching the package structure in packages/cache-tags/tests/
- Document the browser-types package API in packages/browser-types/README.md — README.md file exists but content is not shown; expand it with examples of how to use the exported types and what DOM APIs it polyfills
- Create a troubleshooting guide in .github/CONTRIBUTING.md for the strict version requirements (Node 22.3, Bun 1.2.15) — include common errors when versions are wrong and how to fix nvm/Bun installation
Top contributors
- @nolannbiron — 24 commits
- @SamyPesse — 22 commits
- @conico974 — 14 commits
- @zenoachtig — 13 commits
- @gregberge — 10 commits
Recent commits
927aa89— Add "Go to home" button on 404 page (#4236) (gregberge)f29d1e2— Round images when site customization border style is rounded (#4237) (gregberge)3a9efb8— bust revision page markdown (#4235) (conico974)f71ab84— Bust page document data cache (#4234) (conico974)a3d1558— Disable regional cache for debugging purposes (#4233) (conico974)ca53869— Reduce cache TTL for regional cache and log cache debug (#4232) (conico974)33598e6— Add logging for cache retrieval in GitbookIncrementalCache (#4231) (conico974)9045ba5— Remove progressive rollout for markdown stable links (#4230) (SamyPesse)7061fc2— Fix hidden pages in sitemap exports (#4216) (rodrcastro)0c9e395— Increase rollout of markdown stable links to 50% (#4228) (SamyPesse)
Security observations
The GitBook codebase shows moderate security posture with some concerns. The most critical issue is an outdated axios dependency with known vulnerabilities. Additional concerns include environment variable handling in scripts, strict version pinning that may prevent security patches, and a lack of a security policy. The monorepo structure and use of tools like Biome for code quality are positive signals. Recommend: (1) Update axios immediately, (2) Implement a security policy, (3) Review embed package for XSS vulnerabilities, (4) Audit CI/CD workflows for proper secret management, (5)
- High · Outdated axios Dependency with Known Vulnerabilities —
package.json - overrides section. The package.json overrides axios to version 1.8.4, which is significantly outdated. This version has known security vulnerabilities including prototype pollution and other issues. Current stable versions are 1.8.5+ or newer. Fix: Update axios to the latest stable version (1.8.5 or newer). Review the changelog for security patches: https://github.com/axios/axios/releases - Medium · Hardcoded Environment Variable Reference —
package.json - scripts.download:env. The script 'download:env' in package.json uses '1password' CLI (op read) to fetch .env.local credentials. While this uses a secrets manager, the command is logged in package.json and could expose the 1Password reference path (op://gitbook-x-dev/gitbook-open/.env.local) in CI/CD logs or command history. Fix: Ensure CI/CD systems have proper secret masking configured. Use environment-specific secrets in CI/CD instead of relying on local 1Password operations. Document this as a manual-only operation for developers. - Medium · Node Engine Constraint May Be Too Restrictive —
package.json - engines.node. The engines field specifies 'node': '^22.3.0', which locks to Node 22.3.0+. If using Node 22.3.0 specifically, ensure it's not a pre-release or EOL version. This can cause issues if dependencies have security patches released for older Node versions. Fix: Verify Node 22.3.0 is an LTS or stable release. Consider using a slightly more flexible range (e.g., '^22.0.0') to allow patch updates. Regularly update Node to the latest LTS version. - Medium · Excessive Package Manager Pinning —
package.json - packageManager. The package.json specifies 'bun@1.3.7' as the exact packageManager version. While pinning is good for reproducibility, it can prevent security patches from being applied if newer patch versions of bun are released. Fix: Consider using a range (e.g., 'bun@^1.3.7') to allow patch updates, or implement a process to regularly update bun versions and test for regressions. - Low · Potential XSS Risk in Embed Package —
packages/embed/src/client/. The codebase contains an 'embed' package with client-side frame creation (createGitBook.ts, createGitBookFrame.ts). If this package handles user-generated content or external data, there's a potential XSS risk if content is rendered without proper sanitization. Fix: Audit the embed package for proper input validation and sanitization. Ensure any user-generated or external content is properly escaped before rendering. Consider using a DOMPurify or similar library for HTML sanitization if needed. - Low · Missing Security Policy File —
Repository root. There is no visible SECURITY.md or security policy file in the repository. This makes it difficult for security researchers to report vulnerabilities responsibly. Fix: Create a SECURITY.md file with responsible disclosure guidelines. Include instructions for reporting security vulnerabilities and expected response timeframes. - Low · Deployment Scripts in Git History —
.github/workflows/deploy-*.yaml. GitHub Actions workflows for deployment (deploy-production.yaml, deploy-staging.yaml) may contain sensitive information in their configuration or logs if not properly configured. Fix: Audit GitHub Actions workflows for proper secret management. Ensure credentials are stored as GitHub Secrets, not in workflow files. Enable GitHub's secret scanning and code review for workflow changes.
LLM-derived; treat as a starting point, not a security audit.
Where to read next
- Open issues — current backlog
- Recent PRs — what's actively shipping
- Source on GitHub
Generated by RepoPilot. Verdict based on maintenance signals — see the live page for receipts. Re-run on a new commit to refresh.