hanzo-insights

Hanzo Insights is a full product analytics platform with product analytics, feature flags, session recording, A/B testing, heatmaps, LLM analytics, error tracking, surveys, web analytics, and a custom query language (InsightsQL).

Hanzo Insights - Product Analytics Platform

Category: Hanzo Ecosystem Related Skills: hanzo/hanzo-cloud.md, hanzo/hanzo-o11y.md, hanzo/hanzo-console.md

Overview

Hanzo Insights is a full product analytics platform with product analytics, feature flags, session recording, A/B testing, heatmaps, LLM analytics, error tracking, surveys, web analytics, and a custom query language (InsightsQL). Polyglot monorepo: Django/Python backend, React/TypeScript frontend, Rust high-performance services, Go livestream server. ClickHouse for event storage, PostgreSQL for metadata, Kafka for event streaming, Redis for caching. Self-hostable with Docker Compose or K8s.

Why Hanzo Insights?

Tech Stack

OSS Base

Repo: hanzoai/insights. License: MIT.

When to use

Hard requirements

  1. ClickHouse for event storage (columnar analytics)
  2. PostgreSQL for metadata and Django ORM
  3. Kafka (Redpanda) for event streaming pipeline
  4. Redis for caching and task queues
  5. Object storage (Hanzo S3) for session recordings and batch exports

Quick reference

| Item | Value | |------|-------| | Repo | github.com/hanzoai/insights | | License | MIT | | Dashboard | https://insights.hanzo.ai | | API | https://insights.hanzo.ai/api/ | | CLI host | https://insights.hanzo.ai | | Python | 3.12.12 | | Node | >=24 <25 | | pnpm | 10.29.3 | | uv | ~0.10.2 |

SDKs

| Language | Package | Repo | |----------|---------|------| | JavaScript (browser) | @hanzo/insights v6.0.0 | in-repo common/insights-js | | JavaScript (lite) | @hanzo/insights-lite | in-repo common/insights-js-lite | | Node.js | @hanzo/insights-node v6.0.0 | in-repo common/insights-node | | Python | hanzo_insights | hanzoai/insights-python | | Go | github.com/hanzoai/insights-go | hanzoai/insights-go | | Rust | insights-rs | hanzoai/insights-rs |

Monorepo structure

insights/
 insights/ # Django app (Python backend)
 api/ # REST API views (DRF)
 insightsql/ # Query language (ANTLR grammar + interpreter)
 models/ # Django models
 clickhouse/ # ClickHouse query builders
 session_recordings/
 heatmaps/
 batch_exports/
 cdp/ # Customer Data Platform
 llm/ # LLM integration helpers
 warehouse/ # Data warehouse connectors
 tasks/ # Celery tasks
 temporal/ # Temporal workflow definitions
 frontend/ # React + TypeScript (Vite, Kea, Tailwind)
 src/
 @hanzo/ # Shared frontend packages
 products/ # Product modules (each has backend/ + frontend/)
 product_analytics/
 feature_flags/
 experiments/
 replay/ # Session recording
 error_tracking/
 llm_analytics/ # LLM observability (Dockerfile.llm-analytics)
 web_analytics/
 surveys/
 cohorts/
 dashboards/
 notebooks/
 workflows/
 data_warehouse/
 marketing_analytics/
 revenue_analytics/
 customer_analytics/
 cdp/
 ...40+ total
 rust/ # Rust workspace (30+ crates)
 capture/ # High-performance event capture (axum)
 feature-flags/ # Rust feature flag evaluator
 hook-worker/ # Webhook delivery
 hook-api/ # Webhook API
 cymbal/ # Error symbolication
 cyclotron-core/ # Job scheduler
 embedding-worker/ # Embedding generation
 kafka-deduplicator/
 personinsights-*/ # Person resolution services
 property-defs-rs/
 common/ # Shared Rust libs (kafka, redis, metrics, health, etc.)
 livestream/ # Go service (real-time event streaming)
 cli/ # Rust CLI (insights-cli)
 funnel-udf/ # Rust ClickHouse UDF for funnels
 common/ # Shared packages
 insights-js/ # Browser SDK wrapper (@hanzo/insights)
 insights-js-lite/ # Lightweight browser SDK
 insights-node/ # Node.js SDK wrapper (@hanzo/insights-node)
 insightsql_parser/ # InsightsQL parser (Python package)
 insightscli/ # Internal dev CLI tooling
 design-system/ # Shared UI components
 tailwind/ # Tailwind config
 storybook/
 siphash/ # SipHash implementation
 scriptvm/ # Script VM (TypeScript + Rust)
 ingestion/ # Shared ingestion code
 services/
 mcp/ # MCP server (Cloudflare Worker, TypeScript)
 llm-gateway/ # LLM gateway integration
 nodejs/ # Node.js plugin server
 docs/ # Internal documentation
 docker/ # Docker configs (ClickHouse, Caddy, Temporal, etc.)
 proto/ # Protobuf definitions
 terraform/ # Infrastructure as code
 playwright/ # E2E tests

Development commands

# Python backend
uv sync --all-extras # Install Python deps
pytest # Run all backend tests
pytest path/to/test.py::TestClass::test_method # Single test
ruff check . --fix && ruff format . # Lint + format Python
python manage.py migrate # Run Django migrations

# Frontend
pnpm install # Install JS deps
pnpm --filter=@hanzo/frontend build # Build frontend
pnpm --filter=@hanzo/frontend test # Run frontend tests
pnpm --filter=@hanzo/frontend format # Format frontend

# Full stack
./bin/start # Start dev server (backend + frontend)

# InsightsQL grammar
pnpm grammar:build:python # Rebuild ANTLR Python parser
pnpm grammar:build:cpp # Rebuild ANTLR C++ parser

# Schema / OpenAPI
pnpm schema:build # Build TypeScript schema from Django serializers
pnpm openapi:build # Generate OpenAPI spec + TS types via Orval

# Rust services
cd rust && cargo build # Build all Rust services
cd rust && cargo test # Test all Rust services

# CLI
cd cli && cargo build # Build insights-cli

# Docker (self-host)
docker compose -f docker-compose.hobby.yml up # Full self-hosted stack

Self-hosting

The docker-compose.hobby.yml runs the complete stack:

# Minimal self-host
export DOMAIN=insights.example.com
export INSIGHTS_SECRET=$(openssl rand -hex 32)
docker compose -f docker-compose.hobby.yml up -d

InsightsQL

Custom query language with ANTLR4 grammar. Two parser targets: Python3 (backend queries) and C++ (ClickHouse UDFs). Supports:

Security: never interpolate user data into InsightsQL f-strings. Use ast.Constant() placeholders or pass entire expressions through the parser.

CLI

insights-cli login # Authenticate interactively
insights-cli query "SELECT count() FROM events" # Run InsightsQL query
insights-cli sourcemap upload ./dist # Upload sourcemaps for error tracking
insights-cli exp endpoints list # List data endpoints

Environment variables: INSIGHTS_CLI_HOST, INSIGHTS_CLI_API_KEY, INSIGHTS_CLI_PROJECT_ID.

Architecture guidelines

Related Skills


Last Updated: 2026-03-13 Category: Hanzo Ecosystem Related: analytics, insights, feature-flags, ab-testing, session-recording, clickhouse, insightsql, llm-analytics, error-tracking Prerequisites: Python, TypeScript, Docker, analytics concepts