Deploy Tianji — Analytics, Uptime & Server Monitoring
Self-host Tianji — website analytics, uptime & server status in one
Just deployed
/var/lib/postgresql/data
Tianji
Just deployed
Deploy and Host Tianji on Railway
Tianji is an open-source, all-in-one insight hub that combines website analytics, uptime monitoring, and server status tracking in a single self-hosted platform. Instead of running Umami for analytics, Uptime Kuma for uptime, and a separate tool for server health — three deployments to maintain — you get all three in one lightweight app with a unified dashboard. It's privacy-first (no cookies, GDPR/CCPA-friendly), so there are no cookie banners to add. This template deploys it with PostgreSQL pre-wired, ready in minutes.
What This Template Deploys
| Service | Purpose |
|---|---|
| Tianji | The unified analytics, uptime, and server-status platform with a web dashboard |
| PostgreSQL | Analytics events, monitor history, and configuration |
Both connect over Railway's private network; only Tianji is public. Tianji ships as a single lightweight image, so consolidating three monitoring functions here costs far less than running three separate services.
About Hosting
Tianji is simple to run, and a few things are worth setting so it's secure and does what you expect from the start.
Three tools in one — that's the point. Tianji replaces the common stack of a separate analytics tool, uptime monitor, and server-status dashboard with one app. Website analytics (page views, unique visitors, referrers, events, UTM), uptime monitoring (HTTP/S, TCP, ping, DNS checks with alerts), server status (CPU, memory, disk, load), plus status pages and surveys — all share one dashboard and one database. On Railway that's one service to deploy and pay for instead of three.
Set JWT_SECRET — it secures every login. Tianji signs authentication tokens with JWT_SECRET, so set it to a strong random value and keep it stable. Changing it later invalidates existing sessions. This template generates one for you.
Lock down registration and change the default admin. Tianji's default admin is admin / admin — change that password immediately on first login. Set ALLOW_REGISTER=false so the public can't create accounts on your instance; leave it open only if you deliberately want open signup.
Privacy-first analytics — no cookie banner needed. Tianji tracks visitors without cookies and is built to be GDPR/CCPA-friendly, so you get Google-Analytics-style insight without a consent banner. You add a small tracking script to your site's header to start collecting.
Server-status monitoring needs the reporter on each server. Website analytics and uptime checks work from Tianji alone. To track a server's CPU, memory, and disk, you install Tianji's lightweight reporter daemon on that machine, pointed at your Tianji instance. That's the one extra step for the server-status feature — the analytics and uptime features need nothing installed elsewhere.
Typical cost: ~$5–10/month on Railway for Tianji and PostgreSQL — cheaper than running three separate monitoring tools. Tianji is Apache-2.0 licensed and free.
How It Compares
| Tianji (self-hosted) | Google Analytics | Umami + Uptime Kuma | Datadog | |
|---|---|---|---|---|
| Functions | Analytics + uptime + server | Analytics only | Two tools, two deploys | All (heavy) |
| Cost model | Flat infra | Free (your data) | Flat infra ×2 | Per host |
| Privacy | Cookieless, GDPR-friendly | Tracks users | Cookieless | Vendor |
| Cookie banner | Not needed | Required | Not needed | N/A |
| Data ownership | Full — your infra | Full | Vendor | |
| Self-hostable | Yes | No | Yes | No |
Google Analytics is free but takes your visitor data and needs a cookie banner. Running Umami and Uptime Kuma separately works but is two tools to deploy and maintain. Datadog is powerful but bills per host. Tianji's edge is consolidation — analytics, uptime, and server status in one privacy-first, self-hosted app, with your data on infrastructure you own and no per-host fees.
Deploy in Under 5 Minutes
- Click Deploy on Railway — Tianji and PostgreSQL build and wire together (~3 minutes)
- Confirm
DATABASE_URLis wired andJWT_SECRETis set - Set
ALLOW_REGISTER=falseand open your Railway domain - Log in with
admin/adminand change the password immediately - Add a website (paste the tracking script into its header), create uptime monitors, and set up notifications
For server status, install Tianji's reporter daemon on each machine you want to monitor.
Common Use Cases
- Replace Google Analytics — cookieless, GDPR-friendly visitor analytics with no consent banner
- Consolidate monitoring tools — analytics, uptime, and server health in one dashboard instead of three apps
- Uptime monitoring with alerts — HTTP/S, TCP, ping, and DNS checks with Discord, Slack, email, and webhook alerts
- Server health tracking — CPU, memory, disk, and load across your machines via the reporter daemon
- Public status pages — communicate service status to your users transparently
- Product analytics via API — use the OpenAPI to push events and build custom reporting
Configuration
| Variable | Required | Description |
|---|---|---|
DATABASE_URL | Auto-injected | PostgreSQL connection string via Railway reference variable |
JWT_SECRET | Required | Signs auth tokens — set a strong random value and keep it stable |
ALLOW_REGISTER | Recommended | false to prevent public signups after you create your admin |
ALLOW_OPENAPI | Optional | true to enable the OpenAPI for integrations |
PORT | Pre-set | The port Tianji listens on (confirm against the image version) |
Set
JWT_SECRETand lock registration.JWT_SECRETsecures every login — use a strong value. The default admin isadmin/admin, so change it on first login, and setALLOW_REGISTER=falseso no one else can register.
Server status needs the reporter daemon. Analytics and uptime work from Tianji alone; to monitor a server's CPU/memory/disk, install Tianji's reporter on that machine pointed at your instance.
Dependencies for Tianji Hosting
- Railway account — ~$5–10/month for Tianji and PostgreSQL
- PostgreSQL (included and wired in this template)
- A tracking script added to your site's header for analytics
- Optional: Tianji's reporter daemon on servers you want to monitor
Deployment Dependencies
Implementation Details
The template runs the official moonrailgun/tianji image alongside a Railway PostgreSQL service over the private network, with only Tianji exposed publicly. Tianji is a single TypeScript (Node.js + React) application of roughly 150 MB that consolidates website analytics, uptime monitoring, server status, status pages, and surveys behind one dashboard, backed by PostgreSQL for real workloads. Configuration is wired through DATABASE_URL, and JWT_SECRET signs authentication tokens and must remain stable across redeploys.
The default administrator account (admin/admin) should be changed on first login, and ALLOW_REGISTER=false closes public signups; ALLOW_OPENAPI=true enables the programmable REST and WebSocket API. Website analytics is collected via a tracking script added to a site's header, uptime monitors run HTTP/S, TCP, ping, and DNS checks with notification integrations (Discord, Slack, email, webhooks), and server-status metrics are gathered by installing Tianji's standalone reporter daemon on each monitored machine. All analytics events, monitor history, and configuration persist in PostgreSQL, which is the component to back up.
Frequently Asked Questions
What does Tianji replace? Typically three tools: a website analytics platform (like Google Analytics or Umami), an uptime monitor (like Uptime Kuma), and a server-status dashboard. Tianji does all three in one app, so you run and maintain one service instead of several.
Do I need a cookie banner? No. Tianji's analytics are cookieless and built to be GDPR/CCPA-friendly, so you get visitor insight without a consent banner or sending data to a third party.
How do I secure it? Set a strong JWT_SECRET, change the default admin/admin password on first login, and set ALLOW_REGISTER=false so the public can't create accounts. Railway's HTTPS encrypts traffic.
How do I monitor a server's CPU and memory? Install Tianji's lightweight reporter daemon on that server, pointed at your Tianji instance. Website analytics and uptime checks don't need anything installed elsewhere — only server status does.
How do I track a website? Add Tianji's small tracking script to your site's header. It then collects page views, visitors, referrers, and events, cookie-free, in your dashboard.
Does my data persist? Yes. Analytics events, monitor history, and settings live in PostgreSQL, which survives redeploys. Back it up to preserve your history.
Can my team use it? Yes — Tianji supports multiple users with role-based permissions, so you can share dashboards with read-only or admin access.
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 get three monitoring tools in one — analytics, uptime, and server status — with PostgreSQL wired, JWT_SECRET set, and automatic HTTPS. Privacy-first, cookieless insight into your websites and infrastructure, self-hosted on infrastructure you own, for less than running three separate tools.
Template Content