---
title: "Deploy Tianji"
description: "Website analytics, uptime monitoring and server status in one app"
category: "Analytics"
url: https://railway.com/deploy/tianji
---

# Deploy Tianji

Website analytics, uptime monitoring and server status in one app

**[Deploy Tianji on Railway](https://railway.com/template/tianji)**

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

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

## Template content

### Tianji https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/png/tianji.png

- **Source:** https://github.com/aalfath/tianji-railway-template
- **Health check:** /health
- **Public domain:** Yes

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

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

## Documentation

# Deploy and Host Tianji on Railway

Tianji is an open-source, self-hosted monitoring app that combines privacy-friendly website analytics, uptime monitoring and server status in one place. It also offers status pages, surveys, telemetry and webhook alerts, so a small team can watch its sites and servers without running several separate tools.

## About Hosting Tianji

This template deploys Tianji 1.34.3 from the official image, pinned by version and digest, together with Railway's PostgreSQL on a persistent volume. Every Tianji record (users, websites, events, monitors, status pages) is stored in Postgres, so data survives redeploys and restarts. On each start, a small wrapper runs the database migrations and then starts the server on a public HTTPS domain with a health check on /health. Tianji's seeded admin/admin login is replaced with a generated password on first start, and open registration stays off. Updates arrive as Railway update notices when the pinned version is bumped in the template's GitHub repo.

## Common Use Cases

* Cookie-free website analytics as a lighter alternative to Google Analytics
* Uptime monitoring of websites, APIs and services, with alerts and public status pages
* Tracking CPU, memory and disk of your servers with the Tianji reporter

## Dependencies for Tianji Hosting

* Tianji server (official `moonrailgun/tianji` image, built from aalfath/tianji-railway-template)
* PostgreSQL (Railway's managed Postgres image with a volume)

### Deployment Dependencies

* Tianji source and releases: https://github.com/msgbyte/tianji/releases
* Tianji documentation: https://tianji.dev/docs/intro
* Environment variable reference: https://tianji.dev/docs/install/environment
* Template repository: https://github.com/aalfath/tianji-railway-template

### Implementation Details

After the deploy finishes:

1. Open the Tianji service's Variables tab and copy `ADMIN_PASSWORD`.
2. Open the public URL and sign in as `admin` with that password, then change it under your profile.
3. Add a website and paste the tracking script Tianji shows into your site, or add a monitor.

There are no prompts at deploy time: the database URL, `JWT_SECRET` and `ADMIN_PASSWORD` are generated or wired for you. Optional features (SMTP email, GitHub, Google or OIDC login, a Redis cache, ClickHouse, OpenAI features, `PUBLIC_URL` for email links) are enabled by adding the variables from Tianji's environment docs to the Tianji service. Set `ALLOW_REGISTER=true` only if you want anyone with the URL to create an account.

To report a server's status, run the `tianji-reporter` binary from the Tianji releases on that server, pointed at YOUR-DOMAIN and the workspace ID shown in Tianji's Servers page.

Updates: the template's repo pins one Tianji release. When a newer release is tested, the pin moves on `main`, and Railway shows you an "update available" notice; read CHANGELOG.md in the repo, then apply it when you're ready. Back up Postgres before major upgrades.

## Why Deploy Tianji 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 Tianji 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

- [Plausible WordPress](https://railway.com/deploy/deploy-plausible-for-wordpress-sites) — Cookie-free WordPress stats from your own Plausible
- [Typesense Multilingual](https://railway.com/deploy/deploy-typesense-multilingual-search) — Locale-aware multilingual search with Typesense
- [Formbricks](https://railway.com/deploy/formbricks-surveys) — Surveys, NPS and in-app feedback on your own Postgres, Hub and Cube

Open this page in a browser: https://railway.com/deploy/tianji
