Skip to Content
Getting StartedQuick Start

Quick Start

Get the Loop Health platform running locally in minutes.

Prerequisites

  • Node.js 20 or later
  • pnpm 9.x (npm install -g pnpm)
  • Docker (optional, for local PostgreSQL)
  • Supabase account with a project configured
  • Clerk account for authentication

Clone and Install

git clone https://github.com/your-org/loop-platform.git cd loop-platform pnpm install

Environment Variables

Copy the example environment file and fill in your credentials:

cp .env.example .env.local

Key variables to configure:

# Supabase SUPABASE_URL=https://your-project.supabase.co SUPABASE_ANON_KEY=your-anon-key SUPABASE_SERVICE_KEY=your-service-key DATABASE_URL=postgresql://... # Clerk Authentication NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_... CLERK_SECRET_KEY=sk_... CLERK_ISSUER_URL=https://your-clerk-instance.clerk.accounts.dev # AI Providers OPENAI_API_KEY=sk-... ANTHROPIC_API_KEY=sk-ant-... # Wearables OURA_CLIENT_ID=your-oura-client-id OURA_CLIENT_SECRET=your-oura-secret WHOOP_CLIENT_ID=your-whoop-client-id WHOOP_CLIENT_SECRET=your-whoop-secret # Background Jobs TRIGGER_API_KEY=tr_... TRIGGER_API_URL=https://api.trigger.dev TRIGGER_PROJECT_ID=your-project-id

Build All Packages

pnpm build

This uses Turborepo to build all packages in dependency order.

Run Development Servers

All apps at once

pnpm dev

Individual apps

# CMS Admin pnpm --filter @loop/admin dev # Consumer app pnpm --filter @loop/my-loop-health dev # Luna AI pnpm --filter @loop/luna dev # Patient Graph API pnpm --filter @loop/patient-graph-api dev # Documentation pnpm --filter @loop/docs dev

Seed the CMS

Populate the Payload CMS with initial data:

pnpm --filter @loop/admin seed

Verify the Setup

ServiceURLHealth Check
Admin CMShttp://localhost:3000/cmsLogin with Clerk
Consumer Apphttp://localhost:3000Dashboard loads
Patient Graph APIhttp://localhost:3000/health{ status: "ok" }
Luna AIhttp://localhost:3000Chat interface loads
Docshttp://localhost:3001This site

Common Commands

# Type-check all packages pnpm typecheck # Lint all packages pnpm lint # Format with Prettier pnpm format # Run tests pnpm test # Build a specific package pnpm --filter @loop/core build

Project Structure

loop-platform/ ├── apps/ │ ├── admin/ # Payload CMS admin (Next.js 15) │ ├── my-loop-health/ # Consumer health app │ ├── luna/ # Luna AI chat │ ├── loop-health/ # Marketing site │ ├── patient-graph/ # Clinical data API │ ├── trigger/ # Background jobs │ ├── embeddings-api/ # Vector embeddings │ └── docs/ # Documentation (Nextra) ├── packages/ │ ├── core/ # Result<T>, errors, logger │ ├── shared/ # Zod schemas, RBAC, types │ ├── database/ # Supabase repositories │ ├── cms/ # Payload CMS config │ ├── hono/ # Hono middleware │ ├── events/ # Trigger.dev events │ ├── auth/ # Clerk auth │ ├── ai/ # AI providers │ ├── health-data/ # Biomarker reference data │ ├── biomarker-parser/ # Lab PDF parsing │ ├── health-engine/ # Health analysis │ ├── health-score/ # Score calculation │ ├── contraindications/ # Peptide safety │ ├── guardrails/ # AI guardrails │ ├── protocol-engine/ # Protocol logic │ ├── patient-graph/ # PG data access │ ├── patient-graph-client/ # PG HTTP client │ ├── rimo/ # Rimo Health │ ├── stream/ # GetStream │ ├── follows/ # Follow relationships │ ├── correlations/ # AI correlations │ └── tsconfig/ # Shared TS configs └── docs/ # Raw documentation files

Troubleshooting

pnpm install fails

Make sure you’re using pnpm 9.x. Run pnpm --version to check. Upgrade with npm install -g pnpm@latest.

Database connection errors

Verify your DATABASE_URL and SUPABASE_URL environment variables. The Supabase project must have the payload, health, and patient_graph schemas.

Clerk authentication errors

Ensure CLERK_SECRET_KEY and NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY are set correctly. The Clerk instance must have SSO configured with publicMetadata.adminRole for CMS access.

Build failures

Run pnpm build from the root — Turborepo handles dependency ordering. If a single package fails, check its tsconfig.json extends the correct base config from @loop/tsconfig.