Favicon of Swetrix

Swetrix

Gain real-time, GDPR-compliant web analytics without cookie banners. Monitor performance, track custom events, and analyze user sessions with full data control.

Gain deep insights into your website traffic while fully respecting user privacy. This open-source analytics platform provides a comprehensive suite of tracking tools that operate entirely without cookies, meaning you never have to display intrusive consent banners. Built for developers and marketers alike, it offers a lightweight script that integrates seamlessly with any tech stack in minutes.

Enjoy a clean, intuitive dashboard that delivers actionable data without the steep learning curve of traditional analytics platforms.

Key features include:

  • Privacy-first tracking: Stay fully GDPR-compliant with anonymous data collection.
  • Custom events and goals: Measure what matters by tracking signups and purchases.
  • Performance monitoring: Catch slowdowns and monitor real page load times.
  • Error tracking: Automatically detect JavaScript errors across devices.
  • Session analysis: Follow user journeys to understand site navigation.

Directory Structure

swetrix
data
clickhouse
postgres
redis
.env
docker-compose.yml

docker-compose.yml

services:
  postgres:
    image: postgres:15-alpine
    container_name: swetrix_postgres
    restart: unless-stopped
    environment:
      POSTGRES_USER: ${POSTGRES_USER}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
      POSTGRES_DB: ${POSTGRES_DB}
    volumes:
      - ./data/postgres:/var/lib/postgresql/data
    networks:
      - swetrix-network

  redis:
    image: redis:7-alpine
    container_name: swetrix_redis
    restart: unless-stopped
    command: redis-server --requirepass ${REDIS_PASSWORD}
    volumes:
      - ./data/redis:/data
    networks:
      - swetrix-network

  clickhouse:
    image: clickhouse/clickhouse-server:23-alpine
    container_name: swetrix_clickhouse
    restart: unless-stopped
    environment:
      CLICKHOUSE_DB: ${CLICKHOUSE_DB}
      CLICKHOUSE_USER: ${CLICKHOUSE_USER}
      CLICKHOUSE_PASSWORD: ${CLICKHOUSE_PASSWORD}
      CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT: 1
    volumes:
      - ./data/clickhouse:/var/lib/clickhouse
    ulimits:
      nofile:
        soft: 262144
        hard: 262144
    networks:
      - swetrix-network

  api:
    image: swetrix/api:latest
    container_name: swetrix_api
    restart: unless-stopped
    depends_on:
      - postgres
      - redis
      - clickhouse
    ports:
      - "${API_PORT}:3000"
    environment:
      DB_CONNECTION_STRING: postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}
      REDIS_URL: redis://:${REDIS_PASSWORD}@redis:6379
      CLICKHOUSE_HOST: http://clickhouse:8123
      CLICKHOUSE_USER: ${CLICKHOUSE_USER}
      CLICKHOUSE_PASSWORD: ${CLICKHOUSE_PASSWORD}
      CLICKHOUSE_DB: ${CLICKHOUSE_DB}
      JWT_SECRET: ${JWT_SECRET}
      MAIL_HOST: ${SMTP_HOST}
      MAIL_PORT: ${SMTP_PORT}
      MAIL_USER: ${SMTP_USER}
      MAIL_PASSWORD: ${SMTP_PASSWORD}
      MAIL_FROM: ${SMTP_FROM}
      # Set to true to disable new user registration
      REGISTRATION_DISABLED: ${REGISTRATION_DISABLED}
    networks:
      - swetrix-network

  cron:
    image: swetrix/api:latest
    container_name: swetrix_cron
    restart: unless-stopped
    depends_on:
      - postgres
      - redis
      - clickhouse
    command: node cron.js
    environment:
      DB_CONNECTION_STRING: postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}
      REDIS_URL: redis://:${REDIS_PASSWORD}@redis:6379
      CLICKHOUSE_HOST: http://clickhouse:8123
      CLICKHOUSE_USER: ${CLICKHOUSE_USER}
      CLICKHOUSE_PASSWORD: ${CLICKHOUSE_PASSWORD}
      CLICKHOUSE_DB: ${CLICKHOUSE_DB}
    networks:
      - swetrix-network

  client:
    image: swetrix/client:latest
    container_name: swetrix_client
    restart: unless-stopped
    depends_on:
      - api
    ports:
      - "${CLIENT_PORT}:80"
    environment:
      API_URL: ${PUBLIC_API_URL}
    networks:
      - swetrix-network

networks:
  swetrix-network:
    driver: bridge

.env

# General Configuration
CLIENT_PORT=80
API_PORT=3000
PUBLIC_API_URL=http://localhost:3000
REGISTRATION_DISABLED=false

# Postgres Configuration
POSTGRES_USER=swetrix
POSTGRES_PASSWORD=your_secure_postgres_password
POSTGRES_DB=swetrix

# ClickHouse Configuration
CLICKHOUSE_USER=swetrix
CLICKHOUSE_PASSWORD=your_secure_clickhouse_password
CLICKHOUSE_DB=swetrix

# Redis Configuration
REDIS_PASSWORD=your_secure_redis_password

# Security
JWT_SECRET=your_very_long_random_secret_string

# SMTP Configuration (Optional)
SMTP_HOST=smtp.example.com
SMTP_PORT=587
SMTP_USER=your_smtp_user
SMTP_PASSWORD=your_smtp_password
SMTP_FROM=noreply@example.com
Categories:

Share:

Ad
Favicon

 

  
 

Similar to Swetrix

Favicon

 

  
  
Favicon

 

  
  
Favicon