TelemetryTaco is a lightweight self-hosted telemetry MVP built around three concrete workflows:
- capture single events or batches
- inspect recent events in a live dashboard
- query minute-level insight aggregates over a recent lookback window
The codebase now targets a strong single-project MVP rather than a broad PostHog clone. The refactor in this repo keeps the current API contract intact while adding real batching, idempotency, generated frontend types, tests, and a cleaner developer workflow.
Python SDK / API clients
|
v
Django + Django Ninja
|
v
Celery batch task queue
|
v
PostgreSQL event store
|
v
React dashboard (React Query + generated OpenAPI types)
backend/: API surface, ingestion service, selectors, Celery tasks, retention commandsfrontend/: dashboard UI, React Query polling, OpenAPI-generated TypeScript typessdk/: queue-backed Python client that batches to/api/capture/batch
POST /api/capture: additive single-event capture endpointPOST /api/capture/batch: batch capture endpoint used by the SDKGET /api/events: bounded recent-event feed with optionalbeforecursorGET /api/insights: bounded minute-level aggregate seriesGET /api/health/liveandGET /api/health/ready- event idempotency via caller-supplied
event_uuid - OpenAPI export and generated frontend types
- backend pytest coverage, frontend Vitest coverage, and SDK tests
- Python 3.11, 3.12, or 3.13
- Poetry
- Node.js 18+ and
pnpm - Docker and Docker Compose
- Copy backend environment defaults:
cp backend/.env.example backend/.env- Start the database and Redis:
docker-compose up -d db redis- Start the application stack:
./start.shThat script will install backend dependencies, run migrations, start Django and Celery in the background, and run the frontend in the foreground.
pnpm generate:api-types # export backend OpenAPI and regenerate frontend types
pnpm validate:backend # Ruff + format check + Django check + backend pytest
pnpm validate:frontend # OpenAPI type generation + lint + type-check + Vitest
pnpm validate:all # backend + frontend + SDK validation
pnpm test # backend + frontend + SDK tests
pnpm seed # seed realistic sample events
pnpm seed:clean # wipe and reseed eventsThe backend defaults to development settings via telemetry_taco.settings.
Available settings modules:
telemetry_taco.settings.developmenttelemetry_taco.settings.testtelemetry_taco.settings.production
Important environment variables:
DATABASE_URLREDIS_URLCACHE_URLMAX_CAPTURE_BATCH_SIZEMAX_EVENTS_LIMITMAX_INSIGHTS_LOOKBACK_MINUTESEVENT_RETENTION_DAYS
Retention cleanup is exposed as a management command:
cd backend
poetry run python manage.py purge_expired_eventsOpenAPI export is also explicit:
cd backend
DJANGO_SETTINGS_MODULE=telemetry_taco.settings.test poetry run python manage.py export_openapi_schema ../frontend/openapi.jsonThe dashboard is a Vite React app that uses:
- React Query for polling, deduping, and error handling
- lazy loading for the chart surface
- generated API types from
frontend/openapi.json
If the backend contract changes, regenerate types before committing:
pnpm generate:api-typesfrom telemetry_taco import TelemetryTaco
with TelemetryTaco(base_url="http://localhost:8000") as client:
client.capture(
distinct_id="user-123",
event_name="feature_used",
properties={"feature_name": "insights-refresh"},
)The SDK batches events in a background worker, attaches event_uuid and sent_at, and flushes automatically when the context manager exits.
{
"distinct_id": "user-123",
"event_name": "page_view",
"properties": {
"path": "/"
},
"event_uuid": "optional-uuid",
"sent_at": "YYYY-MM-DDTHH:MM:SSZ"
}Response:
{
"status": "ok"
}{
"events": [
{
"distinct_id": "user-123",
"event_name": "page_view"
}
]
}Returns recent events ordered by timestamp desc, id desc.
For stable pagination, set before to the last event's timestamp,id pair.
Plain ISO 8601 timestamps are still accepted for backward compatibility.
Returns minute buckets shaped like:
[
{ "time": "18:04", "count": 4 }
]- Use
pnpmat the repo root for day-to-day commands. - Treat
backend/poetry.lockandpnpm-lock.yamlas the dependency source of truth. - Do not reintroduce
npmlockfiles or a standalone backendrequirements.txt. - Keep frontend API types generated from the backend schema, not hand-maintained.
TelemetryTaco is intentionally not solving multi-tenancy, auth, cohorts, funnels, feature flags, or ClickHouse analytics yet. The current code is optimized for a maintainable ingestion-and-dashboard MVP with clean seams for future expansion.