This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is the MongoDB Knowledge Service/Chatbot monorepo, managed with Lerna in independent mode. The project provides AI-powered chatbot functionality for MongoDB documentation and services.
Key Architecture:
- Monorepo with TypeScript packages managed by Lerna
- RAG (Retrieval-Augmented Generation) system for document search
- React UI components with Express.js backend
- MongoDB Atlas for vector storage and search
- OpenAI/LLM integration for chat responses
# Initial setup
npm install
npm run bootstrap
# Start development servers (server + UI with hot reload)
npm run dev
# Individual development servers
npm run dev:server # chatbot-server-mongodb-public only
npm run dev:ui # mongodb-chatbot-ui only# Build all packages
npm run build
# Build specific packages
npm run build -- --scope='{mongodb-rag-core,chatbot-server-mongodb-public}'
# Build mongodb-rag-core first (required dependency for most packages)
cd packages/mongodb-rag-core && npm run build# Run all tests
npm run test
# Lint all packages
npm run lint
npm run lint:fix
# Individual package testing
cd packages/<package-name> && npm test# Analysis scripts
npm run scripts:analyzeMessages
npm run scripts:findFaq
npm run scripts:getConversationText
# Database management
npm run scripts:removeTestDatabases
# Server management
npm run server:start- mongodb-rag-core: Shared utilities, types, and functions. Must be built first.
- mongodb-rag-ingest: CLI for ingesting documents into vector store
- mongodb-chatbot-server: Generic Express.js chatbot server
- mongodb-chatbot-ui: React UI components (built with Leafygreen/Vite)
- ingest-mongodb-public: MongoDB-specific ingestion service
- chatbot-server-mongodb-public: MongoDB-specific server implementation
- mongodb-artifact-generator: CLI for generating docs and code examples
- scripts: Miscellaneous utility scripts
- benchmarks: Performance evaluation and testing
- datasets: Data management for training/evaluation
- Environment Setup: Each package requires
.envfile (see.env.example) - Build Dependencies: Always build
mongodb-rag-corefirst - Network Access: MongoDB corporate network/VPN required for many services
- Testing: Run tests locally before committing
- Branches: Use Jira ticket names (e.g.,
DOCSP-1234) or descriptive names
- Dependency Chain: Most packages depend on
mongodb-rag-core - Vector Search: Uses MongoDB Atlas Vector Search for document retrieval
- LLM Integration: OpenAI API integration with custom prompts and tools
- Evaluation: Braintrust integration for benchmarking and evaluation
- CI/CD: Drone pipeline with Kubernetes/Kanopy deployment
- Unit tests with Jest in individual packages
- Integration tests for chatbot functionality
- Performance testing with k6 framework
- Use
braintrustlibrary imported frommongodb-rag-core/braintrust - Evalutions using files named
*.eval.ts - Evaluation pipelines for conversation quality
- Build
mongodb-rag-coreafter any changes to it - Ensure VPN connection for MongoDB services
- Check
.envfiles match.env.examplerequirements - Run
npm run bootstrapafter dependency changes