v2.0: dual deployment — pip install (SQLite) + Docker (PostgreSQL)

Architecture:
- Moved backend/app/ to diligence/ Python package
- Dialect-agnostic models (Uuid + JSON, no PostgreSQL imports)
- Auto-detect database: empty DATABASE_URL → SQLite at ~/.diligence/data.db
- Cross-dialect migrations (inspector-based, no raw PostgreSQL DDL)
- FastAPI serves pre-built React frontend for pip path
- CLI entry point: diligence [--port] [--no-browser] [--data-dir]
- pyproject.toml with optional deps: [postgres], [mcp], [dev]
- Docker path unchanged: docker compose up -d

pip install path: pip install . && diligence
Docker path: ./setup.sh && docker compose up -d
This commit is contained in:
Claude 2026-07-01 03:30:12 +00:00
parent 0ce1463de8
commit a6e6e2f54f
77 changed files with 1537 additions and 1007 deletions

View file

@ -1,19 +1,23 @@
# === REQUIRED (generated automatically by setup.sh) ===
SECRET_KEY=
# Diligence Configuration
# Copy this to .env and fill in values, or run ./setup.sh to auto-generate.
# Required — auto-generated by setup.sh
SECRET_KEY=change-me-in-production
API_TOKEN=
# === APP URL (change for production) ===
BASE_URL=http://localhost
# Database — leave empty for SQLite (pip install path)
# Set for PostgreSQL (Docker path): postgresql+asyncpg://fitness@fitness-db:5432/fitness_rewards
DATABASE_URL=
# === DATABASE (defaults work out of the box) ===
DB_USER=fitness
DB_NAME=fitness_rewards
# App
BASE_URL=http://localhost:8000
# === MCP AGENT AUTH (generated automatically by setup.sh) ===
# The API_TOKEN authenticates the MCP connector with the backend.
# It is auto-configured — you don't need to touch it unless you're
# connecting an agent from outside Docker.
# Everything else — Strava, Polar, Garmin, Fitbit, Telegram,
# USDA, Groq, etc. — is configured through the app UI or your AI agent.
# No container restart needed.
# Optional integrations
STRAVA_CLIENT_ID=
STRAVA_CLIENT_SECRET=
POLAR_CLIENT_ID=
POLAR_CLIENT_SECRET=
GROQ_API_KEY=
TELEGRAM_BOT_TOKEN=
TELEGRAM_CHAT_ID=
CRAWL_ENABLED=false