Sign inSign up

lukevinskywynn/cadiv

By lukevinskywynn

•Updated 8 months ago

Training analytics, coaching, and ride intelligence built for cyclists

Image
Internet of things
Web servers
0

2.1K

lukevinskywynn/cadiv repository overview

⁠Cadiv

Self-hosted cycling analytics platform. Training insights, coaching engine, and activity tracking — all on your own hardware. No subscriptions, no data harvesting.

⁠Quick Start

mkdir cadiv && cd cadiv

Create a docker-compose.yml:

version: "3.9"

services:
  postgres:
    image: postgres:16-alpine
    restart: unless-stopped
    environment:
      POSTGRES_USER: cadiv
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-cadiv123}
      POSTGRES_DB: cadiv
    volumes:
      - cadiv-pgdata:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U cadiv"]
      interval: 5s
      timeout: 3s
      retries: 5

  cadiv:
    image: lukevinskywynn/cadiv:latest
    restart: unless-stopped
    depends_on:
      postgres:
        condition: service_healthy
    env_file: .env
    ports:
      - "4000:4000"
      - "4321:4321"

volumes:
  cadiv-pgdata:

Create a .env file:

# Account credentials (your login for the web & mobile apps)
CADIV_USERNAME=admin
CADIV_PASSWORD=your_strong_password

POSTGRES_PASSWORD=your_secure_db_password
SESSION_SECRET=your_session_secret

# Strava integration (optional — connect after login from Settings)
STRAVA_CLIENT_ID=your_strava_client_id
STRAVA_CLIENT_SECRET=your_strava_client_secret

# Optional: use an external database instead of the bundled Postgres
# DATABASE_URL=postgresql://user:pass@host:5432/cadiv

Start it up:

docker compose up -d

Open http://localhost:4321⁠ and sign in with your CADIV_USERNAME / CADIV_PASSWORD credentials.

⁠What's Inside

A single container running the full Cadiv stack:

  • API Server (port 4000) — Node.js + Express + Prisma ORM
  • Web Client (port 4321) — Astro + React + Tailwind CSS

On startup, the container automatically runs database migrations, starts the API server, and launches the web client.

⁠Features

  • Strava & Whoop Integration — OAuth connect, full activity import, background sync every 5 minutes
  • Training Insights — PMC (CTL/ATL/TSB), estimated FTP, TSS, intensity distribution, consistency scoring
  • AI Coaching Engine — 5 coach personalities, personalized training plans, daily briefings, post-ride feedback
  • Rider Levels — 15-tier progression system based on FTP, consistency, and volume
  • Activity Analysis — Ride classification, performance scoring, comparison charts, fitness impact tracking
  • Weather Integration — Per-ride conditions, 7-day forecast with ride-ability scoring
  • Notifications — Real-time sync alerts and coaching messages

⁠Environment Variables

VariableRequiredDescription
CADIV_USERNAMEYesYour login username (auto-created on first startup)
CADIV_PASSWORDYesYour login password (bcrypt hashed, updated if changed)
POSTGRES_PASSWORDYesPassword for the bundled Postgres container. Not needed if using DATABASE_URL
SESSION_SECRETYesExpress session secret. Generate with openssl rand -hex 32
DATABASE_URLNoFull PostgreSQL connection string. If set, uses this instead of the bundled Postgres container
STRAVA_CLIENT_IDNoFrom Strava API settings⁠
STRAVA_CLIENT_SECRETNoFrom Strava API settings
STRAVA_REDIRECT_URINoDefault: http://localhost:4000/api/auth/strava/callback
APP_ORIGINNoDefault: http://localhost:4321
WHOOP_CLIENT_IDNoFor Whoop integration
WHOOP_CLIENT_SECRETNoFor Whoop integration

⁠Common Commands

docker compose up -d                # Start
docker compose down                 # Stop
docker compose pull && docker compose up -d  # Update
docker compose logs -f cadiv        # View logs
docker compose exec postgres pg_dump -U cadiv cadiv > backup.sql  # Backup

Tag summary

Content type

Image

Digest

sha256:1f827ed36…

Size

407 MB

Last updated

8 months ago

docker pull lukevinskywynn/cadiv