Installation¶
This guide covers setting up Metricis for local development.
Prerequisites¶
- Node.js: 18+ (for client, portal, patient-portal)
- Python: 3.11+ (for server)
- PostgreSQL: 15+ (for database)
- Redis: 5.0+ (for session storage and Celery)
Clone Repository¶
Install Dependencies¶
Frontend (Client + Portal + Patient Portal)¶
This installs dependencies for all three frontend applications (monorepo setup).
Backend (Server)¶
cd server
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
pip install -r requirements.txt
Database Setup¶
Create PostgreSQL Database¶
Configure Environment¶
Create server/.env file:
# Database
DATABASE_URL=postgresql+asyncpg://localhost:5432/metricis
# Security (REQUIRED - generate with: python -c "import secrets; print(secrets.token_urlsafe(32))")
JWT_SECRET_KEY=your_secret_key_here
SESSION_SECRET_KEY=your_session_key_here
# CORS
ALLOWED_ORIGINS=http://localhost:5173,http://localhost:3000,http://localhost:3001
# Session Storage
SESSION_STORAGE_BACKEND=memory # Use "redis" for production
# REDIS_URL=redis://localhost:6379/0
# Rate Limiting
RATE_LIMIT_PER_MINUTE=60
AUTH_RATE_LIMIT_PER_MINUTE=10
Run Migrations¶
Start Development Servers¶
All Services at Once¶
This starts: - Client (port 5173) - Portal (port 3000) - Patient Portal (port 3001) - Server (port 8000)
Individual Services¶
# Client only
npm run dev:client
# Portal only
npm run dev:portal
# Patient Portal only
npm run dev:patient-portal
# Server only
npm run dev:server
Verify Installation¶
- Client: Visit http://localhost:5173 - should see jsPsych dev menu
- Portal: Visit http://localhost:3000 - should see login page
- Patient Portal: Visit http://localhost:3001 - should see login page
- Server: Visit http://localhost:8000/docs - should see FastAPI Swagger UI
Optional: Docker Setup¶
Alternatively, use Docker Compose:
This starts: - Client on port 5173 - Server on port 8000 - PostgreSQL on port 5432
Next Steps¶
- Quick Start - Create your first study
- Development Guide - Learn about the development workflow
- Testing Guide - Run tests