This file provides guidance for AI agents working 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 all dependencies
yarn install
# Start both frontend and backend in dev mode
yarn dev
cd server
# Build
yarn build
# Development server (watch mode)
yarn start:dev
# Format code
yarn format
# Lint code
yarn lint
cd web
# Development server
yarn dev
# Build for production
yarn build
cd server
# Run all tests
yarn test
# Run tests in watch mode
yarn test:watch
# Run with coverage report
yarn test:cov
# Run single test file by name pattern
yarn test --testPathPattern=<test-name>
# Run single test by exact path
yarn test --testPathPattern=path/to/file.spec.ts
# Run e2e tests
yarn test:e2e
# Debug tests
yarn test:debug
Examples of running single tests:
# Run only auth service tests
yarn test --testPathPattern=auth.service.spec
# Run tests in specific file
yarn test src/chat/chat.service.spec.ts
# Run tests matching a pattern
yarn test --testPathPattern="user.*service"
Note: Frontend currently has no test framework configured.
any types, use explicit typingcamelCase (e.g., getUserData, processDocument)PascalCase (e.g., UserService, UserDto)SCREAMING_SNAKE_CASE (e.g., MAX_FILE_SIZE, DEFAULT_TIMEOUT)_privateMethod)try {
// Operation logic
} catch (error) {
this.logger.error('Operation failed', error);
throw new Error(this.i18n.t('errors.operationFailed'));
}
*.spec.ts in same directory as source{serviceName}.spec.ts or {controllerName}.e2e-spec.tsauraAuraK/
├── web/ # React frontend (Vite)
│ ├── components/ # UI components
│ ├── 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/ # Documentation (Japanese/Chinese)
├── nginx/ # Nginx configuration
├── libreoffice-server/ # LibreOffice conversion service (Python/FastAPI)
└── docker-compose.yml # Docker orchestration
See CLAUDE.md for comprehensive project documentation and docs/DEVELOPMENT_STANDARDS.md for detailed coding standards.