Railway

Deploy Plausible

Google analytics alternative. Privacy-first web analytics, custom events

Deploy Plausible

/var/lib/postgresql/data

Just deployed

/data

/var/lib/clickhouse

/var/lib/plausible

plausible-storage

Bucket

Just deployed

Plausible logo

Deploy and Host Plausible on Railway

Plausible is open source, privacy-friendly web analytics: a lightweight script that tells you how many people visited your site, where they came from and which pages they read — without cookies, cross-site tracking or personal data. It suits teams dropping Google Analytics who still need real numbers, and anyone answering a GDPR, CCPA or PECR question about their analytics.

Deploy Plausible Community Edition and self-host Plausible on Railway with its data layer already wired together: the app (ghcr.io/plausible/community-edition), PostgreSQL for accounts and settings, ClickHouse for the events, and Mailpit as the mail service that makes invitations and password resets work on day one. ClickHouse carries the configuration Plausible's own compose file recommends, baked into a source image at gridalpha/plausible-clickhouse-railway. The app is the only service on the public internet; both databases and SMTP stay private.

Plausible Railway architecture

Getting Started with Plausible on Railway

Open the deployed app URL and you land on /register. Plausible has no default password: the first visitor creates the owner account and registration then closes itself, so do this as soon as the deploy finishes. Enter a name, email and a password of at least 12 characters to reach onboarding. Add the naked domain you want to measure — example.com, no https://, no www — pick a reporting timezone, and Plausible hands you a one-line script tag for your site's ``. Once traffic arrives the dashboard shows visitors, sources, top pages, countries and devices live. To check the stack, request /api/health: it reports postgres and clickhouse separately.

Plausible dashboard showing visitor traffic, sources and top pages Plausible location map, browser breakdown and goal conversion rates Plausible site settings listing custom event goals

About Hosting Plausible

Plausible is an Elixir application that ingests page views over HTTP and answers dashboard queries from ClickHouse, a columnar database built for this workload. Self-host it when analytics data must stay on infrastructure you control, or for unlimited page views with no per-event bill.

  • Cookieless tracking, so no consent banner is required in most jurisdictions
  • A ~1 KB script, roughly 75× smaller than Google Analytics' tag
  • Goals and custom events with conversion rates on the same screen
  • UTM campaign tracking, referrer and channel attribution
  • Country, region and city geolocation from a bundled DB-IP database
  • A public Stats API, shareable dashboards, email reports

PostgreSQL holds users, teams, sites, goals and settings. ClickHouse holds every event and session, which is what makes a query over millions of rows return instantly. Mailpit accepts mail over the private network and gives you a web inbox — since new accounts arrive by invitation, that mail path is what lets you add colleagues.

Why Deploy Plausible on Railway

Railway removes the operational work that makes self-hosted analytics unattractive.

  • No Docker Compose, volume or ClickHouse tuning to maintain
  • Both databases on private networking, never the public internet
  • Managed TLS and a custom domain in two clicks
  • Persistent volumes for event data and exports
  • One-click redeploys when a new release ships

Common Use Cases

  • Replacing Google Analytics on marketing sites and docs portals where a consent banner hurts conversion
  • Measuring signups by defining custom events as goals, then reading conversion rate per source
  • Running analytics for client sites from one instance, each dashboard shared read-only via a link
  • Keeping visitor data in your own infrastructure for a data-residency or procurement requirement

Dependencies for Plausible

  • Plausible Community Editionghcr.io/plausible/community-edition:latest
  • PostgreSQL — Railway managed database: accounts, sites, goals, settings
  • ClickHousegridalpha/plausible-clickhouse-railway on clickhouse/clickhouse-server:24.12-alpine: events and sessions
  • Mailpitaxllent/mailpit:latest, SMTP plus web inbox for invitations

Environment Variables Reference

VariableDescriptionRequired
BASE_URLPublic URL, used in every generated linkYes
SECRET_KEY_BASESession signing key, 64+ charactersYes
DATABASE_URLPostgreSQL connection stringYes
CLICKHOUSE_DATABASE_URLClickHouse connection string with database nameYes
PORTListen port; used when HTTP_PORT is unsetYes
DISABLE_REGISTRATIONtrue, false or invite_only; first account always allowedNo
SMTP_HOST_ADDRSMTP relay host; without one, mail goes direct on port 25No
MAXMIND_LICENSE_KEYSwaps the bundled country database for MaxMind city dataNo
GOOGLE_CLIENT_IDSearch Console data and Google Analytics importNo

Deployment Dependencies

Plausible vs Google Analytics vs Umami

PlausibleGoogle Analytics 4Umami
Open sourceYes (AGPL-3.0)NoYes (MIT)
Self-hostableYesNoYes
Consent bannerNot neededRequiredNot needed
Script size~1 KB~45 KB~2 KB
Event storageClickHouseGoogle-ownedPostgreSQL or MySQL

GA4 goes deeper if you live inside Google's ad stack and accept the consent burden. Umami is lighter because it needs no ClickHouse, but Plausible pulls ahead on goals, campaign attribution and its Stats API.

Server Requirements to Self-Host Plausible

ClickHouse, not Plausible, sets the floor here.

ResourceMinimumRecommended
CPU2 vCPU4 vCPU
RAM2 GB4–8 GB
Storage10 GB25 GB+, growing with event volume
PostgreSQL12+16 or newer
ClickHouse23.3+24.12

ClickHouse needs SSE 4.2 or ARM NEON. Compressed events run to tens of bytes each, so disk grows slowly even at millions of page views.

How to Self-Host Plausible Outside Railway

Plausible publishes a reference Docker Compose setup. Clone it, set the two required values, start it:

git clone -b v3.2.1 --single-branch https://github.com/plausible/community-edition plausible-ce
cd plausible-ce
echo "BASE_URL=https://analytics.example.com" > .env
echo "SECRET_KEY_BASE=$(openssl rand -base64 48)" >> .env
docker compose up -d

Plausible listens on port 8000, so put a reverse proxy in front and terminate TLS there. Add the tracking snippet to every page you want measured, using the domain you registered:

Server-side and mobile events reach the same instance over the Events API:

curl -X POST https://analytics.example.com/api/event \
  -H "Content-Type: application/json" \
  -H "User-Agent: Mozilla/5.0" \
  -d '{"name":"Signup","url":"https://example.com/pricing","domain":"example.com"}'

How Much Does Plausible Cost to Self-Host?

The Community Edition is free and open source under AGPL-3.0, so there is no licence fee at any traffic level, and on Railway you pay only for the compute, memory and volume storage the four services use. Plausible's hosted cloud starts around $9/month for 10k monthly page views and carries a few features the Community Edition does not: marketing funnels, user journeys, revenue goals, SSO and the Sites API. Otherwise self-hosting gets unlimited page views for the cost of a small container plus a database.

FAQ

What is Plausible and why self-host it? Plausible is a lightweight, open source, privacy-friendly analytics tool and a direct Google Analytics alternative. Self-hosting keeps visitor records on infrastructure you control and removes per-page-view billing.

What does this Railway template deploy? Plausible Community Edition on a public URL, a managed PostgreSQL database, a ClickHouse database pre-configured for Plausible, and Mailpit for outgoing mail.

Why does the template include both PostgreSQL and ClickHouse? Plausible requires both. PostgreSQL stores accounts, sites, goals and settings; ClickHouse stores the event stream, and being columnar keeps queries fast at millions of page views.

How do I create the first admin user in self-hosted Plausible? Visit the deployed URL and register. Plausible exempts the first account from the registration restriction, so no default credentials exist. Afterwards /register redirects to login and users join by invitation.

Do I need a cookie consent banner with Plausible? No. Plausible sets no cookies and collects no personal data or persistent identifiers, which is why it generally falls outside GDPR, CCPA and PECR consent rules.

Can I send events from a backend or mobile app instead of the script? Yes. POST /api/event accepts JSON with name, url and domain plus a User-Agent header — that is how you track server-side conversions or anything a browser script cannot see.


Template Content

More templates in this category

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

zǝʇɹoɔ oɓıɹpoɹ
19
View Template
SubTrackr
Self-hosted Subscription Tracker

amnesia
3