Plausible Analytics is a privacy-first, GDPR-friendly alternative to Google Analytics. It's lightweight (the tracking script is under 1 KB), doesn't use cookies, and gives you a clean single-page dashboard. Self-hosting it is the Community Edition path, and it requires understanding a two-database architecture. This guide walks through the full stack.
Plausible's architecture
Plausible's self-hosted Community Edition has three core parts:
| Component | Role |
|---|---|
| Plausible app (Elixir/Phoenix) | The web dashboard and event ingestion API |
| PostgreSQL | App metadata: users, sites, settings, subscriptions |
| ClickHouse | The analytics event store — where pageviews actually live |
The split is deliberate: PostgreSQL handles transactional metadata, while ClickHouse is a columnar database built for fast aggregation over billions of events. You need both. ClickHouse is what makes Plausible fast.
Step 1: Provision the databases
On PandaStack, provision a managed PostgreSQL instance for the app metadata. For ClickHouse, you'll run it as a container (or point at a managed ClickHouse if available in your setup). The Plausible team distributes a plausible/community-edition Docker image and documents the exact ClickHouse configuration it expects.
A minimal ClickHouse config for Plausible disables some logging tables to keep storage lean:
<!-- clickhouse config: low-cardinality logging tweaks -->
<yandex>
<logger><level>warning</level></logger>
<query_log remove="remove"/>
<query_thread_log remove="remove"/>
</yandex>Step 2: Configure the Plausible app
Plausible is configured via environment variables. The essentials:
BASE_URL=https://analytics.yourdomain.com
SECRET_KEY_BASE=<generate with: openssl rand -base64 64>
TOTP_VAULT_KEY=<generate with: openssl rand -base64 32>
# PostgreSQL
DATABASE_URL=postgres://user:pass@pg-host:5432/plausible_db
# ClickHouse
CLICKHOUSE_DATABASE_URL=http://clickhouse-host:8123/plausible_events_db
# Email for account verification
MAILER_EMAIL=noreply@yourdomain.com
SMTP_HOST_ADDR=smtp.yourprovider.com
SMTP_HOST_PORT=587
SMTP_USER_NAME=<user>
SMTP_USER_PWD=<pass>SECRET_KEY_BASE and TOTP_VAULT_KEY must be stable across restarts — pin them in your secret manager.
Step 3: Run migrations on first boot
Plausible's image includes a migration command that sets up both databases:
/entrypoint.sh db createdb
/entrypoint.sh db migrateRun this once as a release/pre-deploy command. It creates the ClickHouse event tables and the PostgreSQL schema.
Step 4: Deploy on PandaStack
The deployment is two or three apps depending on how you run ClickHouse:
- 1ClickHouse container app —
clickhouse/clickhouse-server, with the config above and a persistent volume for/var/lib/clickhouse. ClickHouse is stateful; it needs durable storage. - 2Plausible app container —
plausible/community-edition:v2, linked to managed PostgreSQL and pointed at ClickHouse via env vars. Bind to the injected port. - 3Run the migration command once, then start serving.
Attach a custom domain to the Plausible app; automatic SSL handles HTTPS, which matters because the tracking script must load over HTTPS.
Step 5: Add the tracking script
Once the app is up, register your site in the dashboard and add the snippet to your pages:
<script defer data-domain="yourdomain.com"
src="https://analytics.yourdomain.com/js/script.js"></script>Because the script is served from your own domain, it's far less likely to be blocked by ad blockers than third-party analytics — a nice side benefit of self-hosting.
Resource and scaling notes
- ClickHouse memory — ClickHouse likes RAM for query performance. On a tiny instance it works for low traffic but can struggle with large date-range queries. Use a memory-optimized tier as traffic grows.
- Storage growth — ClickHouse compresses events extremely well, but high-traffic sites still accumulate data. Plan storage and consider a retention policy.
- The Plausible app itself is light (Elixir is efficient); ClickHouse is the resource-hungry component.
Honest caveats
Self-hosting Plausible means you operate ClickHouse, which is the trickiest part. ClickHouse is powerful but has real operational depth — backups, upgrades, and config tuning are on you. If you just want privacy-friendly analytics without running a columnar database, the simpler Umami (PostgreSQL-only) may be a better fit. Also note the Community Edition's license terms and that some features land in the hosted product first. For a privacy-respecting, self-owned analytics stack, though, Plausible is hard to beat.
Wrapping up
Self-hosting Plausible is fundamentally about running two databases: PostgreSQL for metadata and ClickHouse for events. Provision both, pin your secrets, run the migrations, and deploy the Elixir app in front. You end up with fast, cookie-free, first-party analytics you fully control.
PandaStack's managed PostgreSQL plus persistent-volume container apps make standing up the Plausible stack approachable, and the free tier is enough for a low-traffic site. Start at https://dashboard.pandastack.io.
References
- Plausible Community Edition docs: https://github.com/plausible/community-edition
- Plausible self-hosting configuration: https://plausible.io/docs/self-hosting-configuration
- ClickHouse documentation: https://clickhouse.com/docs
- Plausible data policy / privacy: https://plausible.io/data-policy
- Phoenix/Elixir deployment: https://hexdocs.pm/phoenix/deployment.html