# Start all services
docker-compose up -d
# Run database migrations
docker-compose exec api alembic upgrade head
# Access services
# API Docs: http://localhost:8000/docs
# Health Check: http://localhost:8000/health
# Metrics: http://localhost:8000/metricsNote: The API container may take 30-60 seconds to start while AI models load.
- Python 3.11+
- Node.js 18+
- Docker & Docker Compose
- Git
cd backend
# Create virtual environment
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Start PostgreSQL & Redis
docker-compose up -d postgres redis
# Wait for services to be healthy (about 10 seconds)
# Run database migrations
alembic upgrade head
# Start API server
uvicorn app.main:app --reloadThe API will be available at: http://localhost:8000
cd frontend
# Install dependencies
npm install
# Start development server
npm run devThe frontend will be available at: http://localhost:8080
cd backend
source venv/bin/activate # Windows: venv\Scripts\activate
# Start Celery worker
celery -A celery_worker worker --loglevel=infoVia API:
curl -X POST http://localhost:8000/api/v1/auth/register \
-H "Content-Type: application/json" \
-d '{
"email": "user@example.com",
"name": "John Doe",
"password": "securepassword",
"tenant_name": "My Workspace"
}'Via Frontend:
- Navigate to http://localhost:8080
- Click "Register"
- Fill in email, name, password, and workspace name
- Submit form
Via API:
curl -X POST http://localhost:8000/api/v1/auth/login \
-H "Content-Type: application/json" \
-d '{
"email": "user@example.com",
"password": "securepassword"
}'Save the access_token from the response.
Via Frontend:
- Navigate to http://localhost:8080/login
- Enter email and password
- Submit form (you'll be redirected to dashboard)
Via API:
curl -X POST http://localhost:8000/api/v1/ingestion/upload \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-F "file=@/path/to/document.pdf"Via Frontend:
- Navigate to "Documents" page
- Click "Choose File" and select a PDF, TXT, or MD file
- Click "Upload Document"
Via API:
curl -X POST http://localhost:8000/api/v1/chat/query \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"query": "What is this document about?",
"top_k": 5
}'Via Frontend:
- Navigate to "Query" page
- Enter your question
- Click "Query"
Generate Invite Code (Admin only):
curl -X POST http://localhost:8000/api/v1/workspace/invite-code \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"Join Workspace (creates account if needed):
curl -X POST http://localhost:8000/api/v1/workspace/join \
-H "Content-Type: application/json" \
-d '{
"invite_code": "generated-invite-code",
"email": "newuser@example.com",
"name": "New User",
"password": "securepassword"
}'View Workspace Members:
curl -X GET http://localhost:8000/api/v1/workspace/members \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"Create backend/.env file:
# Database
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/knowledge_agent
# JWT
JWT_SECRET_KEY=your-secret-key-change-in-production
JWT_ALGORITHM=HS256
JWT_EXPIRATION_HOURS=24
# AI Models
EMBEDDING_MODEL=sentence-transformers/all-MiniLM-L6-v2
LLM_MODEL=facebook/opt-1.3b
# Chunking
CHUNK_SIZE=500
CHUNK_OVERLAP=250
# Storage
FAISS_STORAGE_PATH=./storage/faiss_indices
# Redis
REDIS_URL=redis://localhost:6379/0
CELERY_BROKER_URL=redis://localhost:6379/0
CELERY_RESULT_BACKEND=redis://localhost:6379/0The frontend connects to http://localhost:8000 by default. To change this, edit frontend/vite.config.js:
server: {
proxy: {
'/api': {
target: 'http://localhost:8000', // Change this
changeOrigin: true
}
}
}- Ensure PostgreSQL is running:
docker ps - Check connection string in
.env - Verify database exists:
docker-compose exec postgres psql -U postgres -l
- Ensure database is running
- Check Alembic version:
alembic current - Try:
alembic upgrade head --sqlto see SQL without executing
- Check logs:
docker-compose logs api - Verify all dependencies installed:
pip list - Check port 8000 is not in use
- Verify API is running at http://localhost:8000
- Check browser console for errors
- Verify CORS settings (should work with proxy)
- Ensure Redis is running
- Check worker logs:
celery -A celery_worker worker --loglevel=debug - Verify Redis connection string
- Explore API documentation at http://localhost:8000/docs
- Read Architecture for system design details
- Check monitoring setup in
docker-compose.monitoring.yml - Review code structure in
backend/app/andfrontend/src/