Railway

Deploy Betterlytics | (Just Updated) Cookieless Analytics That Keeps Recording After a Redeploy

Google Analytics alternative whose ClickHouse logins survive a redeploy

Deploy Betterlytics | (Just Updated) Cookieless Analytics That Keeps Recording After a Redeploy

/var/lib/clickhouse

Just deployed

Just deployed

/var/lib/postgresql

Deploy and Host Betterlytics on Railway

Betterlytics is a cookieless, privacy-first web analytics platform — a self-hosted Google Analytics alternative with real-time traffic, funnels, campaign tracking and per-site dashboards, backed by ClickHouse for event storage and PostgreSQL for accounts and site configuration.

About Hosting Betterlytics

This template runs the official Betterlytics self-host image behind an in-container nginx gateway, with PostgreSQL and ClickHouse as separate services, each on its own volume. The ClickHouse service creates the backend and dashboard roles and their grants on every boot rather than only on an empty data directory, so a container recreate does not leave the application unable to authenticate against its own event store. The administrator account is seeded from the deploy's variables before the public port is ever opened, and it is re-applied on each boot, so a redeploy is a working password reset. The tracking endpoint is rate-limited per client using the first address of X-Forwarded-For — Railway's edge address rotates per request, so a limiter keyed on the socket peer is one shared bucket for the whole internet. A DB-IP Lite country database is baked into the image, so the Geography breakdown works with no MaxMind account. A supervisord event listener stops the container when any managed process dies permanently, so a broken dashboard fails the deploy instead of passing a healthcheck that only proves the tracking backend answers.

Why Deploy Betterlytics on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying Betterlytics on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.

Common Use Cases

  • Replace Google Analytics on a marketing site or blog without cookie banners or consent flows.
  • Keep visitor analytics on infrastructure you control, in a region you choose.
  • Track campaigns, funnels and referrers for a SaaS product across several domains from one dashboard.
  • Give a client read-only analytics for their own site without handing over a Google account.

Dependencies for Betterlytics

  • PostgreSQL — accounts, sites and site configuration.
  • ClickHouse — the event store behind every report.

Deployment Dependencies

Implementation Details

The dashboard is bound to 0.0.0.0 inside the container. Next's standalone server treats an internationalisation rewrite whose origin differs from its own as an external request and proxies it back to itself, which turns every localised route into a redirect loop when the server is bound to loopback.

Why host Betterlytics with Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.


Template Content

More templates in this category

View Template
NEW
Betterlytics
Betterlytics is a cookieless analytics platform GDPR-compliant.

Anarchist Manifesto
22
View Template
Matomo Analytics + MariaDB
Privacy-friendly analytics with MariaDB and persistent volumes.

leodev
1
View Template
Bugsink
Self-hosted Error Tracking. Sentry-SDK compatible

nonzerosum
19