How Tianji Unifies Website Analytics, Server Monitoring, and Alerts in One Lightweight Platform
Tianji is an open‑source all‑in‑one monitoring solution that combines website analytics, uptime monitoring, and server health checks with multi‑channel alerts, offering Docker‑based quick deployment, a responsive React dashboard, and extensible alert scripts for developers and small teams.
In operations and development we often face fragmented toolchains: Google Analytics for traffic, Prometheus + Grafana for server metrics, and Zabbix or Nagios for alerts, which raises maintenance costs.
Overview
Tianji is an open‑source all‑in‑one monitoring system that combines website analytics, uptime monitoring, and server status into a single lightweight platform, ideal for individual developers and small teams.
Core Features
1. Website Traffic Analysis
Traffic stats: Real‑time PV, UV, dwell time and other core metrics.
Source tracking: Record visitor paths and analyze traffic source distribution from search engines, social media, etc.
Custom events: Support integration with Google Analytics or custom event hooks for deep user‑behavior analysis (e.g., button clicks, form submissions).
2. Server Status Monitoring
Resource metrics: Real‑time collection of CPU, memory, disk I/O, and network bandwidth usage.
Health checks: Periodic probing of HTTP/TCP ports to ensure critical services (databases, APIs) remain available.
Visual dashboards: Built‑in charts display historical trends, helping quickly locate performance bottlenecks such as memory leaks or disk exhaustion.
3. Smart Alert System
Multi‑channel notifications: Email, Slack, Webhook and other channels push alerts instantly.
Flexible thresholds: Define trigger conditions per metric, e.g., “CPU > 90% for 5 minutes”.
Auto‑recovery: Script hooks enable self‑healing actions such as restarting crashed containers.
Typical Scenario
When a traffic surge overloads the server CPU, Tianji automatically triggers an alert, runs a scaling script, and records the high‑traffic source, providing data for later optimization.
Technology Stack
Backend: Node.js + Express, written in TypeScript for type safety.
Database: PostgreSQL stores monitoring data; Redis can be used as an optional cache for real‑time metrics.
Frontend: React + Ant Design delivers a responsive dashboard that adapts to mobile devices.
Deployment friendly: Includes Devcontainer configuration, GitHub Actions pipelines, and Kubernetes orchestration templates.
Quick Deployment
Environment preparation
Install Docker and Docker Compose.
One‑click Docker start
Create a docker-compose.yml file:
version: '3'
services:
tianji:
image: moonrailgun/tianji # official image
ports:
- "12345:12345" # default access port
environment:
DATABASE_URL: postgresql://tianji:tianji@postgres:5432/tianji
JWT_SECRET: your_secure_random_string # required for session encryption
ALLOW_REGISTER: "false" # disable public registration
depends_on:
- postgres
postgres:
image: postgres:15-alpine
environment:
POSTGRES_USER: tianji
POSTGRES_PASSWORD: tianji
volumes:
- tianji-db-data:/var/lib/postgresql/data
volumes:
tianji-db-data:Start the services: docker compose up -d Access http://<server‑IP>:12345 with the default credentials admin/admin (change the password on first login).
Interface Preview
Open‑Source Repository
https://github.com/msgbyte/tianji
Selected Java Interview Questions
A professional Java tech channel sharing common knowledge to help developers fill gaps. Follow us!
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
