Deploy Rybbit | (Just Updated) Open-Source Google Analytics Alternative, Admin Login Generated, Sign-up Closed

Rybbit open-source web analytics, Google Analytics alternative

Deploy Rybbit | (Just Updated) Open-Source Google Analytics Alternative, Admin Login Generated, Sign-up Closed

/var/lib/clickhouse

Just deployed

/data

Just deployed

/var/lib/postgresql

Deploy and Host Rybbit on Railway

Built for an LLM agent to deploy and use. The deploy form has no fields to fill: the admin login is generated, sign-up is closed from the first request, and every database lives on a volume. Rybbit is open-source, privacy-friendly web analytics, a self-hosted Google Analytics alternative with pageviews, sessions, funnels, events, web vitals, session replay and a REST API, and no cookie banner to add.

About Hosting Rybbit

This template runs five services: web (the public gateway, the upstream Rybbit client plus nginx), backend (the Rybbit API, private), clickhouse (events, on a volume at /var/lib/clickhouse), postgres (accounts, sites and settings, on a volume at /var/lib/postgresql) and redis (cache and queues, on a volume at /data). The Rybbit images are pinned to the v2.9.3 release by digest, and so are the wrappers. One public domain serves the dashboard at /, the API at /api and the tracking script at /api/script.js.

What the wrappers fix. Upstream Rybbit makes the first account to sign up the instance admin and has no variable that creates one, so a public deploy hands the whole instance to whoever reaches the sign-up form first. Its client is also built with an empty backend address, so it needs one origin that routes /api to the backend and everything else to the client. The backend wrapper waits for Postgres and ClickHouse, runs the migrations, creates the admin from ADMIN_EMAIL and ADMIN_PASSWORD the first time the database has no user, and then starts the server with DISABLE_SIGNUP=true. The web wrapper does the routing and also answers POST /api/auth/sign-up/email with 403 at the edge.

Measured on a Railway demo of this template: a sign-up from outside answers 403, the generated admin signs in, a wrong password answers 401, a pageview sent to /api/track is stored and queryable, and a real browser signs in at /login and lands on the dashboard showing the site and its first session.

Using it. Open the domain, go to /login and sign in with ADMIN_EMAIL and ADMIN_PASSWORD from the backend service variables. Create a site, then add the tracking script to your pages as a script tag with src set to https://RAILWAY_PUBLIC_DOMAIN/api/script.js, the attribute data-site-id set to the site id and the attribute defer. An agent can do the same through the API below. Redeploys keep the same login, because the admin is only created when the database has no user, and the data is on the volumes.

Agent contract

  • Public URL: https://RAILWAY_PUBLIC_DOMAIN (the generated domain of the web service)
  • Private URL: http://backend.railway.internal:3001 (the API, private) and http://web.railway.internal:8080 (the gateway)
  • Credentials: the variables ADMIN_EMAIL and ADMIN_PASSWORD on the backend service are the admin login, given as plain text
  • Auth: POST /api/auth/sign-in/email with a JSON body {"email":"...","password":"..."} and an Origin header equal to the public URL returns a session cookie; send the cookie on every call. Without it a read or write answers 401. Sign-up is closed (POST /api/auth/sign-up/email answers 403). Event ingest, POST /api/track, and GET /api/script.js are public by design, because a tracked page sends them.
  • Health: GET /api/health returns 200 without credentials
#!/bin/sh
# needs: RAILWAY_PUBLIC_DOMAIN (the web service), ADMIN_EMAIL and ADMIN_PASSWORD (variables of the backend service); also curl, sed.
R="https://$RAILWAY_PUBLIC_DOMAIN"
J="Content-Type: application/json"
O="Origin: $R"
C=$(mktemp)
n=0; until [ "$(curl -s -o /dev/null -w '%{http_code}' "$R/api/health")" = 200 ]; do n=$((n+1)); [ "$n" -le 90 ] || break; sleep 5; done
curl -s -o /dev/null -w "health: %{http_code}\n" "$R/api/health"
# sign-up is closed: a stranger cannot create an account, from outside or at the edge
curl -s -X POST -H "$J" -H "$O" -d '{"email":"stranger@example.com","password":"stranger-password-1","name":"stranger"}' "$R/api/auth/sign-up/email" -o /dev/null -w "public signup: %{http_code}\n"
# a stranger cannot read or write analytics data: no session and a wrong password are both refused
curl -s -o /dev/null -w "read without key: %{http_code}\n" -H "$O" "$R/api/organizations"
curl -s -X POST -H "$J" -H "$O" -d '{"domain":"stranger.example.com","name":"stranger"}' "$R/api/organizations/none/sites" -o /dev/null -w "write without key: %{http_code}\n"
curl -s -X POST -H "$J" -H "$O" -d "{\"email\":\"$ADMIN_EMAIL\",\"password\":\"not-the-admin-password\"}" "$R/api/auth/sign-in/email" -o /dev/null -w "login with wrong password: %{http_code}\n"
# the generated admin signs in and receives a session cookie
CODE=$(curl -s -c "$C" -X POST -H "$J" -H "$O" -d "{\"email\":\"$ADMIN_EMAIL\",\"password\":\"$ADMIN_PASSWORD\"}" "$R/api/auth/sign-in/email" -o /dev/null -w '%{http_code}')
if [ "$CODE" = 200 ]; then echo "login with key: ok"; else echo "login with key: FAILED $CODE"; fi
# with the session: read the organisations (create one if there is none), then add a site
ORG=$(curl -s -b "$C" -H "$O" "$R/api/organizations" | sed -n 's/^\[{"id":"\([^"]*\)".*/\1/p')
if [ -z "$ORG" ]; then
  ORG=$(curl -s -b "$C" -X POST -H "$J" -H "$O" -d '{"name":"Default","slug":"default"}' "$R/api/auth/organization/create" | sed -n 's/.*"id":"\([^"]*\)","members".*/\1/p')
fi
curl -s -b "$C" -H "$O" "$R/api/organizations" -o /dev/null -w "read with key: %{http_code}\n"
DOMAIN="agent-$(date +%s).example.com"
SITE=$(curl -s -b "$C" -X POST -H "$J" -H "$O" -d "{\"domain\":\"$DOMAIN\",\"name\":\"agent\"}" "$R/api/organizations/$ORG/sites" | sed -n 's/^{"id":"\([^"]*\)".*/\1/p')
if [ -n "$SITE" ]; then echo "write with key: ok"; else echo "write with key: FAILED"; fi
# ingest is public by design (a tracked page sends it): a pageview with a browser-like request is accepted and then queryable
UA='Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36'
curl -s -X POST -A "$UA" -H "$J" -H 'Accept: */*' -H 'Accept-Language: en-US,en;q=0.9' -H 'Sec-Fetch-Mode: cors' -H 'Sec-Fetch-Site: cross-site' -H 'Sec-Fetch-Dest: empty' -H 'Sec-CH-UA: "Chromium";v="124"' -H "Origin: https://$DOMAIN" -H "Referer: https://$DOMAIN/" -d "{\"type\":\"pageview\",\"site_id\":\"$SITE\",\"hostname\":\"$DOMAIN\",\"pathname\":\"/hello\",\"user_agent\":\"$UA\"}" "$R/api/track" -o /dev/null -w "track: %{http_code}\n"
n=0; until curl -s -b "$C" -H "$O" "$R/api/sites/$SITE/has-data" | grep -q '"hasData":true'; do n=$((n+1)); [ "$n" -le 12 ] || break; sleep 5; done
if curl -s -b "$C" -H "$O" "$R/api/sites/$SITE/has-data" | grep -q '"hasData":true'; then echo "data stored: ok"; else echo "data stored: FAILED"; fi

Expected output against a fresh deploy:

health: 200
public signup: 403
read without key: 401
write without key: 401
login with wrong password: 401
login with key: ok
read with key: 200
write with key: ok
track: 200
data stored: ok

The refusals are the contract: public signup: 403, write without key: 401 and login with wrong password: 401. The snippet creates one organisation named Default if there is none, and one site named agent with a fresh example.com subdomain on every run.

Why Deploy Rybbit 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 Rybbit 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.

  • Agent-ready - no deployer fields, a contract block, and one script that proves health, closed sign-up, refused strangers, a signed-in write and stored data.
  • Locked from the first request - the admin is created at first boot and public sign-up is off, so nobody can claim the instance before you do.
  • One domain - the dashboard, the API and the tracking script share one origin, so there is nothing to wire and no cross-origin setup.
  • Data survives redeploys - ClickHouse, Postgres and Redis each have a volume.
  • Pinned - the Rybbit images are pinned by tag and digest, and the wrappers by digest.

Common Use Cases

  • Privacy-friendly website analytics - pageviews, sessions, referrers and countries without cookies or a consent banner.
  • Product analytics for an app - custom events, funnels and user journeys on infrastructure you own.
  • A Google Analytics alternative for a client site - one login, one script tag, and the data stays in your project.

Dependencies for Rybbit Hosting

  • The five services and three volumes created by the template. Nothing external is required.

Deployment Dependencies


Template Content

More templates in this category

View Template
Plausible WordPress
Cookie-free WordPress stats from your own Plausible

onepush
0
View Template
Typesense Multilingual
Locale-aware multilingual search with Typesense

onepush
0
View Template
Formbricks
Surveys, NPS and in-app feedback on your own Postgres, Hub and Cube

Two Workspaces
3