Uptime monitoring system built with Go + Gin, a background worker engine (goroutines), and PostgreSQL, with a simple React (Vite + TS) dashboard.
Goal: Add URLs, check them on an interval, store results, and visualize uptime/latency history.
-
Frontend (The Face)
- Simple dashboard where users can sign up / log in, add URLs, set frequency, and view status + history.
- Tech: React (Vite + TypeScript) under
frontend/.
-
Backend API (The Brain — Gin Framework)
- Handles Auth (Signup/Login), Monitor CRUD, and History APIs.
- Responsible for validation, auth middleware, and serving data to the dashboard.
-
Worker Engine (The Muscle — Goroutines)
- Runs in the background and continuously schedules checks (every 1–5 minutes).
- Uses a worker pool (e.g., 10–20 goroutines) to ping multiple URLs concurrently.
-
Database (The Memory — PostgreSQL)
- Stores users, monitors, and check logs (status + latency).
- Signup/Login with email/password.
- Backend generates a JWT token.
- Security: Without a valid JWT, users cannot add monitors or view history (middleware protects routes).
- Add Monitor: user submits a URL (e.g.
https://google.com) and frequency (e.g. "every 5 minutes"). - Backend saves it in the monitors table.
- Scheduler goroutine keeps running and fetches monitors that are due.
- Worker Pool executes checks concurrently.
- Persist results: each check writes Up/Down + Latency + Timestamp into the logs table.
- Dashboard reads from logs to show current status and graphs/history.
- If a monitor is Down, backend can emit alerts (initially console; later email/Telegram).
idemailpassword_hashcreated_at
iduser_id(FK → users)urlfrequencyis_activecreated_at
idmonitor_id(FK → monitors)status(UP/DOWN)latencychecked_at
When you start the server, two main things should run:
-
Gin HTTP Server
- Listens on
:8080and handles all HTTP requests.
- Listens on
-
Background Cron/Scheduler
- An infinite loop using
time.Tickerthat wakes up every X seconds, queries the DB for due monitors, and dispatches work to the worker pool.
- An infinite loop using
README.md— project overviewfrontend/— React + TypeScript (Vite) dashboard
Exact commands may vary depending on the current implementation in this repo.
# from repo root
go mod tidy
go run ./...cd frontend
npm install
npm run dev- JWT auth middleware + refresh strategy
- Monitor CRUD + validation
- Worker pool + scheduler with per-monitor frequency
- Status page + graphs
- Alerting: Email / Telegram
PRs and issues are welcome. Keep changes small and include context + tests where possible.