This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is the GenLayer documentation site built with Next.js and Nextra (a Next.js-based static site generator). The documentation covers the GenLayer protocol, intelligent contracts, decentralized applications, and API references.
pnpm i- Install dependenciespnpm dev- Start development server (runs doc generation + Next.js dev server)pnpm build- Build for production (runs doc generation + Next.js build)pnpm start- Start production serverpnpm generate-sitemap- Generate sitemap.xml
The build process includes automatic generation of:
- Full documentation concatenation (
scripts/generate-full-docs.js) - Sitemap generation (
scripts/generate-sitemap-xml.js)
- pages/: MDX documentation files organized hierarchically
- _meta.json: Navigation and ordering configuration for each directory
- components/: Reusable React components (cards, icons, social links)
- public/: Static assets including images and generated files
- scripts/: Build-time generation scripts
pages/understand-genlayer-protocol/: Protocol documentationpages/developers/intelligent-contracts/: Smart contract development guidespages/developers/decentralized-applications/: DApp development guidespages/api-references/: API documentation for various GenLayer toolspages/validators/: Validator node setup and management
Navigation is controlled by _meta.json files in each directory:
- Defines page order and titles
- Supports external links with
hrefandnewWindowproperties - Enables nested navigation structures
- theme.config.tsx: Site-wide configuration including logos, social links, SEO
- next.config.js: Next.js configuration with extensive redirect rules for URL migrations
- Uses
nextra-theme-docswith custom styling
generate-full-docs.jsparses all MDX files and creates concatenated documentation- Next.js builds the static site with Nextra theme
generate-sitemap-xml.jscreates SEO sitemap from all MDX files
- All content is in MDX format supporting React components
- Images stored in
/public/directory - Redirects managed in
next.config.jsfor URL structure changes - LaTeX support enabled in Nextra config
- Create
.mdxfile in appropriatepages/subdirectory - Update corresponding
_meta.jsonto include the new page - Add any required images to
/public/
- Edit
_meta.jsonfiles to change page ordering or titles - Use
theme.config.tsxfor top-level navigation changes
- Add redirects to
next.config.jsto maintain SEO and user experience - Test both
previousRedirectsandactualRedirectsarrays
- Custom components go in
/components/directory - Import and use within MDX files
- Follow existing patterns for icons and cards
When updating validator documentation for new releases:
-
Changelog Updates (
pages/validators/changelog.mdx):- Add new version entries at the top in reverse chronological order
- Use consistent format:
# v0.x.x,## New features,## Bug fixes,## Misc - Include missing intermediate versions if needed
-
Setup Guide Updates (
pages/validators/setup-guide.mdx):- Update version references in download examples and version lists
- Update configuration examples with new contract addresses when applicable
- Enhance command documentation when new features are added to existing commands
- Update genesis block configuration in consensus section when network upgrades occur
Key locations that need updates for new validator releases:
- Line ~88: Version list in curl command output example
- Line ~113: Download command version variable (
export version=v0.x.x) - Lines ~143-146: Consensus contract addresses and genesis block number
- Line ~347: Command documentation (e.g.,
doctorcommand enhancements)
- Consensus contract addresses change with network upgrades
- Genesis block numbers are specified for faster node startup (optional but recommended)
- GenVM diagnostics integration affects the
doctorcommand behavior
qmd is recommended for fast navigation of this documentation codebase. It provides BM25 + vector semantic search + LLM re-ranking over all indexed MDX files.
npm install -g @tobilu/qmd
# From the repo root:
qmd collection add pages/ --mask '**/*.mdx' --name docs
qmd embed # generates vector embeddings (one-time, ~1 min)qmd search "equivalence principle" # BM25 keyword search
qmd query "how does consensus work" # hybrid search with reranking
qmd get docs/path/to/file.mdx # show a specific documentThis documentation covers:
- Intelligent Contracts: AI-powered smart contracts with LLM integration
- Optimistic Democracy: GenLayer's consensus mechanism
- GenVM: Virtual machine supporting non-deterministic operations
- Development Tools: CLI, Studio, JS/Python SDKs
- Validator Operations: Node setup and management
The project emphasizes the unique aspects of GenLayer as an "Intelligent Blockchain" that enables contracts to access the internet and make subjective decisions beyond traditional deterministic logic.