MCPSERV.CLUB
Swetrix

Swetrix

Self-Hosted

Privacy‑first web analytics without cookies

Active(85)
56stars
0views
Updated 13 days ago
Swetrix screenshot 1
1 / 5

Overview

Discover what makes Swetrix powerful

Swetrix is a self‑hosted, privacy‑centric analytics platform that replaces cookie‑based solutions such as Google Analytics. From a technical standpoint, it exposes a lightweight JavaScript tracking snippet (< 5 KB) that sends anonymized events to a backend API. The backend aggregates these events, performs real‑time analytics, and exposes a RESTful interface for dashboards, custom reports, and webhooks. The architecture is deliberately modular: the front‑end portal, API server, worker queues, and data store are decoupled, allowing developers to swap components or scale parts independently.

Cookieless Tracking

Event‑Driven Model

Real‑time Dashboards

Extensible via Webhooks

Overview

Swetrix is a self‑hosted, privacy‑centric analytics platform that replaces cookie‑based solutions such as Google Analytics. From a technical standpoint, it exposes a lightweight JavaScript tracking snippet (< 5 KB) that sends anonymized events to a backend API. The backend aggregates these events, performs real‑time analytics, and exposes a RESTful interface for dashboards, custom reports, and webhooks. The architecture is deliberately modular: the front‑end portal, API server, worker queues, and data store are decoupled, allowing developers to swap components or scale parts independently.

Key Features

  • Cookieless Tracking – Uses fingerprinting and session IDs that respect user privacy while still providing granular traffic insights.
  • Event‑Driven Model – Custom events, UTM parsing, and session analytics are all exposed via the API.
  • Real‑time Dashboards – WebSocket or SSE streams feed live metrics to the portal.
  • Extensible via Webhooks – External services can subscribe to events such as new sessions or pageviews.
  • Open‑Source API – The REST endpoints are fully documented, enabling third‑party integrations or automated reporting.

Technical Stack

LayerTechnology
BackendGo (Gin framework), gRPC for internal services, Redis for caching
DatabasePostgreSQL (relational schema) + ClickHouse or TimescaleDB for time‑series event storage
Message QueueNATS Streaming / RabbitMQ for asynchronous processing of events
FrontendReact with TypeScript, Vite build pipeline
ContainerizationDocker Compose orchestrates services; optional Kubernetes Helm chart for production deployments

The use of Go ensures low memory footprint and high concurrency, while PostgreSQL guarantees ACID compliance for configuration data. Time‑series databases accelerate query performance on pageviews and events, enabling the 0‑second latency dashboards highlighted in the marketing copy.

Deployment & Infrastructure

Swetrix ships as a Docker Compose stack that can be dropped into any Linux environment. The configure.sh script generates an .env file with all required variables (DB URLs, JWT secrets, etc.). For larger deployments, the architecture supports horizontal scaling by replicating the API and worker containers behind a load balancer. The database can be sharded or replicated; ClickHouse is recommended for high‑write workloads. Helm charts simplify Kubernetes deployments, exposing configurable resource limits and persistence options.

Integration & Extensibility

Developers can hook into Swetrix via:

  • REST API – CRUD operations for projects, users, and event schemas.
  • Webhooks – POST callbacks on session start/stop or custom events.
  • SDKs – A lightweight JavaScript SDK that abstracts cookie‑less fingerprinting and event payload construction.
  • Plugin System – The backend exposes a plugin interface; community plugins (e.g., custom export to Slack or Datadog) can be added without modifying core code.

The plugin architecture uses Go plugins (.so files), allowing dynamic loading of new functionality at runtime. This makes it straightforward to extend Swetrix with custom analytics pipelines or compliance checks.

Developer Experience

  • Documentation – The official docs cover self‑hosting, API usage, and plugin development in depth.
  • Community – Active Discord channel for real‑time support, GitHub issues for feature requests, and a public roadmap.
  • Configuration – Environment variables are self‑descriptive; the configure.sh wizard reduces onboarding friction.
  • Testing – The repository includes unit and integration tests; CI pipelines run on GitHub Actions, ensuring rapid feedback for contributors.

Use Cases

  1. Privacy‑Aware SaaS – Companies that must avoid cookie banners can deploy Swetrix to comply with GDPR/CCPA while still tracking user engagement.
  2. High‑Traffic Websites – The event‑driven architecture scales horizontally, making it suitable for sites with millions of pageviews per day.
  3. Internal Analytics – Teams can host Swetrix on a private network, retaining full data ownership and eliminating third‑party data leakage.
  4. Custom Dashboards – Developers can build bespoke visualizations by consuming the API or subscribing to webhooks, integrating analytics into existing admin panels.

Advantages

  • Performance – Go + ClickHouse delivers sub‑second query times even under heavy load.
  • Flexibility – Open‑source core and plugin system allow tailoring to niche metrics or compliance needs.
  • Licensing – MIT license permits commercial use without royalties, unlike proprietary analytics platforms.
  • Data Ownership – All data resides on your infrastructure; no data is sent to external cloud providers.
  • Lightweight Frontend – The 5 KB script minimizes bandwidth impact and speeds up page load times.

In summary, Swetrix offers developers a robust, privacy‑first analytics stack that can be deployed on-premises or in the cloud. Its modular architecture, comprehensive API surface, and strong community support make it an attractive alternative for teams that demand full control over their analytics data without sacrificing insight quality.

Open SourceReady to get started?

Join the community and start self-hosting Swetrix today