Skip to content

Prism-lengjing/UselessMonitor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Useless Monitor

A single repository that bundles the Gin/SQLite backend API together with the immersive Vite + React dashboard. The backend now performs automated HTTP health checks for every monitor entry and the frontend consumes that live telemetry without any manual status toggling.

Repository Layout

UselessMonitor/
├── backend/   # Go + Gin API server
├── frontend/  # Vite + React single-page dashboard
└── README.md  # You are here

Backend (Gin + SQLite)

  • location: backend/
  • language: Go 1.21+
  • features:
    • Key-based read/admin access using READ_KEY and ADMIN_KEY headers.
    • Monitor records include HTTP endpoint metadata and the last response metrics.
    • A background worker issues HTTP GET probes on a configurable interval (CHECK_INTERVAL_SECONDS, default 30s) and updates the monitor status (HEALTHY, DEGRADED, UNHEALTHY, UNKNOWN).
    • GET /monitor and GET /status are safe for read-only keys, while POST/PUT/DELETE /monitor require the admin key.

See backend/README.md for environment variables and the complete API description.

Frontend (Vite + React)

  • location: frontend/
  • language: TypeScript + React 19, built with Vite 6.
  • features:
    • Real-time console that renders the backend monitor list, response codes, and last contact timestamp.
    • HTTP status is now fully automated — the UI can no longer toggle statuses manually.
    • Admin mode allows creating or editing monitors by providing the name, sector/type, and monitored URL; deletion is also available when the admin key is provided.
    • Bilingual UI (English/Chinese) and ambient sci-fi visual treatments.

Configuration instructions (copying frontend/public/config.example.json to frontend/public/config.json) and npm scripts live in frontend/README.md.

Development Workflow

  1. Start the backend API:
    cd backend
    go run .
  2. Start the frontend dev server in a separate shell:
    cd frontend
    npm install
    npm run dev
  3. Update frontend/public/config.json so the dashboard knows which backend URL and read key to use.

Both services are intentionally lightweight so they can be deployed together or independently depending on your infrastructure.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published