Skip to content

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

git clone https://github.com/lricher7329/metricis.git
cd metricis

Install Dependencies

Frontend (Client + Portal + Patient Portal)

npm install

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

createdb metricis

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

cd server
source .venv/bin/activate
alembic upgrade head

Start Development Servers

All Services at Once

npm run dev:all

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

  1. Client: Visit http://localhost:5173 - should see jsPsych dev menu
  2. Portal: Visit http://localhost:3000 - should see login page
  3. Patient Portal: Visit http://localhost:3001 - should see login page
  4. Server: Visit http://localhost:8000/docs - should see FastAPI Swagger UI

Optional: Docker Setup

Alternatively, use Docker Compose:

docker-compose up

This starts: - Client on port 5173 - Server on port 8000 - PostgreSQL on port 5432

Next Steps