projects

Beacon

2023·github

Self-hosted page view analytics. A single Go binary + SQLite. No JavaScript SDK bloat, no cookies, no fingerprinting. Just: which pages are people reading?


Motivation

I wanted analytics for personal projects but did not want to use Google Analytics (too heavy, too invasive) or Plausible (monthly subscription for side projects).

Beacon is a ~1MB Go binary that ingests events via a tiny 400-byte pixel, stores them in SQLite, and serves a dashboard. It runs on the cheapest VPS available.

Architecture

Browser → GET /pixel.gif?p=/blog/post → Go server → SQLite
                                       ↓
                               Dashboard (HTMX)

The tracking pixel approach means:

  • No JavaScript required on the tracked site
  • No cookies set, ever
  • Works even with ad blockers (mostly)
  • Sub-millisecond response time

Stack

ComponentTechnologyReason
ServerGo + net/httpSingle binary, low memory
StorageSQLite + WALZero-dependency, fast reads
DashboardHTMX + Go templatesNo JS build step
DeploySingle binaryscp + systemd, done

Self-hosting in 3 commands

# Download the binary
curl -L https://github.com/yourusername/beacon/releases/latest/download/beacon-linux-amd64 -o beacon
chmod +x beacon
 
# Run it
./beacon --port 8080 --db ./analytics.db

Then add to your HTML:

<img src="https://your-beacon-server.com/pixel.gif?p=/page-path"
     width="1" height="1" style="display:none" />

That's the entire integration.