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.

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) and docs/compliance/. Contributor guidance and conventions are in CLAUDE.md.

License

Pug is licensed under the GNU AGPL v3.0.

Packages

 
 
 

Contributors

Languages