Skip to content

pug-sh/pug

Repository files navigation

Pug

CI codecov Discord

Pug is an open-source product analytics platform. Capture events, identify the people behind them, and explore behavior through funnels, retention, trends, segmentation, and user-flow analysis — all surfaced on customizable dashboards.

Built in Go on PostgreSQL, ClickHouse, and NATS.

Features

  • Event ingestion — a NATS-backed capture pipeline with automatic geo, user-agent, and bot-detection enrichment.
  • Profiles — identify and alias the users behind events, with a ClickHouse-backed profile and activity API.
  • Insights — trends, funnels, retention, segmentation, user flow (Sankey), and top-K breakdowns, with filtering, breakdowns, and period-over-period comparison.
  • Dashboards — compose insight and markdown tiles on a grid with a board-level time window, accelerated by a pre-aggregated rollup fast path.
  • Privacy & compliance — GDPR/DPDP data-subject erasure of a person's events and profile.

A Pug dashboard composed of insight and markdown tiles
Dashboards — compose insight and markdown tiles on a time-windowed grid.

Pug's live map zooming across continents into real-time events
Live view — every event on a live world map; zoom in for the page, browser, device, and the profile behind it.

The Pug insights query builder with a filter open
Insights — build trends, funnels, retention, and more with filters and breakdowns.

A Pug retention insight showing a cohort retention heatmap
Retention — cohort heatmaps that track how each day's users come back over time.

A Pug user profile showing traits and recent activity
Profiles — the person behind the events, with traits, sessions, and activity.

The Pug raw-events explorer with an expanded event
Events — inspect the raw stream, enriched with geo, device, and bot signals.

Tech stack

  • Go — backend services and workers, exposed over Connect RPC (HTTP/2)
  • PostgreSQL — relational store (orgs, projects, dashboards, auth)
  • ClickHouse — analytical store for events, insights, and profiles
  • NATS — messaging backbone for the ingestion and worker pipelines

Quick start

# Build the binary -> bin/pug
make build

# Start dev infrastructure (PostgreSQL, NATS, ClickHouse)
make infra

# Run migrations
./bin/pug postgres migrate
./bin/pug nats migrate
./bin/pug clickhouse migrate

# Start the dev server + workers together
./bin/pug dev

Environment variables are documented in .env.example.

Development

make test    # run tests (race detector enabled)
make cover   # run tests and write coverage.out
make lint    # lint Go code
make sqlc    # regenerate sqlc queries after editing SQL
make rpc     # regenerate protobuf code after editing .proto files
make templ   # regenerate templ email templates

Architecture

Per-subsystem documentation lives in docs/architecture/ (insights, ClickHouse, profiles, ingestion, email, telemetry). Contributor guidance and conventions are in CLAUDE.md.

License

Pug is licensed under the GNU AGPL v3.0.

Packages

 
 
 

Contributors

Languages