|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Development Commands |
| 6 | + |
| 7 | +This is a Docusaurus-based documentation site for QuestDB. Key commands: |
| 8 | + |
| 9 | +### Local Development |
| 10 | +- `yarn start` - Start development server on port 3001 |
| 11 | +- `yarn build` - Build production version |
| 12 | +- `yarn serve` - Serve built site locally |
| 13 | + |
| 14 | +### Prerequisites |
| 15 | +- Node.js and Yarn package manager |
| 16 | +- Java (for railroad diagram generation) |
| 17 | +- Python (for railroad diagram scripts) |
| 18 | + |
| 19 | +## Architecture Overview |
| 20 | + |
| 21 | +### Documentation Structure |
| 22 | +- **Source**: Content lives in `/documentation/` directory |
| 23 | +- **Static Assets**: Images, diagrams, and files in `/static/` |
| 24 | +- **Components**: React components for documentation in `/src/components/` |
| 25 | +- **Themes**: Custom Docusaurus theme overrides in `/src/theme/` |
| 26 | + |
| 27 | +### Key Directories |
| 28 | +- `documentation/` - Main documentation content (markdown/MDX files) |
| 29 | +- `documentation/reference/` - API and SQL reference documentation |
| 30 | +- `documentation/guides/` - User guides and tutorials |
| 31 | +- `documentation/concept/` - Conceptual documentation |
| 32 | +- `static/images/` - Documentation images and diagrams |
| 33 | +- `src/components/` - Custom React components for docs |
| 34 | +- `plugins/` - Custom Docusaurus plugins |
| 35 | + |
| 36 | +### Content Organization |
| 37 | +- Documentation uses hierarchical structure with sidebars defined in `documentation/sidebars.js` |
| 38 | +- Supports both `.md` and `.mdx` files |
| 39 | +- Partial files (`.partial.mdx`) are excluded from routing but can be imported |
| 40 | +- Math expressions supported via KaTeX |
| 41 | +- Mermaid diagrams supported |
| 42 | + |
| 43 | +## Documentation Features |
| 44 | + |
| 45 | +### Special Syntax |
| 46 | +- **QuestDB SQL**: Use `questdb-sql` language identifier for syntax highlighting |
| 47 | +- **Railroad Diagrams**: SQL syntax diagrams generated via `scripts/railroad.py` |
| 48 | +- **Math**: LaTeX-style math between `$` (inline) or `$$` (block) |
| 49 | +- **Admonitions**: `:::note`, `:::tip`, `:::info`, `:::warning`, `:::danger` |
| 50 | + |
| 51 | +### Custom Components |
| 52 | +- `<RemoteRepoExample />` - Include code from other QuestDB repositories |
| 53 | +- `<TabItem />` and `<Tabs />` - Tabbed content sections |
| 54 | +- Various custom theme components in `src/theme/` |
| 55 | + |
| 56 | +### Image Optimization |
| 57 | +- Lint-staged hook optimizes images automatically |
| 58 | +- WebP conversion supported via `scripts/webp-converter.sh` |
| 59 | +- Size checking via `scripts/check-size-hook.sh` |
| 60 | + |
| 61 | +## Development Workflow |
| 62 | + |
| 63 | +### Creating Railroad Diagrams |
| 64 | +1. Use [Railroad online editor](https://www.bottlecaps.de/rr/ui) to design |
| 65 | +2. Save syntax to `static/images/docs/diagrams/.railroad` |
| 66 | +3. Run `python3 scripts/railroad.py [name]` to generate SVG |
| 67 | +4. Include generated markdown in documentation |
| 68 | + |
| 69 | +### Content Guidelines |
| 70 | +- Follow existing file naming conventions |
| 71 | +- Use proper admonitions for important information |
| 72 | +- Include code examples with appropriate language identifiers |
| 73 | +- Optimize images before committing (handled automatically by hooks) |
| 74 | + |
| 75 | +### Linting and Formatting |
| 76 | +- ESLint and Prettier configured for code quality |
| 77 | +- JavaScript Standard Style rules enforced |
| 78 | +- Format on save recommended in editor |
| 79 | +- Webpack handles linting during development |
| 80 | + |
| 81 | +## Configuration |
| 82 | + |
| 83 | +### Key Config Files |
| 84 | +- `docusaurus.config.js` - Main Docusaurus configuration |
| 85 | +- `documentation/sidebars.js` - Documentation navigation structure |
| 86 | +- `package.json` - Dependencies and scripts |
| 87 | +- `tailwind.config.js` - Tailwind CSS configuration |
| 88 | + |
| 89 | +### Environment Variables |
| 90 | +- `ALGOLIA_APP_ID` and `ALGOLIA_API_KEY` - Search functionality |
| 91 | +- `NETLIFY` and `CONTEXT` - Build environment detection |
| 92 | + |
| 93 | +## Testing and Deployment |
| 94 | +- Production builds minify CSS and disable update notifiers |
| 95 | +- Preview builds use relaxed error handling |
| 96 | +- Algolia search integration for documentation search |
| 97 | +- PWA support configured with custom manifest |
0 commit comments