A RAG (Retrieval-Augmented Generation) knowledge base backend system built with the NestJS framework. Provides file parsing, vector indexing, hybrid search, and multi-model management features.
Before running the project, ensure you have the following environment set up:
Use the docker-compose.yml file in the project root (simple-kb/) to quickly start Elasticsearch and Tika.
# Run from project root directory
docker-compose up -d
After successful startup:
19200 (maps container's 9200 port)9998Navigate to the server directory and install packages:
cd server
yarn install
The project uses environment variables for configuration. Make sure the settings are correct (especially Elasticsearch address):
# Database path
DATABASE_PATH=server/data/metadata.db
# JWT secret
JWT_SECRET=your_secure_secret
# Elasticsearch settings (match docker-compose ports)
ELASTICSEARCH_HOST=http://localhost:19200
ELASTICSEARCH_INDEX=knowledge_base
# Tika settings
TIKA_HOST=http://localhost:9998
# File upload storage path
UPLOAD_FILE_PATH=./uploads
# Development mode (recommended, with hot reload)
yarn run start:dev
# Build and run in production mode
yarn build
yarn run start:prod
The backend service runs on http://localhost:13000 by default, with API prefix /api.
# Unit tests
yarn run test
# E2E tests
yarn run test:e2e
Database Initialization:
metadata.db (or configured DB) under the server/data/ directory.synchronize: true, table structures are auto-synced.Elasticsearch Connection:
Connection refused error, check if Docker containers are running properly (docker ps).knowledge_base is automatically detected and created.Default Account:
File Parsing: