Diligence — self-hosted fitness rewards platform with AI coaching. Open-source, MIT licensed.
Find a file
Claude 79d444f884 Rebuild frontend for pip install — all v4 changes included
Built with Node 22 / Vite. Includes DW brand theme, ChatCoach,
category-grouped integrations, AgentConnect with all providers,
Dashboard checklist, Settings help section, gear icon.
2026-07-13 23:41:55 +00:00
backend v2.0: dual deployment — pip install (SQLite) + Docker (PostgreSQL) 2026-07-01 03:30:12 +00:00
content Add 3-day fast operational protocol (hour-by-hour) 2026-04-16 15:16:24 +00:00
diligence Rebuild frontend for pip install — all v4 changes included 2026-07-13 23:41:55 +00:00
frontend AgentConnect: cover all AI providers + external agents; Settings: Help section 2026-07-13 23:27:36 +00:00
mcp-connector Stream D: Security hardening — 10 fixes from QA review 2026-06-21 23:13:53 +00:00
.dockerignore Stream D: Security hardening — 10 fixes from QA review 2026-06-21 23:13:53 +00:00
.env.example v2.0: dual deployment — pip install (SQLite) + Docker (PostgreSQL) 2026-07-01 03:30:12 +00:00
.gitignore v2.0: dual deployment — pip install (SQLite) + Docker (PostgreSQL) 2026-07-01 03:30:12 +00:00
AGENT_GUIDE.md Stream C frontend: ChatCoach page, nav update, README with AI providers + agent configs 2026-06-21 23:28:07 +00:00
CHANGELOG.md Stream D: Security hardening — 10 fixes from QA review 2026-06-21 23:13:53 +00:00
CONTRIBUTING.md Stream D: Security hardening — 10 fixes from QA review 2026-06-21 23:13:53 +00:00
docker-compose.yml v2.0: dual deployment — pip install (SQLite) + Docker (PostgreSQL) 2026-07-01 03:30:12 +00:00
LICENSE Deliver Steps 3-8: integration config, meal plans, provider registry, MCP connector (14 tools), B2A files, nginx proxy, AGENT_GUIDE, LICENSE 2026-06-15 14:34:09 +00:00
OUTSTANDING.md Deprioritize WHOOP: code against API docs, first user validates 2026-06-21 23:51:30 +00:00
pyproject.toml v2.0: dual deployment — pip install (SQLite) + Docker (PostgreSQL) 2026-07-01 03:30:12 +00:00
README.md v2.0: dual deployment — pip install (SQLite) + Docker (PostgreSQL) 2026-07-01 03:30:12 +00:00
setup.ps1 v2.0: dual deployment — pip install (SQLite) + Docker (PostgreSQL) 2026-07-01 03:30:12 +00:00
setup.sh v2.0: dual deployment — pip install (SQLite) + Docker (PostgreSQL) 2026-07-01 03:30:12 +00:00
TESTER-GUIDE.md docs: add beta tester guide with Claude Desktop setup instructions 2026-07-05 01:13:18 +00:00

Diligence

Self-hosted fitness rewards platform with AI agent integration. Points-based behavioral economy: earn points through workouts and food logging, spend them on rewards you choose. Science-based onboarding. 14-tool MCP connector for AI agents. Your data stays on your machine.

By DiligenceWorks Pte. Ltd. — MIT License


Which install is right for you?

pip install Docker
Who it's for You want a fitness app on your laptop. No servers, no DevOps, no fuss. You're self-hosting for a household, a team, or you want PostgreSQL and a production-grade setup.
What you need Python 3.11+ Docker and Docker Compose
Database SQLite (zero config, file on disk) PostgreSQL 16 (runs in a container)
Runs as Single process on localhost 4 containers behind nginx
Setup time 2 minutes 5 minutes
Best for Personal use on a laptop or desktop Always-on server, multiple users, backups

Install — Personal Laptop (pip)

Prerequisites: Python 3.11 or newer.

# Clone and install
git clone https://github.com/DiligenceWorks/Diligence.git
cd Diligence
pip install .

# Run
diligence

That's it. The app opens in your browser at http://localhost:8000. Your data lives in ~/.diligence/.

On first run, Diligence generates a secret key and stores your config in ~/.diligence/.env. The SQLite database is created automatically at ~/.diligence/data.db.

Options

diligence --port 9000          # Different port
diligence --no-browser         # Don't auto-open browser
diligence --data-dir /my/path  # Custom data directory
python -m diligence            # Alternative way to run

Building the frontend from source

The pip package includes a pre-built frontend. If you want to modify the UI:

cd frontend
npm install
npm run build
cp -r dist/ ../diligence/frontend/

Install — Server (Docker)

Prerequisites: Docker and Docker Compose.

git clone https://github.com/DiligenceWorks/Diligence.git
cd Diligence
./setup.sh                 # generates .env with secrets
docker compose up -d       # starts 4 containers

Open http://localhost (or your server's IP). Register your account — the first user gets admin.

What's running

Container Role Port
frontend React app + nginx reverse proxy 80
backend FastAPI application server 8000 (internal)
mcp-connector MCP SSE server for AI agents 3001
fitness-db PostgreSQL 16 5432 (internal)

Environment variables

Copy .env.example to .env (or let setup.sh do it). Key variables:

Variable Docker default Description
SECRET_KEY (generated) JWT signing key
API_TOKEN (generated) MCP connector auth token
DATABASE_URL postgresql+asyncpg://... Database connection
BASE_URL http://localhost Public URL for OAuth callbacks

AI Agent Integration (MCP)

Diligence exposes 14 tools via the Model Context Protocol. Any MCP-compatible AI agent (Claude, custom agents) can log workouts, track food, manage meal plans, and check progress.

Connect your agent

pip install path:

URL:    http://localhost:8000/mcp
Token:  (shown on first run, or check ~/.diligence/.env)

Docker path:

URL:    http://localhost:3001/sse
Token:  (in your .env file, API_TOKEN)

Available tools

Tool What it does
get_context() Full profile, motivation type, programs, rules, rewards
get_today() Daily points, gate status, activities
get_week() Weekly summary and target progress
log_activity(...) Log a workout, earn points
log_food(...) Log food with macros
search_food(query) Search Open Food Facts + USDA (400K+ foods)
get_program_schedule() Today's scheduled workout
redeem_reward(name) Spend points on a reward
load_meal_plan(...) Create a meal plan
get_meal_plan() View today's meals
update_meal_compliance(...) Mark meals as followed/skipped
get_plan_progress() Compliance stats
configure_integration(...) Store encrypted credentials
get_integration_status() Check provider connections

See AGENT_GUIDE.md for behavioral guidelines including BREQ-2 tone calibration.


What's inside

Science-based onboarding

  • PAR-Q+ physical activity readiness screening
  • TTM (Transtheoretical Model) stage assessment
  • BREQ-2 motivation profiling — the app adapts its tone to your motivation type

Points engine

  • Earn points for workouts, food logging, fasting, meal compliance
  • Daily gate (minimum to unlock rewards)
  • Weekly targets with reset
  • Configurable reward shop — you decide what points are worth

Integrations

Strava and Polar sync are built in. The provider registry supports Garmin, Fitbit, Withings, WHOOP, and Oura (OAuth flows ready, need provider approval). USDA FoodData Central for nutrition lookup.


Project structure

Diligence/
  pyproject.toml              # pip install config
  docker-compose.yml          # Docker config
  diligence/                  # Python package
    cli.py                    # Entry point for pip path
    main.py                   # FastAPI app
    config.py                 # Settings (auto-detects SQLite vs PostgreSQL)
    database.py               # Dialect-agnostic database layer
    models/                   # 15 SQLAlchemy models
    routers/                  # 12 API routers
    services/                 # Points engine, food lookup, sync, crypto
    utils/                    # Auth helpers
    mcp/                      # MCP connector (14 tools)
    frontend/                 # Pre-built React app (pip path serves this)
  frontend/                   # React source code
  backend/                    # Dockerfile + requirements.txt (Docker path)
  mcp-connector/              # MCP Dockerfile (Docker path)

Development

# Clone
git clone https://github.com/DiligenceWorks/Diligence.git
cd Diligence

# Backend
pip install -e ".[dev]"
diligence --port 8000

# Frontend (separate terminal)
cd frontend
npm install
npm run dev

Data and privacy

Your data never leaves your machine. There is no telemetry, no analytics, no cloud sync. The database is a single file (~/.diligence/data.db for pip, a Docker volume for Docker). Back it up however you back up your files.

Integration credentials (Strava, Polar, etc.) are encrypted at rest using Fernet with HKDF key derivation from your SECRET_KEY.


License

MIT. See LICENSE.

Built by DiligenceWorks Pte. Ltd.