This guide walks you through setting up and running the D1 Foundation MVP.
-
Docker Desktop (includes Docker & Docker Compose)
- macOS:
brew install --cask docker - Or download from https://docker.com/products/docker-desktop
- macOS:
-
Git (to clone the repository)
git clone <repository-url>
cd AgenticRoboticsEvaluatorCopy the example environment files:
# Backend
cp backend/.env.example backend/.env
# Frontend
cp frontend/.env.example frontend/.envEdit backend/.env with your settings:
DATABASE_URL=postgresql://postgres:postgres@postgres:5432/evaluator
SECRET_KEY=your-super-secret-key-change-this-in-production
ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=480
⚠️ Important: ChangeSECRET_KEYto a secure random string in production!
Build and start all services:
cd infra
docker compose up --buildThis will:
- Start PostgreSQL on port 5432
- Start the FastAPI backend on port 8000
- Start the Next.js frontend on port 3000
Wait for all services to be ready. You should see:
backend-1 | INFO: Uvicorn running on http://0.0.0.0:8000
frontend-1 | ▲ Next.js 14.x.x
frontend-1 | - Local: http://localhost:3000
In a new terminal, run:
docker compose exec backend alembic upgrade headdocker compose exec backend python seed_admin.py admin admin123This creates an admin account:
- Username:
admin - Password:
admin123
⚠️ Important: Change the admin password in production!
curl http://localhost:8000/healthExpected response:
{"status": "ok"}Open your browser to http://localhost:3000/login
Login with:
- Username:
admin - Password:
admin123
You should see the chat page (admin can view but not create sessions).
Using curl or an API client:
# Get admin token
TOKEN=$(curl -s -X POST http://localhost:8000/auth/login \
-H "Content-Type: application/json" \
-d '{"username":"admin","password":"admin123"}' | jq -r '.access_token')
# Create student
curl -X POST http://localhost:8000/admin/students \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
"username": "student1",
"password": "student123",
"display_name": "Test Student",
"pronouns": "they/them",
"tone_pref": "friendly"
}'- Go to http://localhost:3000/login
- Login with
student1/student123 - You should be redirected to the chat page
- Type a message in the chat input
- Press Send or Enter
- You should see:
- Your message (right-aligned, blue)
- Assistant reply (left-aligned, gray)
- Try typing "next" to advance stages
- The stage indicator in the header should update
- Refresh the page - your messages should still be there
- Check the database:
docker compose exec postgres psql -U postgres -d evaluator -c "SELECT * FROM messages;"docker compose logs -f backend
docker compose logs -f frontenddocker compose exec backend pytest -vdocker compose exec postgres psql -U postgres -d evaluatorUseful queries:
-- List all students
SELECT id, username, role, display_name FROM students;
-- List all sessions
SELECT id, student_id, status, current_stage FROM sessions;
-- List messages for a session
SELECT id, role, content, stage_id FROM messages WHERE session_id = 1 ORDER BY created_at;docker compose downdocker compose down -v
docker compose up --build- Ensure Docker is running
- Wait for all services to start (can take 30-60 seconds)
- Check logs:
docker compose logs
- Ensure PostgreSQL is fully started before running migrations
- Try:
docker compose exec backend alembic upgrade head
- Check that backend is running on port 8000
- The Next.js rewrite proxy should forward
/api/*to the backend
- Token may have expired (8 hour default)
- Log out and log in again
- Clear localStorage in browser dev tools
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ │ │ │ │ │
│ Next.js │────▶│ FastAPI │────▶│ PostgreSQL │
│ Frontend │ │ Backend │ │ Database │
│ :3000 │ │ :8000 │ │ :5432 │
│ │ │ │ │ │
└─────────────────┘ └─────────────────┘ └─────────────────┘
- Frontend: React UI with Tailwind CSS, handles auth state
- Backend: REST API with JWT auth, manages sessions & messages
- Database: Stores users, sessions, messages, summaries
After D1 is verified working, D2 will add:
- LLM integration (replace placeholder responses)
- Safety guardrails
- Stage-specific prompting
- Session summaries
- Enhanced UI components