Ir al contenido
Empieza en HitKeep Cloud

HitKeep Tech Stack: Go, DuckDB, NSQ, and Angular

Esta página aún no está disponible en tu idioma.

HitKeep is built with a deliberate, minimal stack chosen for performance, auditability, and operational simplicity. Every dependency earns its place.

The application server, ingest pipeline, background workers, and CLI are written in Go. Current release binaries, Docker images, and CI use Go 1.26.4. HitKeep ships as a single Linux binary and does not require external database or queue services on the target system. The canonical runtime facts, including about 100 MB release binaries and memory use, live in Facts and Limits.

Why Go:

  • Ships as a single Linux binary for linux/amd64 and linux/arm64
  • Current Linux release binaries target a glibc 2.35+ baseline (for example Amazon Linux 2023, Ubuntu 22.04+, Debian 12+)
  • Excellent standard library for HTTP servers, crypto, and concurrency
  • CGo is used only for DuckDB (the embedded database) — no external services
  • Memory use depends on workload and deployment shape. See Facts and Limits for current guidance.

DuckDB is an in-process analytical database engine embedded directly in the Go binary via duckdb-go/v2. It replaces the PostgreSQL + ClickHouse combination required by most analytics platforms.

Why DuckDB over ClickHouse or PostgreSQL:

DuckDB (HitKeep) PostgreSQL + ClickHouse
Process count 1 2–3
Network sockets required 0 2–3
Backup Copy the HitKeep data directory (hitkeep.db plus any tenants/*/hitkeep.db) Dump multiple databases
Query type Columnar OLAP Row + columnar split
Storage efficiency ~120 MB / million hits Varies; typically higher with overhead
Direct query access DuckDB CLI or any Parquet tool psql / clickhouse-client

DuckDB’s columnar storage engine is purpose-built for analytical queries — aggregations, time-bucketing, and filtering over large event tables — which is precisely the workload analytics generates. HitKeep now also uses DuckDB’s appender API on the ingest path, so incoming hits and events are flushed in micro-batches instead of one SQL INSERT per message.

NSQ is an in-process message queue that decouples the HTTP ingest path from the DuckDB write path. The HTTP handler enqueues each hit in microseconds; background consumers resolve the target tenant store, group messages by store, and write them to DuckDB in micro-batches at a pace that suits the database.

Why NSQ is embedded (not Kafka):

  • Zero external broker to manage or monitor
  • Binds to 127.0.0.1 loopback only — never exposed externally
  • Absorbs traffic spikes without database back-pressure
  • Lets the write path acknowledge messages only after a successful DuckDB batch flush
  • Configurable loopback ports if you run multiple HitKeep instances locally

For high-availability deployments, HitKeep uses Memberlist (the library behind Consul and Serf) for node discovery and Leader election. One node holds the DuckDB write lock (Leader); followers proxy ingest requests to it.

This enables Kubernetes StatefulSet deployments with automatic Leader failover when a pod is rescheduled.

HitKeep uses Go’s standard net/http mux, not an external framework. This minimizes the attack surface and keeps the binary lean.

The optional MCP route is mounted on the same HTTP server when enabled. It is leader-only, read-only, and authenticated with API client bearer tokens.


The dashboard is a Single Page Application built with Angular v22. State management uses Angular Signals throughout — no NgRx, no RxJS BehaviorSubjects for local state.

Why Angular (not React or Vue):

  • Strong TypeScript integration out of the box
  • Angular CLI + ng build --configuration production produces heavily optimized, tree-shaken bundles
  • PrimeNG’s component library has first-class Angular support
  • Change detection with OnPush + Signals eliminates unnecessary re-renders

PrimeNG provides the component library: data tables, charts, dialogs, forms, and navigation. It is styled via the PrimeUI theming system and Tailwind CSS utility classes.

Utility-first CSS framework for layout and spacing. Used in the dashboard alongside PrimeNG’s design tokens for a consistent visual system.

The hk.js tracking snippet is minified using esbuild — the same bundler Angular uses internally — with Web Vitals kept in an opt-in hk-vitals.js split bundle.

The snippet is served from your HitKeep instance — no third-party CDN, no cross-origin request from your visitors’ browsers.


Dependency Role
duckdb-go Embedded OLAP database
go-nsq + nsq Embedded message queue
memberlist Cluster gossip / Leader election
golang-jwt/jwt JWT session tokens
go-mail SMTP email delivery
mjml-go MJML email template rendering
internal/ipmeta Offline IP metadata lookup for country, region, city, provider, and ASN fields
golang.org/x/crypto argon2id, WebAuthn crypto primitives
golang.org/x/time Token bucket rate limiter

Zero cloud SDKs. Zero external service clients (beyond the optional SMTP server you configure). Zero analytics or telemetry libraries.

HitKeep uses the IP2Location LITE database for IP geolocation. See IP2Location and IP2Location LITE. Maintainers generate the embedded assets with go run ./cmd/ipmeta-generate, using the same public DB1 ZIP sources as github.com/phuslu/iploc for country data plus the IP2Location LITE DB3 IPv6 BIN and ASN IPv6 BIN packages for city, provider, and ASN data. Runtime lookup never downloads data.

AI visibility does not add a separate crawler service. Browser-referred visits come through hk.js, and AI crawler fetches are accepted through an authenticated server-side ingest endpoint.


The full source — Go backend, Angular dashboard, tracker snippet — is on GitHub under the MIT license.