Self-hosting
One command on any machine with Docker. Postgres, ClickHouse, the app and the ingest server, with secrets generated for you.
Let your coding agent do it
Paste this prompt into Claude Code, Codex or Cursor in an empty folder. It checks Docker, runs the installer and tells you where to log in. It asks before installing anything.
Preview prompt
Set up hostpog (open-source product analytics) on this machine. Repository: https://github.com/dhanush17-tech/hostpog Do this step by step and tell me what you did after each step: 1. Check that Docker is installed and running (docker info) and that Docker Compose v2 works (docker compose version). If not, tell me how to install or start Docker for my OS and wait — don't install system software yourself. 2. Clone the repository (skip if I'm already inside it) and cd into it. 3. Run ./hostpog up. The first run generates secrets into deploy/.env and builds the images (a few minutes). Never print the secrets back to me and never commit deploy/.env. 4. If port 3000 or 3001 is taken, change WEB_PORT/INGEST_PORT and the matching HOSTPOG_PUBLIC_URL / HOSTPOG_INGEST_PUBLIC_URL in deploy/.env, then run ./hostpog up again. For any other failure, show me ./hostpog logs and your proposed fix before changing code. 5. Finish by telling me: the URL to open, that I should create an account there, and that I'll connect PostHog or add an AI key from inside the app (I'll paste keys there myself — don't ask me for them here). Remind me to back up deploy/.env.
Get your keys
You only need the ones you'll use. Each button opens the exact page where the key is created; you paste it into hostpog afterwards.
PostHog (to connect existing data)
PostHog US Cloud
Create a personal API key with read access (query:read is the one that matters).
Open US key pageNot sure which? Look at the address bar when you're logged into PostHog — it starts with us. or eu.. Self-hosted PostHog: open /settings/user-api-keys on your own domain.
AI model (for investigations — optional)
Anthropic (Claude)
Create a key in the Claude Console. Requires billing on the account.
Get a Claude keyLocal model (Ollama)
Keeps everything on your machine. Set HOSTPOG_AI_ALLOWED_PRIVATE_HOSTS=localhost.
Download OllamaQuickstart
git clone https://github.com/dhanush17-tech/hostpog hostpog && cd hostpog
./hostpog upOpen http://localhost:3000 and create an account. The first run builds the images (a few minutes) and writes generated secrets to deploy/.env. Back that file up: HOSTPOG_MASTER_KEY encrypts every stored PostHog and AI key.
./hostpog up | Start everything (first run: generate secrets and build). |
./hostpog status / logs | Service health, or follow logs (./hostpog logs web). |
./hostpog update | Rebuild from your checkout after git pull and restart. Migrations run automatically. |
./hostpog backup | Postgres dump to ./backups. |
./hostpog down | Stop. Data stays in Docker volumes. |
Requirements
- Docker with Compose v2 (Docker Desktop on Mac/Windows)
- 2 GB RAM minimum, 4 GB+ recommended (ClickHouse likes memory)
- On a server: put a TLS proxy (Caddy, nginx) in front of ports 3000 and 3001 and set the https URLs in
deploy/.envbefore the first run
One ingest instance handles roughly 2,000–5,000 events per second (see docs/loadtest.md).
Developing on hostpog
cp .env.example .env
echo "HOSTPOG_MASTER_KEY=$(openssl rand -base64 32)" >> .env
echo "BETTER_AUTH_SECRET=$(openssl rand -base64 32)" >> .env
pnpm install
pnpm infra:up # postgres, clickhouse, redis (dev credentials only)
pnpm db:migrate
pnpm dev # web on :3000, ingest on :3001Configuration
HOSTPOG_MASTER_KEY | 32-byte base64 key encrypting stored credentials (AES-256-GCM). Required. |
BETTER_AUTH_SECRET | Session signing secret. Required. |
HOSTPOG_PUBLIC_URL | Browser URL. Used for CSRF origin checks, cookies (Secure when https) and OAuth. |
HOSTPOG_POSTHOG_ALLOWED_HOSTS | Self-hosted PostHog origins users may connect to. Anything else is refused (SSRF protection). |
HOSTPOG_AI_ALLOWED_PRIVATE_HOSTS | Private/local model hosts (e.g. localhost for Ollama). Private addresses are blocked otherwise. |
HOSTPOG_POSTHOG_OAUTH_ENABLED | Enable PostHog OAuth. Requires a public HTTPS HOSTPOG_PUBLIC_URL because PostHog fetches HostPog's client metadata document at /oauth/posthog-client.json. |
Rotating the master key
- Move the current key to
HOSTPOG_MASTER_KEY_PREVIOUS(and its version to_PREVIOUS_VERSION). - Set a new
HOSTPOG_MASTER_KEYwith a higherHOSTPOG_MASTER_KEY_VERSION. Old ciphertexts still decrypt; new writes use the new key. - Rotate credentials (Integrations → Rotate key, AI providers → re-add) to re-encrypt, then remove the previous key.
Backups
# Postgres (accounts, sources, encrypted credentials, dashboards, investigations)
./hostpog backup
# ClickHouse (native events) — use BACKUP ... TO Disk/S3, see ClickHouse docsBack up the master key separately from the database. Without it, stored credentials cannot be decrypted.
Production notes
- Terminate TLS in front of web and ingest; set
HOSTPOG_PUBLIC_URLto the https URL. - Investigations run inside the web process, so use a long-running server rather than a serverless host.
- hostpog sends no telemetry about your instance.
PostHog US Cloud
Google Gemini
OpenRouter
Anthropic (Claude)
OpenAI
Local model (Ollama)