---
title: "Deploy GoatCounter"
description: "GoatCounter 2.7: privacy-friendly web analytics without cookie banners."
category: "Analytics"
url: https://railway.com/deploy/goatcounter-1
---

# Deploy GoatCounter

GoatCounter 2.7: privacy-friendly web analytics without cookie banners.

**[Deploy GoatCounter on Railway](https://railway.com/template/goatcounter-1)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/goatcounter-1/manifest.json

- **Creator:** Agaz Self-Host
- **Category:** Analytics

## Template content

### goatcounter https://raw.githubusercontent.com/arp242/goatcounter/v2.7.0/public/favicon/apple-touch-icon.png

- **Image:** arp242/goatcounter:2.7.0
- **Start command:** `sh -c 'D=sqlite+/home/goatcounter/goatcounter-data/db.sqlite3; goatcounter db create site -createdb -db $D -vhost $RAILWAY_PUBLIC_DOMAIN -user.email $GC_ADMIN_EMAIL -user.password $GC_ADMIN_PASSWORD >/tmp/seed.log 2>&1 && echo "[seed] site $RAILWAY_PUBLIC_DOMAIN created" || echo "[seed] site already set up"; exec goatcounter serve -automigrate -listen :8080 -tls http -db $D'`
- **Health check:** /status
- **Public domain:** Yes

## Documentation

# Deploy and Host GoatCounter on Railway

GoatCounter is simple, privacy-friendly web analytics. It counts page views, referrers, browsers, screen sizes and locations without cookies or personal data, so most sites do not need a consent banner. The dashboard is fast and readable, and a tiny script or a pixel does the tracking.

## About Hosting GoatCounter

This template runs the official `arp242/goatcounter:2.7.0` image as one service with SQLite on a Railway volume. On first boot the start command creates a site for your Railway domain and an admin account from the variables, then starts the server; later boots skip that step. The container runs as root so it can write to the Railway volume. Page views and settings survive redeploys. Add the tracking script shown under Settings to your website, and GoatCounter starts counting. It uses very little memory and runs on the Hobby plan, even for sites with a lot of traffic.

## Common Use Cases

- Cookie-free analytics for a blog, docs site or landing page
- Replacing Google Analytics without a consent banner
- Counting downloads or events with the pixel or the API

## Dependencies for GoatCounter Hosting

- `arp242/goatcounter:2.7.0` (official image)
- A Railway volume at `/home/goatcounter/goatcounter-data`

### Deployment Dependencies

- [GoatCounter website](https://www.goatcounter.com)
- [GoatCounter on GitHub](https://github.com/arp242/goatcounter)
- [GoatCounter 2.7.0 release](https://github.com/arp242/goatcounter/releases/tag/v2.7.0)

### Implementation Details

| Service | Source | Networking | Storage |
| --- | --- | --- | --- |
| goatcounter | `arp242/goatcounter:2.7.0` | public domain on 8080 | volume at `/home/goatcounter/goatcounter-data` |

| Variable | Default | Purpose |
| --- | --- | --- |
| `GC_ADMIN_EMAIL` | `admin@example.com` | Admin created on first boot |
| `GC_ADMIN_PASSWORD` | generated | Its password (first boot only) |
| `RAILWAY_RUN_UID` | `0` | Runs as root so the volume is writable |

Notes:

- The site is created for the Railway domain. With a custom domain, change the site's domain under Settings > Sites.
- GoatCounter rejects unknown `GOATCOUNTER_*` variables, so the admin variables use the `GC_` prefix.

This is a community-maintained deployment package and does not imply affiliation with or endorsement by the GoatCounter project.

## Why Deploy GoatCounter 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 GoatCounter 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.


## Similar templates

- [Typesense vs Meilisearch](https://railway.com/deploy/typesense-vs-meilisearch) — self-hosted Typesense vs Meilisearch
- [Betterlytics](https://railway.com/deploy/betterlytics) — Betterlytics is a cookieless analytics platform GDPR-compliant.
- [Finance Tracker](https://railway.com/deploy/finance-tracker-1) — Private multi-user household finance ledger with budgets and CSV import.

Open this page in a browser: https://railway.com/deploy/goatcounter-1
