docs/README.md
This documentation site uses Typesense for fast, typo-tolerant search across all documentation pages.
pnpm install
# Create .env file
cd docs
cp .env.example .env
Edit docs/.env and add your Typesense admin API key:
TYPESENSE_ADMIN_API_KEY=your_admin_key_here
Note: The search-only API key (zsQzkAsJQkHdtXxra3IzxOuhxEA4J8Qj) is hardcoded in SearchBar.tsx. This is intentional and safe - it only allows searching, not modifications.
# Build the Typesense index
bazel build //docs:typesense_index
# Upload to Typesense Cloud
bazel run //docs:upload_typesense_index_tool -- \
--file=$(bazel info bazel-bin)/docs/typesense-index.jsonl
# Start dev server (search key already hardcoded)
bazel run //docs:serve
# Open http://localhost:5173
# Press Cmd+K (Mac) or Ctrl+K (Windows/Linux) to test search
Add the TYPESENSE_ADMIN_API_KEY secret to your GitHub repository:
TYPESENSE_ADMIN_API_KEYThe workflow will automatically update the index when docs are changed.
Index Builder (scripts/build-typesense-index.ts)
src/docs/Index Uploader (scripts/upload-typesense-index.ts)
6e4uts1pzdy7wm3fp)docs collectionSearch UI (src/components/SearchBar.tsx)
Each document in Typesense has the following fields:
{
// Core fields
title: string // Document title (includes heading: "Doc Title > Heading")
content: string // Plain text content for this section
url: string // Full URL to the document/section (with anchor)
// Metadata fields
section: string // Top-level section (e.g., "getting-started", "react-intl")
page_title: string // Document title without heading
doc_type: string // "guide", "api", "reference", or "example"
tags: string[] // Extracted keywords (e.g., ["react", "hooks", "i18n"])
heading_level?: number // 1-6 for h1-h6 (optional, only for sections)
}
Note: Each heading section in a document becomes a separate searchable entry. The title field contains both the document title and heading (e.g., "React Intl > Installation") for better search context.
title,tags,page_title,contentsection and doc_type (for filtering)Enhanced Discovery:
Visual Indicators:
When adding new MDX pages to src/docs/, you must also:
src/utils/navigation.tsbazel run //docs:docs_metadatadocs/
├── scripts/
│ ├── build-typesense-index.ts # Index generator
│ └── upload-typesense-index.ts # Index uploader
├── src/
│ ├── components/
│ │ └── SearchBar.tsx # Typesense search UI
│ ├── utils/
│ │ └── navigation.ts # Sidebar navigation tree
│ └── docs/ # MDX documentation files
├── .env.example # Environment variable template
├── .env # Your keys (gitignored)
├── BUILD.bazel # Bazel build configuration
└── README.md # This file
.github/
└── workflows/
└── typesense-index.yml # Auto-update workflow
# Build the JSONL index file
bazel build //docs:typesense_index
# Upload index to Typesense Cloud
bazel run //docs:upload_typesense_index_tool
# Build tools (used internally)
bazel build //docs:build_typesense_index_tool
bazel build //docs:upload_typesense_index_tool
# Dev server
bazel run //docs:serve
# Build production site
bazel build //docs:dist
bazel build //docs:typesense_index && \
bazel run //docs:upload_typesense_index_tool -- \
--file=$(bazel info bazel-bin)/docs/typesense-index.jsonl
export TYPESENSE_ADMIN_API_KEY=your_admin_key
node docs/scripts/upload-typesense-index.ts \
--file=bazel-bin/docs/typesense-index.jsonl
# View generated JSONL
cat bazel-bin/docs/typesense-index.jsonl | jq '.'
# Count documents
wc -l bazel-bin/docs/typesense-index.jsonl
# Test connection
curl -H "X-TYPESENSE-API-KEY: $TYPESENSE_ADMIN_API_KEY" \
"https://6e4uts1pzdy7wm3fp.a1.typesense.net/health"
# View collection info
curl -H "X-TYPESENSE-API-KEY: $TYPESENSE_ADMIN_API_KEY" \
"https://6e4uts1pzdy7wm3fp.a1.typesense.net/collections/docs"
All settings including the search-only API key are hardcoded in SearchBar.tsx:
6e4uts1pzdy7wm3fp.a1.typesense.net443httpszsQzkAsJQkHdtXxra3IzxOuhxEA4J8Qj (search-only, safe to expose)No environment variables needed for the frontend.
docs/.env or CI)TYPESENSE_ADMIN_API_KEY=xxx # Admin key (keep secret!)
Optional overrides (defaults are fine):
TYPESENSE_HOST=6e4uts1pzdy7wm3fp-1.a1.typesense.net
TYPESENSE_PORT=443
TYPESENSE_PROTOCOL=https
The index automatically updates when:
docs/src/docs/**/*.mdx)See .github/workflows/typesense-index.yml for details.
This documentation site uses Typesense for search - a fast, typo-tolerant, server-side search engine.
Cluster Configuration:
6e4uts1pzdy7wm3fpdocsDashboard: https://cloud.typesense.org/
# If dependencies are missing
pnpm install
# Check Bazel targets
bazel query //docs:all
"TYPESENSE_ADMIN_API_KEY environment variable is required"
.env file exists with TYPESENSE_ADMIN_API_KEY setexport TYPESENSE_ADMIN_API_KEY=your_key"Collection not found"
"Invalid API key"
No results showing
Search not working at all
Workflow fails on "Upload to Typesense" step
TYPESENSE_ADMIN_API_KEY secret is set in GitHubThe index is only updated when documentation changes. To force an update:
# Rebuild and upload
bazel build //docs:typesense_index && \
bazel run //docs:upload_typesense_index_tool -- \
--file=$(bazel info bazel-bin)/docs/typesense-index.jsonl
Or trigger the GitHub Actions workflow manually.
6e4uts1pzdy7wm3fp)TYPESENSE_ADMIN_API_KEY (keep secret!)zsQzkAsJQkHdtXxra3IzxOuhxEA4J8QjFor issues with: