plausible/analytics architecture diagram
How plausible/analytics is built, drawn from its code at 1264998 on 2026-11-08 by Plotix's agent.
System overview
What runs in Plausible and what talks to what: the browser tracker, the Phoenix web app, the ingest path, the stats engine, background jobs and the two databases.
Open the picture for full size (SVG).
Parts
- Visitor browser
- Tracker script
plausible.js snippet · Sends events with fetch - Web app and API
Router and controllers · Dashboard LiveViews · Auth and sessions - Ingestion
Request build and validation · Event and session build · Buffered writes - Stats query engine
Query parsing · SQL builder · Query runner - Background jobs
Email reports · Analytics imports · Billing and usage checks - In-memory caches
Site cache · Sessions cache · Shield rule caches - IP, UA and referrer lookups
- PostgreSQL
Users and teams · Sites and goals · Billing state - ClickHouse
events_v2 table · sessions_v2 table · Imported analytics - Google Analytics API
- Paddle billing
- Postmark email
How they connect
- Visitor browser → Tracker script loads script
- Tracker script → Ingestion POST /api/event
- Visitor browser → Web app and API Dashboard pages
- Web app and API → Stats query engine Stats queries
- Web app and API → PostgreSQL
- Stats query engine → ClickHouse
- Ingestion → ClickHouse
- Ingestion → In-memory caches
- Ingestion → IP, UA and referrer lookups Parse UA and referrer
- Background jobs → PostgreSQL
- Background jobs → Postmark email Send reports
- Background jobs → Google Analytics API Fetch GA4 data
- Paddle billing → Web app and API Billing webhooks
Event ingestion
How one tracker event becomes a row in ClickHouse: POST /api/event, request validation, event and session build, buffered writes.
Open the picture for full size (SVG).
Parts
- Tracker POST /api/event
- Build request
- Validate payload
- Build event
- Session lookup
- Event write buffer
- Session write buffer
- events_v2
- sessions_v2
How they connect
- Tracker POST /api/event → Build request
- Build request → Validate payload
- Validate payload → Build event
- Build event → Session lookup
- Session lookup → Event write buffer
- Session lookup → Session write buffer
- Event write buffer → events_v2
- Session write buffer → sessions_v2
Deployment
Where the release runs in self-hosted and cloud setups, and which stores and external APIs it reaches.
Open the picture for full size (SVG).
Parts
- Visitor device
- HTTPS endpoint
- Plausible release
- Erlang cluster (cloud)
- PostgreSQL
- ClickHouse
- S3 storage
- Third-party APIs
How they connect
- Visitor device → HTTPS endpoint HTTPS requests
- HTTPS endpoint → Plausible release HTTP
- Plausible release → Erlang cluster (cloud) Node discovery
- Plausible release → PostgreSQL SQL
- Plausible release → ClickHouse SQL over HTTP
- Plausible release → S3 storage S3 API
- Plausible release → Third-party APIs HTTPS API
Data model
Main records: accounts, teams, sites, goals and the stored events they own.
Open the picture for full size (SVG).
Parts
- User
email: string · name: string · totp_enabled: boolean - Team
name: string · plan: string - Team membership
role: string - Invitation
email: string · role: string - Subscription
plan: string · status: string - Site
domain: string · timezone: string - Goal
event_name: string · page_path: string - Segment
name: string · filters: json - Annotation
text: string · date: date - API key
name: string · scopes: list - Stored event
name: string · pathname: string · timestamp: datetime
How they connect
- User → Team membership
- Team → Team membership
- Team → Invitation
- Team → Subscription
- Team → Site
- Site → Goal
- Site → Segment
- Site → Annotation
- Site → Stored event
- User → API key
Draw your own repo
Plotix's agent reads your code and draws its architecture, and the diagram warns you when the code moves on.
Try Plotix