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
| Layer | Technology |
|---|---|
| Backend | Go (Gin framework), gRPC for internal services, Redis for caching |
| Database | PostgreSQL (relational schema) + ClickHouse or TimescaleDB for time‑series event storage |
| Message Queue | NATS Streaming / RabbitMQ for asynchronous processing of events |
| Frontend | React with TypeScript, Vite build pipeline |
| Containerization | Docker 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.shwizard reduces onboarding friction. - Testing – The repository includes unit and integration tests; CI pipelines run on GitHub Actions, ensuring rapid feedback for contributors.
Use Cases
- Privacy‑Aware SaaS – Companies that must avoid cookie banners can deploy Swetrix to comply with GDPR/CCPA while still tracking user engagement.
- High‑Traffic Websites – The event‑driven architecture scales horizontally, making it suitable for sites with millions of pageviews per day.
- Internal Analytics – Teams can host Swetrix on a private network, retaining full data ownership and eliminating third‑party data leakage.
- 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
Related Apps in data-analysis
Uptime Kuma
Self-hosted uptime monitoring for all services
Apache Superset
Open‑source BI for fast, no‑code data exploration
Metabase
Easy open‑source business intelligence for everyone
Netron
Visualize AI models in any browser or desktop
Umami
Privacy‑focused, lightweight web analytics
PostHog
Open‑source product analytics and experimentation platform
Weekly Views
Repository Health
Information
Explore More Apps
Misago
Modern, feature-rich forum software for self-hosting
Maloja
Track your music listening history, no frills
Halo
Powerful and easy‑to‑use open‑source website builder
Bagisto
Open‑source Laravel eCommerce for marketplaces and omni‑channel sales
juntagrico
Community garden management made simple
Stalwart Mail Server
Secure, scalable mail and collaboration platform
