Find your next open-source project

Search by name, purpose, or keyword — or paste a GitHub repository URL

egoist/tinytraffic

Data

Self-hosted, cookie-free web analytics in one binary, storing events in DuckDB or ClickHouse.

204
10
TypeScript
AGPL-3.0
2 days old

What it does

tinytraffic is a self-hosted web analytics server for personal sites. It ships as a single Go binary with an embedded dashboard and tracker script, so you run one process and keep all traffic data on your own machine. The default storage is a DuckDB file; you can point it at ClickHouse instead when you need more traffic or several processes sharing one database.

The tracker is about 1 KB gzipped and records pageviews, SPA navigations, outbound clicks and custom events. It accepts Plausible's event format, so existing Plausible snippets keep working. Privacy is handled by hashing a daily-rotating salt with site, IP and user agent; no cookies are set, the IP is not stored, and referrer query strings are dropped. The dashboard covers visitors, visits, pageviews, bounce rate and visit duration, plus sources, referrers, pages, locations, devices and goals, with click-to-filter rows. A public dashboard mode can expose a site's stats without sign-in, and a site-scoped API with API keys supports reading stats, managing sites and sending server-side events.

Quick start

The fastest route is Docker:

docker run -d --name tinytraffic -p 8080:8080 -v tinytraffic:/data \
  -e TT_PASSWORD=change-me ghcr.io/egoist/tinytraffic:main

Open http://localhost:8080, sign in with the password you set, create a site, and paste the generated snippet into that site's <head>:

<script defer data-domain="example.com" src="https://stats.example.com/js/script.js"></script>

Replace the domain and script host with your own values. The tracker attributes data-domain, data-api, data-hash and data-outbound="false" control what gets recorded.

To build from source you need Go 1.26+, Bun 1.4+ and a C compiler, since DuckDB is linked through cgo:

bun install        # also fetches the GeoIP database
bun run build      # tracker + dashboard + bin/tinytraffic
./bin/tinytraffic  # serves on :8080

Configuration and deployment

Runtime settings can be given as flags or TT_* environment variables: listen address, data directory, DuckDB memory limit, GeoIP MMDB files, ClickHouse URL and TT_TRUST_PROXY. Setting TT_PASSWORD on first start prevents anyone else from claiming the setup screen. When running behind a TLS-terminating proxy, enable TT_TRUST_PROXY=true and expose only the proxy port; otherwise all visitors appear as the proxy IP and public dashboard viewers share a single rate limit.

GeoIP data comes from DB-IP's free city database bundled from npm; you can supply MaxMind or other .mmdb files instead. To switch to ClickHouse, stop the server and run tinytraffic migrate-clickhouse with the target URL; it copies sites, API keys, settings, salts and events, and is safe to rerun. tinytraffic expects a single ClickHouse server, not a cluster, and its tables are not replicated.

Operational constraints

With DuckDB, only one process can open the database file, so management commands such as password and seed require the server to be stopped. That also affects rolling deploys: Dokploy and Docker Swarm must use stop-first update order for DuckDB installs, while ClickHouse allows start-first updates. With multiple processes behind ClickHouse, each keeps visit sessions in memory, so a visitor's requests should reach the same process to avoid double-counted visits.

Back up by stopping the server and copying the data directory or by exporting Parquet with the DuckDB CLI; on ClickHouse, back up the database itself. The project is licensed AGPL-3.0.

HotRepo's take

tinytraffic entered HotRepo's new-project list on 2026-11-10 with 101 stars gained in roughly nine and a half hours and 3 forks, against a repository created the same day. That is an early signal only: the README's performance figures (25M events in a 555 MB DuckDB file, 30-day queries in 10–100 ms on an Apple Silicon laptop) are the author's own measurements and say nothing about adoption. What is concrete is the scope: a single-binary deployment, Plausible-compatible event format and a documented DuckDB-to-ClickHouse migration path make it easy to evaluate without a hosted service.

Written by AI from the project's README, updated . The project's own docs are the source of truth.

You might also like

  1. surendrapandar/minilyticsA self-hosted web analytics app that connects payments to traffic sources, built for indie founders who want revenue attribution.TypeScript135
  2. ClickHouse/ClickHouseAn open-source column-oriented database for running analytical reports over large datasets in real time.C++50,587
  3. duckdb/duckdbAn in-process analytical SQL engine for developers and analysts who want warehouse-grade queries on local files without running a server.C++42,500