📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!
TypeScript chartsclickhousedockergdprgoogle-analyticsmetricsmonitoringmysqlnestjsprivacyredisself-hostedselfhostedstatisticstailwindcssweb-analyticswebanalyticswebsite
# Auth
TWO_FACTOR_AUTHENTICATION_APP_NAME=Swetrix
# App
CLIENT_URL='http://localhost:3000'
# Secret key base that will be used for stuff like JWT auth tokens
# Can be generated via: openssl rand -base64 48
SECRET_KEY_BASE=
# Time in seconds
# 30 minutes
JWT_ACCESS_TOKEN_LIFETIME=1800
# 30 days
JWT_REFRESH_TOKEN_LIFETIME=2592000
# Database
MYSQL_HOST=localhost
MYSQL_USER=root
MYSQL_ROOT_PASSWORD=
MYSQL_DATABASE=analytics
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_USER=default
REDIS_PASSWORD=
CLICKHOUSE_HOST=http://localhost
CLICKHOUSE_USER=default
CLICKHOUSE_PORT=8123
CLICKHOUSE_PASSWORD=
CLICKHOUSE_DATABASE=analytics
# EMAIL SERVICE
SMTP_HOST=localhost
SMTP_PORT=1025
SMTP_USER=smtp_user_name
SMTP_PASSWORD=smtp_password
[email protected]
# Use SMTP_MOCK variable for development, leave empty when in production
SMTP_MOCK=true
# Community Edition (Selfhosted) configuration
DISABLE_REGISTRATION=true
DEBUG_MODE=
IP_GEOLOCATION_DB_PATH=
# Public URL of the Swetrix CE instance (used by the API for the Google Search
# Console OAuth redirect URI: ${BASE_URL}/gsc-connected). Must exactly match the
# redirect URI configured in the Google Cloud Console OAuth client.
BASE_URL=
OIDC_ENABLED=false
OIDC_ONLY_AUTH=false
OIDC_DISCOVERY_URL=http://localhost:8080/.well-known/openid-configuration
OIDC_CLIENT_ID=
OIDC_CLIENT_SECRET=
OIDC_PROMPT=select_account
# Google SSO
GOOGLE_OAUTH2_CLIENT_ID=
GOOGLE_OAUTH2_CLIENT_SECRET=
# Google Search Console integration (Cloud and Community Edition).
# The OAuth client's Authorized redirect URI must be set to ${BASE_URL}/gsc-connected.
GOOGLE_GSC_CLIENT_ID=
GOOGLE_GSC_CLIENT_SECRET=
# Google Analytics 4 Import
GOOGLE_GA4_CLIENT_ID=
GOOGLE_GA4_CLIENT_SECRET=
# Github SSO
GITHUB_OAUTH2_CLIENT_ID=
GITHUB_OAUTH2_CLIENT_SECRET=
# Integrations
ENABLE_INTEGRATIONS=false
ENABLE_TELEGRAM_INTEGRATION=false
# Telegram integration
TELEGRAM_BOT_TOKEN=''
# Web Push (VAPID) - required to enable browser push notifications channels.
# Generate a fresh keypair with: npx web-push generate-vapid-keys
# VAPID_SUBJECT must be a mailto: URI or HTTPS URL identifying you as the sender.
VAPID_PUBLIC_KEY=
VAPID_PRIVATE_KEY=
VAPID_SUBJECT='mailto:[email protected]'
# Paddle
PADDLE_VENDOR_ID=
PADDLE_API_KEY=
# Sentry
SENTRY_ENABLED=false
SENTRY_DSN=''
# What header should be used to get IP address (e.g. cf-connecting-ip, x-real-ip, etc.)
# Default: x-forwarded-for
CLIENT_IP_HEADER=cf-connecting-ip
# Load balancing
IS_PRIMARY_NODE=true
# Generic
EMAIL_ACTION_ENCRYPTION_KEY=
# Admin panel (Cloud edition only)
# Comma-separated list of user emails allowed to access the /admin web panel.
# If unset, the admin panel is disabled entirely.
ADMIN_EMAILS=
# Swetrix Enterprise (Cloud)
SWETRIX_LICENSE_KEY=
# Hetzner S3 storage defaults. Session Replay uses these when the
# SESSION_REPLAY_S3_* variables below are not set.
# HETZNER_S3_ENDPOINT is the location endpoint, for example https://fsn1.your-objectstorage.com.
# Do not include the bucket path in HETZNER_S3_ENDPOINT.
HETZNER_S3_ENDPOINT=
HETZNER_S3_BUCKET=
HETZNER_S3_ACCESS_KEY_ID=
HETZNER_S3_SECRET_ACCESS_KEY=
# S3-compatible storage for Session Replays (Cloud and Community Edition).
# SESSION_REPLAY_S3_ENDPOINT is the location endpoint, for example https://fsn1.your-objectstorage.com.
# Do not include the bucket path in SESSION_REPLAY_S3_ENDPOINT.
SESSION_REPLAY_S3_ENDPOINT=
SESSION_REPLAY_S3_BUCKET=
# Signing region. Defaults to the Hetzner location, or us-east-1 for other providers.
SESSION_REPLAY_S3_REGION=
# Set true for MinIO or providers requiring endpoint/bucket/key URLs.
SESSION_REPLAY_S3_FORCE_PATH_STYLE=false
SESSION_REPLAY_S3_ACCESS_KEY_ID=
SESSION_REPLAY_S3_SECRET_ACCESS_KEY=
# OpenRouter API key for AI features
OPENROUTER_API_KEY=
SWETRIX_PID=STEzHcB1rALV
SWETRIX_CDN_URL=https://cdn.swetrix.com
SWETRIX_CDN_TOKEN=
# RankPine -> Swetrix blog publishing (Cloud edition only)
RANKPINE_BLOG_WEBHOOK_SECRET=
RANKPINE_BLOG_GITHUB_TOKEN=
RANKPINE_BLOG_GITHUB_REPOSITORY=Swetrix/blog-posts
RANKPINE_BLOG_GITHUB_BRANCH=main
RANKPINE_BLOG_SITE_URL=https://swetrix.com
RANKPINE_BLOG_LANGUAGE=en
RANKPINE_BLOG_TIME_ZONE=Europe/London
RANKPINE_BLOG_AUTHOR='Andrii Romasiun'
RANKPINE_BLOG_TWITTER_HANDLE=andrii_rom
RANKPINE_BLOG_COMMITTER_NAME='Swetrix Content Bot'
[email protected]
# Delay before the live checkout pulls the new blog commit from GitHub.
RANKPINE_BLOG_REFRESH_DELAY_MS=30000
# IndexNow URL submission (Cloud edition only)
# Use the same key in the web service so /{key}.txt can verify ownership.
INDEXNOW_KEY=
# Managed reverse proxy ("Bypass adblockers") edge auth
# Shared secret the proxy.swetrix.org edge box sends in `X-Edge-Api-Key` to
# call the /v1/proxy-domain/allow and /v1/proxy-domain/active endpoints.
# Generate with: openssl rand -hex 32
# Leave blank if you don't run the managed reverse proxy edge - the endpoints
# fail closed (404) when this is unset.
MANAGED_PROXY_EDGE_API_KEY=
MANAGED_PROXY_DOMAIN_CONNECT_ENABLED=false
MANAGED_PROXY_DOMAIN_CONNECT_KEY_ID=_dcpubkeyv1
MANAGED_PROXY_DOMAIN_CONNECT_PRIVATE_KEY=
# Public demo project synthetic data generator
DEMO_DATA_ENABLED=false
# S3 prefix containing demo replay folders, for example demo-replays/1/*.json.gz.
# Every direct replay folder under this prefix is grouped into one demo replay.
DEMO_REPLAY_OBJECT_PREFIX=
# The web app IPs - rate limits are ignored for these IP addresses
TRUSTED_PROXY_IPS=