---
title: "Deploy Self Hosted Metrics SHM"
description: "Privacy-first, Agnostic Telemetry for Self-Hosted Software"
category: "Other"
url: https://railway.com/deploy/self-hosted-metrics-shm
---

# Deploy Self Hosted Metrics SHM

Privacy-first, Agnostic Telemetry for Self-Hosted Software

**[Deploy Self Hosted Metrics SHM on Railway](https://railway.com/template/self-hosted-metrics-shm)**

- **Creator:** Karim Zarzour's Projects
- **Category:** Other

## Template content

### Postgres https://devicons.railway.app/i/postgresql.svg

- **Image:** ghcr.io/railwayapp-templates/postgres-ssl:17

### shm https://github.com/btouchard/shm/raw/main/docs/logos/shm-logo.svg

- **Image:** ghcr.io/btouchard/shm:latest
- **Public domain:** Yes

## Documentation

# Deploy and Host Self Hosted Metrics SHM on Railway

Self-Hosted Metrics (SHM) is a privacy-first telemetry server for self-hosted and on-prem software. It collects aggregate usage metrics, active instance counts, versions, and environments without tracking end users. Applications send signed JSON snapshots, and SHM automatically builds dashboards with tables, KPIs, and graphs from the data.

## About Hosting Self Hosted Metrics SHM

Hosting SHM on Railway involves deploying the SHM server (a Go service with an embedded UI) alongside a PostgreSQL database. Incoming metric snapshots are stored as JSONB in Postgres and visualized in real time. You configure a database connection string, expose the service port, and optionally add a GitHub token for higher API limits. Initial SQL migrations must be applied once to set up the schema. Railway handles networking, scaling, and environment management.

## Common Use Cases

- Track active installs and version adoption of self-hosted products  
- Collect high-level business KPIs from customer deployments without PII  
- Monitor multiple products or environments from a single metrics server  

## Dependencies for Self Hosted Metrics SHM Hosting

- PostgreSQL (required)  
- GitHub API token (optional, for star count fetching)

### Deployment Dependencies

- https://github.com/btouchard/shm  
- https://github.com/btouchard/shm/blob/main/docs/DEPLOYMENT.md  
- https://self-hosted-metrics.com/

### Implementation Details 

**Required environment variables**
- `SHM_DB_DSN` – PostgreSQL connection string  
- `PORT` – Service port (defaults to 8080)

**Optional**
- `GITHUB_TOKEN` – Increase GitHub API rate limits  
- `SHM_RATELIMIT_*` – Rate limiting and brute-force protection settings

**Database setup**
- Run SQL migrations from the `migrations/` directory once on the database.

## Why Deploy Self Hosted Metrics SHM 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 Self Hosted Metrics SHM 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

- [Rocky Linux](https://railway.com/deploy/rocky-linux) — Hosted Rocky Linux 9 workspace with SSH and persistent storage. 🚀
- [Foundry Virtual Tabletop](https://railway.com/deploy/X5tR6G) — A Self-Hosted & Modern Roleplaying Platform
- [Letta Code Remote](https://railway.com/deploy/letta-code-remote) — Run a Letta Code agent 24/7. No inbound ports, just deploy.

Open this page in a browser: https://railway.com/deploy/self-hosted-metrics-shm
