Beacon is a self-contained static-site generator for docs, tutorials, and product content, built on Next.js. Write pages in Markdown/MDX, configure the sidebar in one file, and get a plain static site with client-side search, syntax highlighting, and dark mode. No server, no vendor lock-in.
- Markdown/MDX content - pages live in
content/docs/*.mdxwith simple frontmatter, rendered withnext-mdx-remote. - Config-driven sidebar -
content/nav.config.tsis the single source of truth for structure and ordering. A broken nav link fails the build instead of shipping a 404. - Client-side search -
Cmd/Ctrl+Kopens a fuzzy search (viafuse.js) over a search index generated at build/request time. No external search service. - Syntax highlighting - code blocks are highlighted at build time with Shiki (
rehype-pretty-code), so highlighting doesn't depend on client-side JavaScript, and it follows the site's theme toggle rather than the OS setting. - Dark mode - a toggle in the top bar, persisted to
localStorage. - Plain static output -
npm run buildproduces a staticout/directory: host it on Vercel, Netlify, GitHub Pages, or any static file host. - Editor - a live Markdown editor with instant preview, included as one of the site's pages.
npm install
npm run devOpen http://localhost:3000.
- Create
content/docs/your-page.mdxwith frontmatter:--- title: Your Page description: A short description for meta tags and search. --- Your content here.
- Add it to
content/nav.config.ts:{ title: "Your Page", href: "/your-page" }
The page is picked up by the catch-all route, included in search, and added to the sitemap automatically on the next build.
content/docs/- MDX content pages.content/nav.config.ts- sidebar structure.src/lib/content.ts- content loading, nav validation, and search-index generation, shared by the pages and the search route.src/app/(site)/- the docs shell (layout, sidebar, top bar) and routes:page.tsx(home/introduction),[...slug]/page.tsx(catch-all for other docs),editor/page.tsx(the live editor),not-found.tsx.src/app/search-index.json/route.ts- static route handler serving the search index.src/components/docs/-Sidebar,TopBar,SearchDialog,ThemeToggle,Mdx(the MDX compiler/renderer).src/components/MarkdownWorkspace.tsx- the Editor's live preview component.e2e/- Playwright end-to-end tests.
npx playwright install chromium # one-time browser download
npm run test:e2eRuns the Playwright suite in e2e/ against a dev server it starts automatically.
npm run buildOutputs a static site to out/. Preview exactly what will be deployed, with no Next.js server involved:
npm run startConnect the repository and deploy with the default settings - Vercel detects the static export automatically.
netlify.toml is already set up (command = "npm run build", publish = "out"). Connect the repository and deploy.
- Set the base path at build time if deploying under a subpath (
username.github.io/repo-name):NEXT_PUBLIC_BASE_PATH=/repo-name npm run build
public/.nojekyllis already included so GitHub Pages serves the_next/asset directory correctly.- A ready-to-use workflow is included at
.github/workflows/deploy-gh-pages.yml- it builds and deploysout/on every push tomain. Enable it by setting the repository's Pages source to "GitHub Actions" (Settings → Pages).
Upload the contents of out/ - it's plain HTML/CSS/JS with no server-side requirements.
NEXT_PUBLIC_BASE_PATH- subpath the site is served from (e.g./repo-namefor GitHub Pages). Leave unset for root-domain hosts like Vercel/Netlify.NEXT_PUBLIC_SITE_URL- the site's full public URL, used insitemap.xmlandrobots.txt.