| 
 | 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 requirements  | 
 | 6 | +To develop WhoDB, follow the below requirements every time you do a task:  | 
 | 7 | +1. Clean code is paramount—make sure it is easy to understand and follow  | 
 | 8 | +2. Do not overengineer if you can help it—only add what is required.  | 
 | 9 | +3. Do not remove or modify existing functionally UNLESS you have to and UNLESS you can justify it.  | 
 | 10 | +4. Do not change existing variable names UNLESS absolutely necessary.  | 
 | 11 | +5. Do not leave unused code lying around.  | 
 | 12 | +6. Ask as many questions as you have to in order to understand your task.  | 
 | 13 | +7. You MUST use multiple subagents wherever possible to help you accomplish your task faster.  | 
 | 14 | + | 
 | 15 | +## Build & Development Commands  | 
 | 16 | + | 
 | 17 | +### Community Edition (CE)  | 
 | 18 | +```bash  | 
 | 19 | +./build.sh                    # Full build (frontend + backend)  | 
 | 20 | +./run.sh                      # Run the application  | 
 | 21 | +./dev.sh                      # Development mode with hot-reload  | 
 | 22 | +```  | 
 | 23 | + | 
 | 24 | +### Enterprise Edition (EE)  | 
 | 25 | +```bash  | 
 | 26 | +./build.sh --ee               # Full EE build  | 
 | 27 | +./run.sh --ee                 # Run EE application  | 
 | 28 | +./dev.sh --ee                 # EE development with hot-reload  | 
 | 29 | +```  | 
 | 30 | + | 
 | 31 | +### Testing  | 
 | 32 | +```bash  | 
 | 33 | +# Backend tests  | 
 | 34 | +cd core && go test ./... -cover  | 
 | 35 | + | 
 | 36 | +# Frontend E2E tests  | 
 | 37 | +cd frontend  | 
 | 38 | +npm run cypress:ce            # CE tests  | 
 | 39 | +npm run cypress:ee            # EE tests  | 
 | 40 | +```  | 
 | 41 | + | 
 | 42 | +### GraphQL Code Generation  | 
 | 43 | +```bash  | 
 | 44 | +# Backend (from core/)  | 
 | 45 | +go run github.com/99designs/gqlgen generate  | 
 | 46 | + | 
 | 47 | +# Frontend (from frontend/)  | 
 | 48 | +npm run generate              # Generates TypeScript types from GraphQL  | 
 | 49 | +```  | 
 | 50 | + | 
 | 51 | +## Architecture Overview  | 
 | 52 | + | 
 | 53 | +WhoDB is a database management tool with a **dual-edition architecture**:  | 
 | 54 | +- **Community Edition (CE)**: Open source core features  | 
 | 55 | +- **Enterprise Edition (EE)**: Extended features without modifying CE code  | 
 | 56 | + | 
 | 57 | +### Backend Structure (Go)  | 
 | 58 | +- **Location**: `/core/`  | 
 | 59 | +- **Main Entry**: `core/src/main.go`  | 
 | 60 | +- **Plugin System**: Database connectors in `core/src/plugins/`  | 
 | 61 | +- **GraphQL API**: Single endpoint at `/graphql` defined in `core/graph/schema.graphqls`  | 
 | 62 | +- **EE Extensions**: Separate modules in `ee/core` that register additional plugins  | 
 | 63 | + | 
 | 64 | +### Frontend Structure (React/TypeScript)  | 
 | 65 | +- **Location**: `/frontend/`  | 
 | 66 | +- **Main Entry**: `frontend/src/index.tsx`  | 
 | 67 | +- **State Management**: Redux Toolkit in `frontend/src/store/`  | 
 | 68 | +- **GraphQL Client**: Apollo Client with generated types  | 
 | 69 | +- **EE Components**: Conditionally loaded from `ee/frontend/`  | 
 | 70 | + | 
 | 71 | +### Key Architectural Patterns  | 
 | 72 | + | 
 | 73 | +1. **Plugin-Based Database Support**  | 
 | 74 | +   - Each database type implements the Plugin interface  | 
 | 75 | +   - Plugins register themselves with the engine  | 
 | 76 | +   - GraphQL resolvers dispatch to appropriate plugin  | 
 | 77 | + | 
 | 78 | +2. **Unified GraphQL API**  | 
 | 79 | +   - All database operations go through a single GraphQL schema  | 
 | 80 | +   - Database-agnostic queries that work across all supported databases  | 
 | 81 | +   - Type safety through code generation  | 
 | 82 | + | 
 | 83 | +3. **AI Integration**  | 
 | 84 | +   - Multiple LLM providers (Ollama, OpenAI, Anthropic)  | 
 | 85 | +   - Natural language to SQL conversion  | 
 | 86 | +   - Schema-aware query generation  | 
 | 87 | + | 
 | 88 | +4. **Embedded Frontend**  | 
 | 89 | +   - Go embeds the React build using `//go:embed`  | 
 | 90 | +   - Single binary deployment  | 
 | 91 | +   - Development mode runs separate servers  | 
 | 92 | + | 
 | 93 | +## Important Development Notes  | 
 | 94 | + | 
 | 95 | +1. **Adding New Database Support**  | 
 | 96 | +   - Create plugin in `core/src/plugins/`  | 
 | 97 | +   - Implement the Plugin interface methods  | 
 | 98 | +   - Register in `core/src/engine/registry.go`  | 
 | 99 | +   - For EE: Add to `ee/core/`  | 
 | 100 | + | 
 | 101 | +2. **GraphQL Changes**  | 
 | 102 | +   - Modify schema in `core/graph/schema.graphqls` (CE) or `core/ee/graph/schema.graphqls` (EE)  | 
 | 103 | +   - Run code generation for both backend and frontend  | 
 | 104 | +   - Update resolvers in `core/graph/`  | 
 | 105 | + | 
 | 106 | +3. **Frontend Feature Development**  | 
 | 107 | +   - CE features go in `frontend/src/`  | 
 | 108 | +   - EE features go in `ee/frontend/`  | 
 | 109 | +   - Use feature flags for conditional rendering  | 
 | 110 | +   - Follow existing Redux patterns for state management  | 
 | 111 | + | 
 | 112 | +4. **Environment Variables**  | 
 | 113 | +   - `OPENAI_API_KEY`: For ChatGPT integration  | 
 | 114 | +   - `ANTHROPIC_API_KEY`: For Claude integration  | 
 | 115 | +   - `OLLAMA_URL`: For local Ollama server  | 
 | 116 | + | 
 | 117 | +5. **Docker Development**  | 
 | 118 | +   - Multi-stage build optimizes image size  | 
 | 119 | +   - Supports AMD64  | 
 | 120 | +   - Uses Alpine Linux for minimal runtime  | 
0 commit comments