This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
CAPY Interactions Dashboard — a full-stack telemetry/observability dashboard for the CAPY Discord bot. The Discord bot sends interaction events to the backend, which stores them in PostgreSQL and serves aggregated metrics to a React frontend.
docker compose up --build # Start all services (PostgreSQL, backend, frontend)
docker compose down # Stop all servicescd backend
uv sync # Install dependencies
uv run task start # Run dev server on :8000 (--reload)cd frontend
npm install
npm run dev # Dev server on :5173 (proxies /api → localhost:8000)
npm run build # Production buildData flow: Discord bot → POST /api/v1/telemetry/batch → PostgreSQL → 7 GET endpoints → React dashboard (polls every 2s)
main.py— FastAPI app, CORS, mountstelemetryrouter at/api/v1, health check at/healthrouters/telemetry.py— All 8 endpoints: batch ingest (202), plus read endpoints for metrics, commands, timeseries, errors, interaction types, heatmap, recent eventsdatabase.py— psycopg2 queries againsttelemetry_interactionsandtelemetry_completionstables; masks user IDs to last 4 digitsconfig.py— Pydantic settings;use_mockenv var toggles between real DB and mock datamock_data.py— Static fallback data used whenUSE_MOCK=truemodels.py— All Pydantic request/response models
pages/Dashboard.jsx— Orchestrates all data fetching (7 parallel API calls), holds all state, manages the 2s auto-refresh interval; silent failure on refresh preserves stale dataapi/telemetry.js— Axios instance (baseURL/api/v1, 10s timeout); exportsfetchMetrics,fetchCommands,fetchTimeseries,fetchErrors,fetchInteractionTypes,fetchRecent,fetchHeatmapcomponents/— One component per chart/widget:MetricCard,TimeSeriesChart,CommandTable,ErrorBreakdown,InteractionTypeChart,UsageHeatmap,ActivityFeed,Header
docker-compose.yml— Three services oncapy-net: postgres (:5432), backend (:8000), frontend (:80 via Nginx)init/02-grants.sql— DB grants applied at container initfrontend/vite.config.js—/apiproxy tohttp://localhost:8000for local devfrontend/tailwind.config.js— Custom dark theme palette (primary#0f1117, card#161b27) and fonts (Inter, JetBrains Mono)
All read endpoints accept a range query param (24h, 7d, 30d). Dashboard.jsx holds a single range state that is passed to every fetch call and triggers a re-fetch on change.
Set USE_MOCK=true in backend/.env to bypass PostgreSQL entirely — the backend serves data from mock_data.py. Useful for frontend development without a running database.