Multilingual mirror of the official Next.js documentation, built with Astro + Starlight and deployed on Cloudflare Workers.
๐ Live site: nextjs.im
- ๐ Complete mirror of official Next.js docs (v13 / v14 / v15 / latest)
- ๐ 9 languages: English, ็ฎไฝไธญๆ, ็น้ซไธญๆ, ๆฅๆฌ่ช, ุงูุนุฑุจูุฉ, Deutsch, Espaรฑol, Franรงais, ะ ัััะบะธะน
- ๐ Incremental AST-based translation with MD5 caching (51% cross-version content dedup)
- ๐๏ธ Microfrontend architecture โ 5 Cloudflare Workers via Service Bindings
- ๐ Full-text search powered by Orama
- ๐ Blog and Learn sections synced from Next.js official site
nextjs-i18n-docs/
โโโ apps/
โ โโโ web/ # Latest docs worker (Astro + Starlight)
โ โโโ web-v/ # Versioned docs worker (v13/v14/v15)
โ โโโ router/ # Router Worker (Service Bindings + redirects)
โ โโโ index/ # Landing page
โ โโโ tampermonkey/ # Browser userscript
โโโ packages/
โ โโโ translate/ # Incremental translation pipeline
โ โโโ crawler/ # Blog & Learn content syncer
โ โโโ shared/ # Shared Astro components & plugins
โ โโโ const/ # Shared constants
โ โโโ utils/ # Shared utilities
โโโ content/ # Latest docs + blog + learn (all languages)
โโโ content-v13/ # v13 docs (all languages)
โโโ content-v14/ # v14 docs (all languages)
โโโ content-v15/ # v15 docs (all languages)
โโโ scripts/ # Build & sync scripts
โโโ .cache/ # Translation cache (JSONL, git-tracked)
| Worker | Purpose |
|---|---|
nextjs-docs-router |
Routes requests by version prefix, handles redirects |
nextjs-docs-latest |
Serves latest (v16) docs |
nextjs-docs-v13 |
Serves v13 docs |
nextjs-docs-v14 |
Serves v14 docs |
nextjs-docs-v15 |
Serves v15 docs |
- Bun
- Node.js 20+
bun install# Run all workers with router (recommended)
bun run dev:all
# Run only latest docs
bun run dev:latest
# Run only versioned docs (set VERSION env)
VERSION=15 bun run dev:v# Build all packages
bun run build:packages
# Build latest docs
bun run build:latest
# Build versioned docs
VERSION=15 bun run build:v# Lint (biome)
bun run lint
# Auto-fix lint issues
bun run lint:fix
# Format
bun run format
# Type check all non-Astro apps & packages
bun run typecheck# Deploy to Cloudflare Workers
bun run deploy:latest
VERSION=15 bun run deploy:v
bun run deploy:routerThe project includes an incremental translation pipeline (packages/translate) that:
- Normalizes MDX files (fixes JSX tag formatting for AST parsing)
- Parses files into AST nodes (paragraph, heading, code, list, etc.)
- Caches each node by MD5 hash in JSONL format โ identical content across versions is translated once
- Translates only changed nodes via LLM (OpenRouter / MiniMax / DeepSeek)
- Assembles translated nodes back into valid MDX
- Validates output (frontmatter, tag balance, remark parsability)
# Translate all files
bun run translate
# Or use the shell script with options
bash scripts/translate.sh \
--pattern "**/*.mdx" \
--concurrency 10 \
--api-type openai \
--api-base-url "https://openrouter.ai/api/v1" \
--api-key "$OPENROUTER_API_KEY" \
--model "openrouter/hunter-alpha"Cache files are stored in .cache/ (git-tracked, JSONL format):
.cache/en.jsonlโ English source node hashes (~17K entries).cache/zh-hans.jsonlโ Chinese translation cache (~6K entries)
English docs are synced from the official Next.js repo:
# Sync docs locally (resolves latest versions from git tags)
bash scripts/sync-docs-local.sh
# Full sync + translate
bash scripts/sync-and-translate.sh| Language | Code | Content Files |
|---|---|---|
| English | en |
1,488 |
| ็ฎไฝไธญๆ | zh-hans |
1,117 |
| ็น้ซไธญๆ | zh-hant |
1,117 |
| ๆฅๆฌ่ช | ja |
1,117 |
| ุงูุนุฑุจูุฉ | ar |
1,117 |
| Deutsch | de |
1,117 |
| Espaรฑol | es |
1,117 |
| Franรงais | fr |
1,117 |
| ะ ัััะบะธะน | ru |
1,117 |
The project uses a microfrontend architecture with 5 Cloudflare Workers connected via Service Bindings. Deployment is automated through Cloudflare Builds with Git integration.
โโโโโโโโโโโโโโโโโโโโโโโ
โ nextjs-docs-router โ
โ (Service Bindings) โ
โโโโโโโโฌโโโฌโโโฌโโโฌโโโโโโ
โ โ โ โ
โโโโโโโโโโโโโโโโ โ โ โโโโโโโโโโโโโโโโ
โผ โผ โผ โผ
โโโโโโโโโโโโโโโโ โโโโโโโโโโโ โโโโโโโโโโโ โโโโโโโโโโโ
โ docs-latest โ โ docs-v15โ โ docs-v14โ โ docs-v13โ
โ (Astro+SL) โ โ(Astro+SLโ โ(Astro+SLโ โ(Astro+SLโ
โโโโโโโโโโโโโโโโ โโโโโโโโโโโ โโโโโโโโโโโ โโโโโโโโโโโ
The Router Worker receives all requests and forwards them to the appropriate version worker based on URL path:
/docs/13/*โnextjs-docs-v13/docs/14/*โnextjs-docs-v14/docs/15/*โnextjs-docs-v15- Everything else โ
nextjs-docs-latest
Each worker has its own Cloudflare Build connected to this repo's main branch:
Cloudflare Builds automatically runs bun install (which triggers postinstall โ build:packages), so build commands only need the app-specific step:
| Build project | Build command | Deploy command | Watch paths (docs) |
|---|---|---|---|
nextjs-docs-latest |
bun run build:latest |
cd apps/web && npx wrangler deploy |
apps/web/*, packages/shared/*, packages/const/*, content/*, scripts/prepare-content.ts |
nextjs-docs-v13 |
VERSION=13 bun run build:v |
cd apps/web-v && npx wrangler deploy --name nextjs-docs-v13 |
apps/web-v/*, packages/shared/*, packages/const/*, content-v13/*, scripts/prepare-content.ts |
nextjs-docs-v14 |
VERSION=14 bun run build:v |
cd apps/web-v && npx wrangler deploy --name nextjs-docs-v14 |
apps/web-v/*, packages/shared/*, packages/const/*, content-v14/*, scripts/prepare-content.ts |
nextjs-docs-v15 |
VERSION=15 bun run build:v |
cd apps/web-v && npx wrangler deploy --name nextjs-docs-v15 |
apps/web-v/*, packages/shared/*, packages/const/*, content-v15/*, scripts/prepare-content.ts |
nextjs-docs-router |
cd apps/router && bun run generate-wrangler |
cd apps/router && npx wrangler deploy |
apps/router/*, .github/nextjs-versions.json |
To set up from scratch:
- Connect the repo โ In the Cloudflare dashboard, go to Workers & Pages โ Builds โ Connect and link this GitHub repo (docs)
- Create 5 Build projects โ One for each worker, with the build commands above
- Configure branch & watch paths โ Set each project to deploy from
main, and configure watch paths per the table above so only affected workers rebuild - Set
account_idโ Updateaccount_idin eachwrangler.tomlto your Cloudflare account ID - Generate router config โ Run
bun run --filter @next-i18n/router generate-wranglerto regenerateapps/router/wrangler.tomlwith correct service bindings - Custom domain (optional) โ Add a Custom Domain to the router worker
You can also deploy manually using the Wrangler CLI:
# Deploy latest docs
bun run deploy:latest
# Deploy versioned docs
VERSION=13 bun run deploy:v
VERSION=14 bun run deploy:v
VERSION=15 bun run deploy:v
# Deploy router (regenerates wrangler.toml from nextjs-versions.json)
bun run deploy:routerNote: Deploy the version workers before the router, since the router's Service Bindings reference them.
The build process for each Astro worker runs scripts/prepare-content.ts which:
- Strips numeric prefixes from directories (
01-appโapp) - Resolves
sourcereferences (Pages Router docs that share content with App Router) - Maps locale directories to Starlight's i18n structure
- Strips MDX comments
| Workflow | Trigger | Purpose |
|---|---|---|
sync-docs.yml |
Manual / Schedule | Syncs English docs from Next.js repo, creates PR |
translate-docs.yml |
Manual | Runs incremental translation pipeline on new/changed content |
submit-sitemaps.yml |
Manual | Submits sitemaps to Google Search Console |
Push to main triggers automatic Cloudflare Builds for all workers.
ISC