Skip to content

Latest commit

 

History

History

docsite

README.md

env docsite

The Fumadocs-powered docs for @variablelab/env, published at lab.variable.land/env/docs.

Built with TanStack Start + Fumadocs + Tailwind v4, deployed to Cloudflare Workers via Wrangler.

Layout

Path Purpose
content/docs/ MDX content — getting-started/, concepts/, guides/, api-reference/
src/routes/ TanStack Router routes — docs viewer, llms.txt / llms-full.txt endpoints
src/components/ MDX overrides, the page actions, env's Sign, the Signature, the Zod icon
src/lib/ Fumadocs source adapter (source.ts), shared layout, llms-text builder
src/server.ts Workers entry — wraps the TanStack Start handler; rewrites *.mdx and Accept: text/markdown requests to the /raw/* route
public/ Static assets — fonts, favicons and app icons drawn from the Sign, manifest
source.config.ts Fumadocs MDX config (Shiki themes, processed-markdown for /llms-full.txt)
wrangler.jsonc Cloudflare Workers config — main and the lab.variable.land/env/* route

Running

From the repo root (after mise install && mise run setup — see development.md):

mise run docsite     # alias for `pnpm --filter=docsite dev`

Or directly inside this workspace:

pnpm dev             # local dev server
pnpm build           # production build (Vite + Cloudflare adapter)
pnpm preview         # preview the built bundle
pnpm run deploy      # build + wrangler deploy

docsite/ lives in the small pnpm workspace alongside package/. It is not runtime-isolated like the examples/ — those each declare their own runtime via mise and use a packed tarball of @variablelab/env.

Deploying

Workers Builds deploys the variablelab-env Worker on every merge to main; preview builds are off. Its settings live in the Cloudflare dashboard (Workers & Pages → variablelab-env → Settings → Build), not in this repo:

Setting Value
Root directory /docsite
Build command pnpm build
Deploy command npx wrangler deploy (the default)
Build watch paths docsite/**, pnpm-lock.yaml

All commands run inside docsite/, so they use its pinned wrangler. pnpm run deploy is the manual equivalent.

Notes

  • postinstall runs fumadocs-mdx to generate .source/ (Fumadocs' MDX index). Commit-ignored.
  • llms.txt and llms-full.txt are emitted from src/routes/llms[.]txt.ts and src/routes/llms-full[.]txt.ts so LLM agents can ingest the full docs corpus.
  • src/server.ts makes raw MDX addressable two ways: append .mdx to any /docs/* URL, or send Accept: text/markdown. Both are rewritten to the internal /raw/* route (TanStack Router can't express splat-plus-.mdx natively, so the rewrite lives at the Worker edge).
  • The site lives under /env/ on lab.variable.land (pnpm dev / pnpm preview too); see base in vite.config.ts and src/lib/base-path.ts. /env itself is env's Project page, served by Variable Lab's site. src/server.ts 301s /env/ and the root of the old env.oss.variable.land host to it, and the old host's other paths under /env/.