Windows (PowerShell):
.\setup.ps1Linux / macOS:
chmod +x setup.sh
./setup.shThe script handles everything: Docker containers, Python venv, Node dependencies, database migrations, and connection verification. When it finishes, run the app with python run.py.
Install these before running the setup script:
| Tool | Minimum Version | Check |
|---|---|---|
| Docker Desktop | With docker compose (v2) |
docker compose version |
| Python | 3.10+ | python --version |
| Node.js | 18+ | node --version |
| npm | (comes with Node.js) | npm --version |
| OpenAI API key | — | Get one here |
Ports that must be free: 5432 (PostgreSQL), 19530 (Milvus), 9000 (MinIO), 6379 (Redis), 8000 (Backend), 3000 (Frontend).
- Check prerequisites — Verifies Docker, Python, Node.js, and npm are installed and meet version requirements.
- Start infrastructure — Runs
docker compose up -dand waits for PostgreSQL, Milvus, MinIO, and Redis to become healthy (up to 3 minutes). - Configure environment — Copies
backend/.env.exampletobackend/.envand prompts for yourOPENAI_API_KEY. - Create Python virtual environment — Creates
backend/venv/and installs all Python dependencies fromrequirements.txt. - Run database setup — Executes Alembic migrations (PostgreSQL), creates Milvus vector collections, and creates MinIO storage buckets.
- Install frontend dependencies — Runs
npm installinfrontend/. - Verify connections — Tests connectivity to all four infrastructure services and the OpenAI API.
- Print summary — Shows results and next steps.
Every step is idempotent — running the script again skips work that's already done.
After setup completes:
python run.pyThis starts the backend API (port 8000), Celery worker, and Next.js frontend (port 3000).
- App UI: http://localhost:3000
- API docs: http://localhost:8000/docs
- Health check: http://localhost:8000/health?check_services=true
Press Ctrl+C to stop all services.
To run without the Celery background worker (document ingestion won't work):
python run.py --no-celeryIf you prefer to run each step yourself instead of using the script:
docker compose up -dWait for all containers to be healthy:
docker compose pscd backend
copy .env.example .env # Windows
# cp .env.example .env # Linux/macOSEdit backend/.env and set OPENAI_API_KEY to your real key. All other defaults match docker-compose.
cd backend
python -m venv venv
# Windows:
.\venv\Scripts\activate
# Linux/macOS:
source venv/bin/activate
pip install -r requirements.txtcd backend
python -m scripts.setup.setup_allThis runs Alembic migrations, creates Milvus collections, and creates MinIO buckets.
cd frontend
npm installcd backend
python -m scripts.setup.verify_connectionspython run.pyAll backend config is in backend/.env via Pydantic BaseSettings. The .env.example file documents every option.
| Variable | Description |
|---|---|
OPENAI_API_KEY |
Your OpenAI API key (for embeddings) |
| Variable | Default | Description |
|---|---|---|
DB_HOST |
localhost | PostgreSQL host |
DB_PORT |
5432 | PostgreSQL port |
DB_NAME |
ragdb | Database name |
DB_USER |
raguser | Database user |
DB_PASSWORD |
ragpass | Database password |
MILVUS_HOST |
localhost | Milvus host |
MILVUS_PORT |
19530 | Milvus port |
MINIO_ENDPOINT |
localhost:9000 | MinIO endpoint |
MINIO_ACCESS_KEY |
minioadmin | MinIO access key |
MINIO_SECRET_KEY |
minioadmin | MinIO secret key |
REDIS_URL |
redis://localhost:6379/0 | Celery broker |
REDIS_BACKEND |
redis://localhost:6379/1 | Celery result backend |
If you have services running on a remote server, update backend/.env:
DB_HOST=192.168.1.100
MILVUS_HOST=192.168.1.100
MINIO_ENDPOINT=192.168.1.100:9000
REDIS_URL=redis://192.168.1.100:6379/0Then pass -SkipDocker (Windows) or --skip-docker (Linux) to the setup script.
If a port is already in use, either stop the conflicting process or change the port in docker-compose.yml and backend/.env.
Windows — find what's using a port:
netstat -ano | findstr :5432
taskkill /PID <pid> /FLinux — find what's using a port:
sudo lsof -i :5432
sudo kill <pid>Milvus depends on etcd and minio-milvus. It can take 60-90 seconds to become healthy on first start. The setup script waits up to 3 minutes. If it times out:
docker compose logs milvusCommon causes: not enough RAM (Milvus needs ~2GB), etcd didn't start cleanly (try docker compose down && docker compose up -d).
If python is not found, try py -3 (the Windows Python Launcher). The setup script checks both.
If pip install fails with a build error, make sure you have the Visual C++ Build Tools installed.
If you see connection errors from the OpenAI check, make sure OPENAI_API_KEY in backend/.env is set to a valid key (starts with sk-). Get one at https://platform.openai.com/api-keys.
Make sure Docker Desktop is running. On Windows, check that WSL 2 is enabled. Run docker compose logs to see specific errors.
If npm install fails, try deleting frontend/node_modules and frontend/package-lock.json, then run npm install again.
Stop infrastructure and delete all data (start fresh):
docker compose down -vRemove Python virtual environment:
rmdir /s /q backend\venv # Windows
rm -rf backend/venv # Linux/macOSRemove frontend dependencies:
rmdir /s /q frontend\node_modules # Windows
rm -rf frontend/node_modules # Linux/macOSRemove backend config:
del backend\.env # Windows
rm backend/.env # Linux/macOSThen re-run the setup script to rebuild everything.
run.py supports Linux/macOS and Windows. You can use python run.py directly.
If you prefer manual startup, use:
Terminal 1 — Backend:
cd backend
source venv/bin/activate
uvicorn main:app --reload --host 0.0.0.0 --port 8000Terminal 2 — Celery worker:
cd backend
source venv/bin/activate
celery -A app.worker worker --loglevel=info --pool=prefork --concurrency=4On Windows, use --pool=solo.
Terminal 3 — Frontend:
cd frontend
npm run devOnce everything is running:
- Open http://localhost:3000
- Click Upload Document in the sidebar
- Select a PDF file
- Wait for processing to complete
- Go to Chat and ask questions about your document
Or via API:
curl -X POST http://localhost:8000/v1/ingest/document \
-F "file=@/path/to/document.pdf"