goatdash
English |
Español
A small, private dashboard for GoatCounter.
No cookies, no cloud, no framework, just static files.
Try the live demo → · Landing page · Run it locally
goatdash is a privacy-friendly dashboard for GoatCounter analytics. It runs entirely in the browser: no framework, no CDN, just a few static files that talk to the GoatCounter v0 API. The sources are TypeScript under src/, compiled with Vite to the same plain files that get shipped.
Why this stack?
- No framework, no CDN: the original loaded React, Recharts and Babel from unpkg. For a page that reads one JSON API and draws a few charts, that is weight it does not need. Plain TypeScript in
src/ compiled by Vite into a handful of static files: nothing to break when a CDN bumps a version.
- No backend of my own: goatdash speaks the GoatCounter API directly from the browser. There is no server to patch, no database to back up, no service to keep alive. Deployment is copying files.
- GoatCounter as the backend: a single lightweight binary with SQLite, privacy-first by design and trivial to self-host. The v0 API already exposes everything the dashboard shows: totals, pages, referrers, browsers, systems, sizes, locations, languages and campaigns.
- No backend patch for multi-site: GoatCounter resolves the site from the Host header, so each site lives at its own domain and the dashboard queries it there. One domain per site, all pointing at the same GoatCounter. The official binary does everything.
- What I did not pick: a backend of my own (another thing to maintain), a SaaS analytics product (the data would live on someone else's server), or the original's React stack (overkill for this).
Features
- Home with Plausible-style site cards: a grid of cards (three per row) with the account and its subsites from
/api/v0/sites. Each card shows unique visitors in the last 24h, an hourly sparkline and the trend vs the previous 24h. Sort by visitors or name, ascending or descending, and filter with a search box. Clicking a card opens that site's full dashboard; the house button in the topbar goes back home.
- Per-token site scope: the home lists only the sites the API key is allowed to read (
token.sites from /api/v0/me), so each key can be restricted to a subset of sites.
- Site precache: after the active site loads, goatdash warms the cache for the other sites in the background, so switching sites is almost instant. It only fetches the essential endpoints and cancels if you switch.
- Five KPI cards: unique visitors (with trend vs the previous period), pageviews, top page, tracked paths and total events, in a gapless grid.
- Top referrers by channel: global referrers grouped into direct, search engines, campaigns and other sites, with a drill-down from each referrer to the pages it brought. Rows with an HTTP referrer keep a link to the source page.
- Drill-down on every card: pages to their referrers, browsers/systems/devices to versions, countries to regions, campaigns to their referrer URLs.
- Choropleth world map: countries shaded by visits with a square-root scale so small markets stay visible, plus hover tooltips, a gradient legend, zoom, pan and reset.
- Grouped panels with tabs: Sources (referrers/languages), Content (pages/campaigns), Devices (browsers/systems/sizes) and Location (map/list) live in four tabbed cards on a 6-column grid (devices 1/3, location 2/3), each expandable to a full-screen modal.
- Rich date picker: today, yesterday, realtime (60s auto-refresh with LIVE badge), 7d, 30d, 90d, 365d, month/year to date, all time or a custom range, with automatic chart grouping and a comparison toggle that overlays the previous period (dashed line).
- Site settings editor: the site domain, collect flags, ignored IPs and data retention, written via
PATCH /api/v0/sites/{id}; read-only when the API key lacks the SiteUpdate permission.
- Event filter: one click narrows the dashboard to the paths GoatCounter marks as events, using
include_paths and path_by_name.
- CSV export: one click exports the visible dataset of pages, referrers, browsers, systems, devices, location or campaigns.
- Tri-state theme with anti-FOUC: dark, light or auto, from the user menu and applied before paint by an external
theme.js script that works with a strict default-src 'self' CSP.
- Instant reloads: a tiny service worker serves the app shell from the browser (stale-while-revalidate HTML, versioned assets cache-first), and API responses are cached per range, so a reload paints in milliseconds even on a slow connection.
- Installable: the release ships a web manifest and a service worker, so the browser installs it as an app that runs without the address bar. The menu has an install entry that uses the browser prompt, with a Share path hint on iOS.
- Language: ES/EN/Auto UI, persisted in localStorage.
- User menu with About: the menu opens from your user chip and shows the version (1.0.33) and a link to the source.
- Signed-in user in the topbar: a chip with your avatar and email from
/api/v0/me.
- Demo mode: one click loads the full dashboard with realistic sample data, no API key needed.
- Polite to the API: 60-second response cache, a small concurrent client that reads
X-Rate-Limit-Remaining and Retry-After and adapts so it never exceeds the server limit, per-card retry and an "updated Xs ago" freshness indicator.
- In-app update check: the gear menu has "Check for updates" which force-checks the latest GitHub release and tells you if you are up to date or shows a link to the release notes.
Screenshots
Home: site cards with 24h visitors, sparkline and trend
Referrers: top referrers grouped by channel with a drill-down
Countries: world map and top country list
Top pages: the expanded content panel with every tracked path
What to expect?
This is a personal project that I use every day, not a product. It is AGPL-3.0, and I answer issues and PRs at my own pace, with no SLA. With contributions or support it might grow faster, but I cannot promise anything.
Installation
There is no install script and nothing to compile on the server: the release tarball is a handful of ready-to-serve static files. Put them on any static host and open the page. The manifest and the service worker are included, so the browser can install it as an app that runs without the address bar.
# Try it locally
python3 -m http.server 8000
# open http://localhost:8000
For multi-site, each site lives at its own domain, all pointing at the same GoatCounter, and GoatCounter resolves the site from the Host header. The dashboard is just static files served from its own domain and queries each site cross-origin. A minimal server block for the dashboard:
server {
listen 80;
server_name stats.example.com;
root /var/www/goatdash;
index index.html;
# The index changes rarely; assets are versioned with ?v=N (see below).
add_header Cache-Control "no-store";
}
Requirements: any static web server and a GoatCounter instance whose v0 API is reachable over HTTPS from the browser. No Docker, no Node and no build tools on the server: the release tarball contains plain static files.
Cache busting
index.html loads its assets with a version query, for example app.js?v=3. On every deploy you must bump that number, or the browser keeps serving the previous JavaScript from its one hour cache and the dashboard breaks. If you serve the index with Cache-Control: no-store, the index itself is always fresh and only the versioned assets stay cached.
Automatic updates
If you host goatdash on a Linux server with systemd, you can enable the weekly self-updater:
# Copy the updater files from the release to a location outside the web root
cp deploy/goatdash-update.sh /opt/goatcounter-dashboard/deploy/
cp deploy/goatdash-update.service /etc/systemd/system/
cp deploy/goatdash-update.timer /etc/systemd/system/
systemctl daemon-reload
systemctl enable --now goatdash-update.timer
The timer runs once a week, downloads the latest stable GitHub release (v*), verifies the SHA256 checksum against checksums.txt, backs up the current public folder and swaps it. The frontend also checks GitHub releases once a week and shows a small banner when a newer version is available.
goatdash loads no inline scripts, so a strict default-src 'self' covers its own files. The one addition is connect-src: it must include every site domain the dashboard queries, because each site is its own origin.
Configuration
goatdash has no config file. On first load the connect screen asks for two things:
- the GoatCounter URL of your site (for example
https://stats.cloudless.club),
- an API key created in GoatCounter under your user, Settings, API tab, with at least Count and Read statistics permissions.
Both are kept in the browser's localStorage and only travel to your GoatCounter instance over HTTPS. Theme, language, selected site and date range are persisted the same way.
Multi-site across domains
For several sites on one GoatCounter account, each site needs its own domain, and every domain points at the same GoatCounter. GoatCounter resolves the site from the Host header, which is core behavior, so the official binary is enough. The dashboard reads the site list from /api/v0/sites and queries each site at https://<its-domain>/api/....
GoatCounter sends Access-Control-Allow-Origin: *, so the cross-origin requests work without a proxy. One honest detail: every cross-origin request that carries the Authorization header first triggers an OPTIONS preflight, so each API call is two round trips.
I proposed an X-Goatcounter-Site header upstream in PR #915. It would let a single origin serve every site, but goatdash does not need it. Until that lands, one domain per site is all it takes.
Usage
Open the page and click Try Demo to explore with sample data, or enter your GoatCounter URL and API key to connect. With more than one site you land on the home: a card per site with its last-24h visitors, sparkline and trend; clicking a card opens the dashboard, and the house button goes back. The segmented control switches between today/7d/30d/90d/custom, and the gear menu holds refresh, theme, language and disconnect.
Click almost anything to drill down: a page shows its referrers, a referrer shows the pages it brought, a browser shows versions, a country shows regions, a campaign shows the referrer URLs. The refresh menu clears the cache and fetches everything again.
Development
goatdash ships index.html, styles.css and a handful of JavaScript files compiled from the TypeScript sources in src/. The build (npm run build, Vite) keeps the historical filenames so the cache-bust query, the service worker and the server-side updater work unchanged; the compiled files are not committed. npm run typecheck runs tsc --noEmit in strict mode. Layout: the shared core (types, state, api, settings, i18n, utils) at the top level, src/render/ (panels and chart), src/bridge/ (entry points shared by several views) and the views themselves (home, sites, params, dashboard, ...). src/main.ts imports the whole graph and calls boot(). The demo data lives in src/fixtures.ts and mirrors the real API response shape.
npm install # dev dependencies (TypeScript and Vite)
npm run typecheck # tsc --noEmit, strict mode
npm run build # writes app.js, theme.js, sw.js, fixtures.js and update-check.js
npm run check # typecheck + build
# Serve the repo and open http://localhost:8000
python3 -m http.server 8000
The world map data in assets/world-map.js is a generated asset kept from the original project; the generator lives upstream in the scripts/ folder of abhishekhsingh/goatcounter-dashboard and only needs to run when the country dataset changes.
Thanks
goatdash would not look the way it does without Abhishekh Singh's goatcounter-dashboard (MIT): the layout, the drill-down pattern and the demo mode idea all come from there. The world map asset (assets/world-map.js) is kept verbatim from that project. The rest is a clean rewrite, but the reference deserves the credit.
License
AGPL-3.0, see LICENSE. The world map asset (assets/world-map.js) is kept verbatim from Abhishekh Singh's MIT project and remains MIT; its notice lives in LICENSE.world-map.
Built by gnacho as a personal self-hosted project; issues and PRs are welcome.