This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Simple Knowledge Base is a full-stack RAG (Retrieval-Augmented Generation) Q&A system built with React 19 + NestJS. It's a monorepo with Japanese/Chinese documentation but English code.
Key Features:
# Install dependencies
yarn install
# Start infrastructure services
docker-compose up -d elasticsearch tika libreoffice
# Configure environment
cp server/.env.sample server/.env
# Edit server/.env with API keys and configuration
# Start both frontend and backend in development mode
yarn dev
# Frontend only (port 13001)
cd web && yarn dev
# Backend only (port 3001)
cd server && yarn start:dev
# Run tests
cd server && yarn test
cd server && yarn test:e2e
# Lint and format
cd server && yarn lint
cd server && yarn format
simple-kb/
├── web/ # React frontend (Vite)
│ ├── components/ # UI components (ChatInterface, ConfigPanel, etc.)
│ ├── contexts/ # React Context providers
│ ├── services/ # API client services
│ └── utils/ # Utility functions
├── server/ # NestJS backend
│ ├── src/
│ │ ├── ai/ # AI services (embedding, etc.)
│ │ ├── api/ # API module
│ │ ├── auth/ # JWT authentication
│ │ ├── chat/ # Chat/RAG module
│ │ ├── elasticsearch/ # Elasticsearch integration
│ │ ├── import-task/ # Import task management
│ │ ├── knowledge-base/# Knowledge base management
│ │ ├── libreoffice/ # LibreOffice integration
│ │ ├── model-config/ # Model configuration management
│ │ ├── vision/ # Vision model integration
│ │ └── vision-pipeline/# Vision pipeline orchestration
│ ├── data/ # SQLite database storage
│ ├── uploads/ # Uploaded files storage
│ └── temp/ # Temporary files
├── docs/ # Comprehensive documentation (Japanese/Chinese)
├── nginx/ # Nginx configuration
├── libreoffice-server/ # LibreOffice conversion service (Python/FastAPI)
└── docker-compose.yml # Docker orchestration
Dual Processing Modes:
Multi-Model Support:
RAG System:
cd server && yarn test or yarn test:e2ecd server && yarn formatcd server && yarn lintserver/src/*.spec.ts filesweb/components/web/types.tsweb/services/curl http://localhost:9200/_cat/indicescurl http://localhost:9998/tikacurl http://localhost:8100/healthKey environment variables (server/.env):
OPENAI_API_KEY: OpenAI-compatible API keyGEMINI_API_KEY: Google Gemini API keyELASTICSEARCH_HOST: Elasticsearch URL (default: http://localhost:9200)TIKA_HOST: Apache Tika URL (default: http://localhost:9998)LIBREOFFICE_URL: LibreOffice server URL (default: http://localhost:8100)JWT_SECRET: JWT signing secretdocker-compose up -d elasticsearch tika libreoffice
yarn dev
docker-compose up -d # Builds and starts all services
uploads/ and temp/ directories exist with proper permissionsserver/.envserver/data/metadata.dbserver/data/metadata.db and Elasticsearch data volumeWhen modifying code, always add English comments and logs as required by development standards. Error and UI messages must be properly internationalized. The project has extensive existing documentation in Japanese/Chinese - refer to docs/ directory for detailed technical information.