Initial vault setup
This commit is contained in:
@@ -0,0 +1,235 @@
|
||||
---
|
||||
title: Swetrix
|
||||
created: 2026-06-07
|
||||
updated: 2026-06-07
|
||||
type: app
|
||||
tags: [catalogue, web-analytics, privacy, self-hosted, analytics, typescript, nextjs, postgresql, clickhouse, gdpr]
|
||||
confidence: high
|
||||
contested: false
|
||||
sources: [https://selfh.st/apps/?tag=web-analytics]
|
||||
---
|
||||
|
||||
# 🌊 Swetrix
|
||||
|
||||
> Analytics web **privacy-first** complet et moderne, écrit en TypeScript, fork communautaire orienté **self-hosted** avec **ClickHouse** pour la performance.
|
||||
> Source : [selfh.st](https://selfh.st/apps/?tag=web-analytics)
|
||||
|
||||
## 📋 Métadonnées
|
||||
|
||||
| Métadonnée | Valeur |
|
||||
| :--- | :--- |
|
||||
| **Site web** | [swetrix.com](https://swetrix.com/) |
|
||||
| **GitHub** | [github.com/Swetrix/Swetrix](https://github.com/Swetrix/Swetrix) |
|
||||
| **License** | AGPL-3.0 |
|
||||
| **Langage** | TypeScript / Next.js / ClickHouse / PostgreSQL |
|
||||
| **Étoiles** | 58 |
|
||||
| **Dernière MAJ** | 2026-05 |
|
||||
| **Catégorie** | [[cat-web-analytics]] |
|
||||
|
||||
## 📝 Description
|
||||
|
||||
**Swetrix** est une plateforme d'**analyse web open source** et **privacy-first** qui se positionne comme une **alternative complète** à Plausible, avec un **accent particulier sur la performance** (utilisation de **ClickHouse** comme base analytique principale) et un **parc de fonctionnalités plus large** que la plupart des concurrents directs.
|
||||
|
||||
Concrètement, Swetrix vise à offrir **le meilleur des deux mondes** : la **simplicité d'installation** et la **philosophie privacy-first** de Plausible, avec la **richesse fonctionnelle** d'un outil plus complet (funnels, cohortes, alertes, alertes email, etc.). C'est l'un des projets qui a le plus gagné en **maturité** entre 2024 et 2026 dans l'écosystème self-hosted analytics.
|
||||
|
||||
Fonctionnalités principales : **tableau de bord multi-projets**, **événements personnalisés** illimités, **funnels de conversion** multi-étapes, **alertes email** sur seuils personnalisés (anomalies de trafic, conversions en chute…), **cohortes** et **rétention**, **dashboards publics** partageables, **session replay** (opt-in), **heatmaps** (opt-in), **API** REST + webhooks, **intégrations** natives (Slack, Discord, Telegram, webhooks custom), **export CSV/JSON**, **multi-utilisateurs** avec rôles, **Uptime monitoring** intégré.
|
||||
|
||||
L'éditeur propose une **offre cloud** (swetrix.com) avec pricing freemium et des **plans payants** au-delà d'un certain volume. La version **self-hosted** est **AGPL-3.0**, ce qui la rend **commercialement utilisable** en auto-hébergement. Le projet est **en croissance constante**, avec des releases fréquentes et une **communauté active**.
|
||||
|
||||
Idéal pour les **SaaS**, **e-commerce** et **sites à fort trafic** qui veulent **aller au-delà de Plausible** sans tomber dans la complexité de Matomo ou le coût de Google Analytics 360.
|
||||
|
||||
## 🚀 Installation
|
||||
|
||||
### Option 1 : Docker Compose (recommandé)
|
||||
|
||||
```yaml
|
||||
# docker-compose.yml
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
swetrix:
|
||||
image: ghcr.io/swetrix/swetrix:latest
|
||||
container_name: swetrix
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "3000:3000"
|
||||
environment:
|
||||
DATABASE_URL: postgresql://swetrix:***@postgres:5432/swetrix
|
||||
CLICKHOUSE_URL: http://clickhouse:8123
|
||||
REDIS_URL: redis://redis:6379
|
||||
JWT_SECRET: changez-jwt-secret-32-chars
|
||||
SWETRIX_PUBLIC_URL: https://swetrix.example.com
|
||||
NODE_ENV: production
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
clickhouse:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- swetrix-net
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "--spider", "-q", "http://localhost:3000/"]
|
||||
interval: 30s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
|
||||
postgres:
|
||||
image: postgres:16-alpine
|
||||
container_name: swetrix-postgres
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_DB: swetrix
|
||||
POSTGRES_USER: swetrix
|
||||
POSTGRES_PASSWORD: swetrix
|
||||
volumes:
|
||||
- ./postgres-data:/var/lib/postgresql/data
|
||||
networks:
|
||||
- swetrix-net
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U swetrix"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
clickhouse:
|
||||
image: clickhouse/clickhouse-server:24-alpine
|
||||
container_name: swetrix-clickhouse
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
CLICKHOUSE_DB: swetrix
|
||||
CLICKHOUSE_USER: swetrix
|
||||
CLICKHOUSE_PASSWORD: swetrix
|
||||
CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT: 1
|
||||
volumes:
|
||||
- ./clickhouse-data:/var/lib/clickhouse
|
||||
ulimits:
|
||||
nofile:
|
||||
soft: 262144
|
||||
hard: 262144
|
||||
networks:
|
||||
- swetrix-net
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8123/ping"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
container_name: swetrix-redis
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ./redis-data:/data
|
||||
networks:
|
||||
- swetrix-net
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "ping"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
networks:
|
||||
swetrix-net:
|
||||
driver: bridge
|
||||
```
|
||||
|
||||
Lancement :
|
||||
|
||||
```bash
|
||||
docker compose up -d
|
||||
# Accéder à http://localhost:3000
|
||||
# Créer le premier admin via l'UI
|
||||
# Créer ensuite un projet et copier l'ID de tracking
|
||||
```
|
||||
|
||||
### Option 2 : Installation manuelle (Node.js)
|
||||
|
||||
```bash
|
||||
git clone https://github.com/Swetrix/Swetrix.git
|
||||
cd Swetrix
|
||||
pnpm install
|
||||
# Configurer .env (DATABASE_URL, CLICKHOUSE_URL, REDIS_URL, JWT_SECRET)
|
||||
pnpm db:migrate
|
||||
pnpm build
|
||||
pnpm start
|
||||
```
|
||||
|
||||
Prérequis : **Node.js 20+**, **pnpm 9+**, **PostgreSQL 16+**, **ClickHouse 24+**, **Redis 7+**.
|
||||
|
||||
## ⚙️ Configuration
|
||||
|
||||
- **JWT_SECRET** : clé secrète pour signer les tokens, 32+ caractères, **obligatoire** en production.
|
||||
- **DATABASE_URL** : PostgreSQL pour les utilisateurs, projets, metadata.
|
||||
- **CLICKHOUSE_URL** : URL HTTP ClickHouse (défaut : `http://clickhouse:8123`).
|
||||
- **REDIS_URL** : pour le cache et la queue.
|
||||
- **SWETRIX_PUBLIC_URL** : URL publique servie par l'app.
|
||||
- **MAILER_*** : SMTP pour les alertes email (SendGrid, Postmark, SMTP générique).
|
||||
- **Snippet de tracking** :
|
||||
|
||||
```html
|
||||
<script async src="https://swetrix.example.com/swetrix.js"
|
||||
data-project-id="votre-project-id"></script>
|
||||
```
|
||||
|
||||
- **Événements custom** : `swetrix.track('event_name', { prop: 'value' })` côté navigateur.
|
||||
- **Session replay** : opt-in par projet, à activer depuis l'admin.
|
||||
- **Alertes** : définir des seuils depuis l'UI (notifications email/Slack/Discord).
|
||||
- **Multi-utilisateurs** : inviter des membres par projet ou par organisation.
|
||||
|
||||
## 🔄 Alternatives
|
||||
|
||||
**Open source** :
|
||||
- [[app-plausible]] — concurrent principal, plus simple
|
||||
- [[app-umami]] — plus mature, base PostgreSQL
|
||||
- [[app-matomo]] — analytics PHP complet
|
||||
- [[app-ackee]] — minimaliste Node.js
|
||||
- [[app-goatcounter]] — Go ultra-léger
|
||||
- [[app-open-web-analytics]] — PHP traditionnel
|
||||
- [[app-rybbit]] — TypeScript moderne
|
||||
- [[app-litlyx]] — TypeScript simple
|
||||
- [[app-vince]] — Go minimaliste
|
||||
|
||||
**Propriétaire (SaaS)** :
|
||||
- **Google Analytics 4** — leader, RGPD complexe
|
||||
- **Swetrix Cloud** — offre officielle (à partir de 9 $/mois)
|
||||
- **Plausible Cloud** — payant
|
||||
- **Fathom Analytics** — simple
|
||||
- **Simple Analytics** — design
|
||||
- **Umami Cloud** — service officiel
|
||||
- **Matomo Cloud** — version managée
|
||||
- **Mixpanel** — product analytics enterprise
|
||||
|
||||
## 🔒 Sécurité
|
||||
|
||||
- **JWT_SECRET** : clé critique, `openssl rand -base64 64` et stocker en secret manager.
|
||||
- **HTTPS obligatoire** : Traefik, Caddy ou Nginx avec Let's Encrypt (rate limits à configurer).
|
||||
- **ALLOWED_ORIGINS** : configurer **strictement** les domaines autorisés au tracking, sans wildcard.
|
||||
- **ClickHouse** : ne **jamais** exposer les ports 8123/9000 sur Internet — bind interne Docker uniquement.
|
||||
- **PostgreSQL** : idem, exposition interne uniquement, pas de port 5432 public.
|
||||
- **Redis** : bind interne, ou configurer `requirepass`.
|
||||
- **Sauvegardes** : `pg_dump` quotidien (PostgreSQL), `BACKUP DATABASE` pour ClickHouse.
|
||||
- Mettre à jour régulièrement — releases fréquentes, **suivre les breaking changes**.
|
||||
- **Rate limiting** sur `/api/event` : Swetrix dispose d'un rate limit Redis natif.
|
||||
- Restreindre l'accès admin via **2FA** et **IP allowlist**.
|
||||
- **fail2ban** sur l'API admin.
|
||||
- Surveiller les **logs d'accès** : les abus de tracking peuvent saturer l'instance.
|
||||
- Considérer un **WAF** (Crowdsec, Coraza) en amont pour bloquer les scans.
|
||||
|
||||
## 📚 Ressources
|
||||
|
||||
- [Site officiel](https://swetrix.com/)
|
||||
- [Documentation](https://docs.swetrix.com/)
|
||||
- [GitHub Swetrix/Swetrix](https://github.com/Swetrix/Swetrix)
|
||||
- [Démo live](https://swetrix.com/demo)
|
||||
- [Roadmap publique](https://github.com/Swetrix/Swetrix/projects)
|
||||
- [Self-hosting guide](https://docs.swetrix.com/self-hosting)
|
||||
|
||||
## 🔗 Pages Liées
|
||||
|
||||
- [[cat-web-analytics]]
|
||||
- [[recettes-docker-compose]]
|
||||
- [[app-plausible]]
|
||||
- [[app-umami]]
|
||||
- [[app-rybbit]]
|
||||
Reference in New Issue
Block a user