Purpose: Get the Auto-Bidder platform running from zero to development.
Covers local dev setup, authentication, ChromaDB, and production deployment to Railway.
- Node.js 20+
- Python 3.11+ (3.12+ recommended)
- Docker & Docker Compose
- DeepSeek or OpenAI API key (for LLM)
make(available on macOS via Xcode CLI tools)
💡 This project has a
Makefileat the root with shortcuts for all common commands. Runmake helpor see makefile-commands.md for the full reference.
make infra-up # Start PostgreSQL + ChromaDB
make db-migrate # Apply all pending migrationsOr manually:
docker-compose up -d
python backend/scripts/run_migrations.pyFrontend (frontend/.env.local):
NEXT_PUBLIC_BACKEND_API_URL=http://localhost:5555
PYTHON_AI_SERVICE_URL=http://localhost:5555Backend (backend/.env):
DATABASE_URL=postgresql+asyncpg://postgres:postgres@127.0.0.1:5432/auto_bidder_dev
JWT_SECRET=<generate with: openssl rand -hex 32>
JWT_ALGORITHM=HS256
LLM_PROVIDER=deepseek
DEEPSEEK_API_KEY=sk-your-key
CHROMA_PERSIST_DIR=./chroma_dbmake install # Install all dependencies (one-time)
make dev # Start both servers concurrentlyOr individually:
make backend-dev # Backend on :5555
make frontend-dev # Frontend on :5556- Backend: http://localhost:5555/health →
{"status":"healthy"} - API docs: http://localhost:5555/docs
- Frontend: http://localhost:5556 → Sign up → Dashboard
| Issue | Solution |
|---|---|
| "Failed to create database pool" | docker-compose ps — ensure PostgreSQL is running |
| "JWT_SECRET not found" | Add JWT_SECRET to backend/.env |
| "Network Error" / "Failed to fetch" | Check NEXT_PUBLIC_BACKEND_API_URL in frontend/.env.local |
| "Unauthorized" after login | Clear localStorage and login again |
| Port conflicts | lsof -ti:5556 | xargs kill -9 (or 5555) |
| Backend import errors | Activate venv, run pip install -r requirements.txt |
The platform uses custom JWT authentication:
- Custom
userstable in PostgreSQL - JWT issued by FastAPI at
POST /api/auth/login - Frontend stores token in localStorage; sends
Authorization: Bearer <token>
# Signup
curl -X POST http://localhost:5555/api/auth/signup \
-H "Content-Type: application/json" \
-d '{"email":"test@example.com","password":"password123","full_name":"Test User"}'
# Login
curl -X POST http://localhost:5555/api/auth/login \
-H "Content-Type: application/json" \
-d '{"email":"test@example.com","password":"password123"}'
# Get current user (use token from login)
curl -X GET http://localhost:5555/api/auth/me \
-H "Authorization: Bearer YOUR_TOKEN"| Variable | Default | Description |
|---|---|---|
JWT_SECRET |
— | Secret for signing tokens (generate with openssl rand -hex 32) |
JWT_ALGORITHM |
HS256 | Signing algorithm |
JWT_EXPIRATION_MINUTES |
10080 | Token expiry (7 days) |
| Issue | Solution |
|---|---|
| "Failed to create database pool" | Ensure PostgreSQL running (docker-compose ps) |
| "JWT_SECRET not found" | Add to backend/.env |
| "Network Error" | Backend running? Check NEXT_PUBLIC_BACKEND_API_URL |
| "Unauthorized" after login | Clear localStorage and login again |
ChromaDB stores document embeddings for Knowledge Base RAG (proposal generation).
| Mode | Config | Use Case |
|---|---|---|
| Local | CHROMA_PERSIST_DIR=./chroma_db, no CHROMA_HOST |
Development |
| Docker | CHROMA_HOST=localhost, CHROMA_PORT=8001 |
Production, teams |
Logic: CHROMA_HOST wins. If set → HTTP client; else → PersistentClient. Falls back to local if Docker fails.
Local (dev): Unset/comment CHROMA_HOST. Data in backend/chroma_db/.
Docker: docker-compose up -d chromadb. Set CHROMA_HOST=localhost and CHROMA_PORT=8001 in .env.
pip install --upgrade chromadb(v0.5+ for Docker v2 API)- Set
CHROMA_HOST=localhost,CHROMA_PORT=8001 - Restart backend
- Connection refused: Ensure Docker ChromaDB is running (
docker ps | grep chromadb) - v1 API deprecated: Upgrade client to chromadb>=0.5
- Data after switch: Local and Docker use separate storage; migrate if needed
Complete guide to deploy the backend and databases to Railway.
- Railway Account: Sign up at railway.app
- Railway CLI (optional):
npm install -g @railway/cli
- GitHub Repository: Code pushed to GitHub
CLI: railway login && railway init
Dashboard: Go to railway.app/new → "Deploy from GitHub repo" → select your repo.
Click "+ New" → "Database" → "PostgreSQL". Railway auto-provides DATABASE_URL.
Click "+ New" → "Empty Service" → name it chromadb → Docker image: chromadb/chroma:latest.
Set env vars:
IS_PERSISTENT=TRUE
ANONYMIZED_TELEMETRY=FALSE
In Settings → Networking, click "Generate Domain" — note the internal URL: chromadb.railway.internal:8000.
Click "+ New" → "GitHub Repo" → select repo. Railway auto-detects railway.toml.
Settings → Build:
- Build method:
Dockerfile - Dockerfile path:
backend/Dockerfile - Build context:
backend
Set these in the FastAPI service Variables:
DATABASE_URL=${{Postgres.DATABASE_URL}}
CHROMA_HOST=chromadb.railway.internal
CHROMA_PORT=8000
JWT_SECRET=<generate secure random>
OPENAI_API_KEY=<key> # or DEEPSEEK_API_KEY
LLM_PROVIDER=deepseek
RESEND_API_KEY=<key> # for email features
ENVIRONMENT=production
LOG_LEVEL=INFO
CORS_ORIGINS=https://your-frontend.vercel.appOptional:
AUTO_DISCOVERY_ENABLED=true
ETL_USE_PERSISTENCE=true
PROJECT_FILTER_KEYWORDS=python,fastapi,react# Via Railway CLI
railway connect Postgres
\i database/migrations/001_initial_schema.sql
\q
# Or run migration script
railway run python backend/scripts/run_migrations.pySettings → Networking → Generate Domain. Test: https://your-domain.up.railway.app/health.
Update frontend env vars (Vercel or .env.local):
NEXT_PUBLIC_API_URL=https://your-backend.up.railway.app
PYTHON_AI_SERVICE_URL=https://your-backend.up.railway.apprailway login # Login
railway link # Link to project
railway logs # View logs
railway up # Deploy
railway variables # Get env vars
railway connect Postgres # DB shell
railway run <cmd> # Run in context| Service | Hobby ($5/mo) | Pro ($20/mo) |
|---|---|---|
| FastAPI Backend | $3-8 | Included in credits |
| PostgreSQL | $2-5 | Included |
| ChromaDB | $3-8 | Included |
| Total | ~$8-21/mo | ~$20+/mo |
| Issue | Solution |
|---|---|
| Service won't start | Check logs (railway logs), verify env vars, test Dockerfile locally |
| DB connection failed | Verify DATABASE_URL, check PostgreSQL service, run migrations |
| ChromaDB timeout | Use internal URL chromadb.railway.internal:8000, check CHROMA_HOST/PORT |
| High costs | Enable sleep mode, optimize Docker image, scale down resources |
- Railway account created
- GitHub repository connected
- PostgreSQL database added
- ChromaDB service configured
- FastAPI service deployed
- All environment variables set
- Database migrations run
- Health check endpoint responding
- Public domain generated
- Frontend connected to backend API
- CORS configured correctly
- Logs verified (no errors)