Trench logo

Trench

Scalable real-time event tracking built on Kafka and ClickHouse

Trench provides GDPR‑compliant, high‑throughput event ingestion and real‑time analytics using a single Docker image, compatible with Segment API and extensible via webhooks.

Trench banner

Overview

Overview

Trench is a real‑time event tracking platform built on Apache Kafka and ClickHouse. It targets engineers and product teams that need high‑volume analytics while retaining full control over user data. The system is GDPR and PECR compliant, offering APIs to access, rectify, or delete records.

Capabilities

The platform ingests thousands of events per second on a single node and supports the Segment API (Track, Group, Identify). Events are stored in ClickHouse, enabling instant SQL queries and integration with Grafana for visualization. Webhooks allow forwarding data to additional destinations, and Kafka authentication options (SASL, SSL) let you connect to secured clusters.

Deployment

Trench can be launched with a single production‑ready Docker image, requiring only Docker and Docker Compose. Recommended host specs are 4 GB RAM and 4 CPU cores. Users may self‑host the stack or opt for Trench Cloud, a managed serverless offering with autoscaling and SLA guarantees.

Highlights

Segment API compatible (Track, Group, Identify)
Single production‑ready Docker image for quick deployment
Processes thousands of events per second on a single node
Real‑time querying with ClickHouse

Pros

  • High‑throughput event ingestion on modest hardware
  • Built‑in GDPR and PECR compliance tools
  • Easy start with one Docker image
  • Instant SQL analytics via ClickHouse

Considerations

  • Requires Kafka and ClickHouse knowledge for advanced setups
  • Single‑node performance may hit limits for massive scale
  • Self‑hosting adds operational overhead
  • No native UI; relies on external tools like Grafana

Managed products teams compare with

When teams consider Trench, these hosted platforms usually appear on the same shortlist.

Mixpanel logo

Mixpanel

Self-serve product analytics for tracking user behavior, funnels, cohorts, and retention

Looking for a hosted option? These are the services engineering teams benchmark against before choosing open source.

Fit guide

Great for

  • Teams needing GDPR‑compliant real‑time analytics without vendor lock‑in
  • Startups building custom event pipelines on existing Kafka infrastructure
  • Developers who want Segment‑compatible APIs while controlling data storage
  • Organizations able to allocate a Docker host with at least 4 GB RAM and 4 CPU cores

Not ideal when

  • Very large enterprises requiring out‑of‑the‑box multi‑node horizontal scaling
  • Teams without Kafka or ClickHouse expertise
  • Projects that need a fully integrated dashboard UI
  • Environments where only managed serverless services are permitted

How teams use it

Google‑Analytics‑like dashboard

Ingest web events, store them in ClickHouse, and query them instantly for real‑time reporting.

Compliance‑driven user behavior tracking

Capture events with full ability to access, rectify, or delete individual user data on request.

Event forwarding to downstream systems

Use webhooks to push processed events to data warehouses, marketing platforms, or custom services.

Rapid prototyping of event‑driven features

Deploy a local Trench instance to test new analytics features before production rollout.

Tech snapshot

TypeScript79%
MDX15%
JavaScript2%
Shell2%
Dockerfile2%
CSS1%

Tags

open-sourceanalyticskafkakafka-engineevent-replayllmproduct-analyticsmatomodashboardstracking-eventsragclickhousedashboardnodejsplausible-analyticsclickhouse-databaseposthogmatomo-analyticstrackingclickhouse-server

Frequently asked questions

What are the minimum system requirements for self‑hosting?

Docker and Docker Compose are required, with at least 4 GB RAM and 4 CPU cores recommended for production workloads.

Can Trench connect to a secured Kafka cluster?

Yes, Trench supports SASL mechanisms and SSL/TLS via environment variables such as KAFKA_SSL_ENABLED and KAFKA_SASL_MECHANISM.

How does Trench ensure GDPR compliance?

It provides APIs to retrieve, rectify, and delete individual user records, and stores no cookies.

What is the difference between Trench Self‑Hosted and Trench Cloud?

Self‑Hosted runs on your own infrastructure via Docker; Cloud is a fully managed, serverless offering with autoscaling and SLA guarantees.

Is there a built‑in UI for visualizing data?

Trench does not include a native UI; it is commonly paired with Grafana or other visualization tools.

Project at a glance

Stable
Stars
1,612
Watchers
1,612
Forks
62
LicenseMIT
Repo age1 year old
Last commit3 months ago
Primary languageTypeScript

Last synced yesterday