# rzalvaero/upshit-monitor architecture

> Architecture diagram of the GitHub repository rzalvaero/upshit-monitor, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rzalvaero/upshit-monitor
- Repository: https://github.com/rzalvaero/upshit-monitor

## Overview

Open Uptime Monitor is a single-tenant dashboard for tracking website and API availability. An admin authenticates, adds or manages monitor targets, and the dashboard displays current status, latency, uptime summaries, and recent check bars. A manual refresh or scheduled caller invokes the cron endpoint, which loads monitors, probes targets, records ping history, and updates each monitor’s latest status. The README also describes an external cron-job.org or self-hosted scheduler and Supabase/Postgres storage. Sampled source confirms the dashboard, actions, and probe flow; unsampled UI wiring and schema details are not inferred.

Main entry points: [`src/app/actions.ts`](https://github.com/rzalvaero/upshit-monitor/blob/main/src/app/actions.ts) (Server Actions), [`src/app/api/cron/check/route.ts`](https://github.com/rzalvaero/upshit-monitor/blob/main/src/app/api/cron/check/route.ts) (Check Endpoint), [`src/app/page.tsx`](https://github.com/rzalvaero/upshit-monitor/blob/main/src/app/page.tsx) (Monitor Dashboard), [`prisma/schema.prisma`](https://github.com/rzalvaero/upshit-monitor/blob/main/prisma/schema.prisma) (Monitor Records)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_admin["Admin Controls"]
  node_add_form["Add Monitor Form<br/>[AddMonitorForm.tsx]"]
  node_login_modal["Admin Login Modal<br/>[LoginModal.tsx]"]
  node_actions["Server Actions<br/>[actions.ts]"]
  node_toggle_hide["Visibility Toggle"]
  node_delete_button["Monitor Delete"]
  node_logout_button["Admin Logout<br/>[LogoutButton.tsx]"]
end

subgraph group_monitoring["Uptime Checks"]
  node_refresh_button["Manual Check<br/>[RefreshButton.tsx]"]
  node_cron_route["Check Endpoint<br/>[route.ts]"]
end

subgraph group_dashboard["Status Dashboard"]
  node_dashboard_page["Monitor Dashboard<br/>[page.tsx]"]
  node_result["Uptime Status View<br/>[page.tsx]"]
end

subgraph group_persistence["Persistence"]
  node_monitor_store[("Monitor Records<br/>[schema.prisma]")]
  node_ping_store[("Ping History<br/>[schema.prisma]")]
end

node_admin(("Admin"))
node_visitor(("Dashboard Visitor"))
node_scheduler(("Cron Scheduler"))
node_target(("Monitored Endpoint"))
node_postgres[("Supabase Postgres")]

node_visitor -->|"opens"| node_dashboard_page
node_admin -->|"submits password"| node_login_modal
node_login_modal -->|"calls login"| node_actions
node_admin -->|"enters target"| node_add_form
node_add_form -->|"calls add"| node_actions
node_dashboard_page -->|"queries monitors"| node_monitor_store
node_dashboard_page -->|"queries history"| node_ping_store
node_dashboard_page -->|"renders status"| node_result
node_admin -->|"changes visibility"| node_toggle_hide
node_toggle_hide -->|"calls toggle"| node_actions
node_admin -->|"requests deletion"| node_delete_button
node_delete_button -->|"calls delete"| node_actions
node_admin -->|"logs out"| node_logout_button
node_logout_button -->|"calls logout"| node_actions
node_actions -->|"creates or updates"| node_monitor_store
node_actions -->|"deletes history"| node_ping_store
node_refresh_button -->|"fetches check"| node_cron_route
node_refresh_button -->|"refreshes view"| node_dashboard_page
node_scheduler -.->|"invokes periodically"| node_cron_route
node_cron_route -->|"loads and updates"| node_monitor_store
node_cron_route -->|"probes URL"| node_target
node_cron_route -->|"records result"| node_ping_store
node_monitor_store -->|"persists records"| node_postgres
node_ping_store -->|"persists history"| node_postgres

click node_dashboard_page "https://github.com/rzalvaero/upshit-monitor/blob/main/src/app/page.tsx"
click node_add_form "https://github.com/rzalvaero/upshit-monitor/blob/main/src/app/components/AddMonitorForm.tsx"
click node_login_modal "https://github.com/rzalvaero/upshit-monitor/blob/main/src/app/components/LoginModal.tsx"
click node_actions "https://github.com/rzalvaero/upshit-monitor/blob/main/src/app/actions.ts"
click node_refresh_button "https://github.com/rzalvaero/upshit-monitor/blob/main/src/app/components/RefreshButton.tsx"
click node_toggle_hide "https://github.com/rzalvaero/upshit-monitor/blob/main/src/app/components/ToggleHideButton.tsx"
click node_delete_button "https://github.com/rzalvaero/upshit-monitor/blob/main/src/app/components/DeleteMonitorButton.tsx"
click node_logout_button "https://github.com/rzalvaero/upshit-monitor/blob/main/src/app/components/LogoutButton.tsx"
click node_cron_route "https://github.com/rzalvaero/upshit-monitor/blob/main/src/app/api/cron/check/route.ts"
click node_monitor_store "https://github.com/rzalvaero/upshit-monitor/blob/main/prisma/schema.prisma"
click node_ping_store "https://github.com/rzalvaero/upshit-monitor/blob/main/prisma/schema.prisma"
click node_result "https://github.com/rzalvaero/upshit-monitor/blob/main/src/app/page.tsx"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_add_form,node_login_modal,node_actions,node_toggle_hide,node_delete_button,node_logout_button toneBlue
class node_refresh_button,node_cron_route,node_postgres toneAmber
class node_dashboard_page,node_result toneMint
class node_monitor_store,node_ping_store,node_scheduler toneRose
class node_admin,node_visitor,node_target toneIndigo
```

## Components

### Admin Controls

- [Add Monitor Form](https://github.com/rzalvaero/upshit-monitor/blob/main/src/app/components/AddMonitorForm.tsx): `src/app/components/AddMonitorForm.tsx`
- [Admin Login Modal](https://github.com/rzalvaero/upshit-monitor/blob/main/src/app/components/LoginModal.tsx): `src/app/components/LoginModal.tsx`
- [Server Actions](https://github.com/rzalvaero/upshit-monitor/blob/main/src/app/actions.ts): `src/app/actions.ts`
- [Visibility Toggle](https://github.com/rzalvaero/upshit-monitor/blob/main/src/app/components/ToggleHideButton.tsx): `src/app/components/ToggleHideButton.tsx`
- [Monitor Delete](https://github.com/rzalvaero/upshit-monitor/blob/main/src/app/components/DeleteMonitorButton.tsx): `src/app/components/DeleteMonitorButton.tsx`
- [Admin Logout](https://github.com/rzalvaero/upshit-monitor/blob/main/src/app/components/LogoutButton.tsx): `src/app/components/LogoutButton.tsx`

### Uptime Checks

- [Manual Check](https://github.com/rzalvaero/upshit-monitor/blob/main/src/app/components/RefreshButton.tsx): `src/app/components/RefreshButton.tsx`
- [Check Endpoint](https://github.com/rzalvaero/upshit-monitor/blob/main/src/app/api/cron/check/route.ts): `src/app/api/cron/check/route.ts`

### Status Dashboard

- [Monitor Dashboard](https://github.com/rzalvaero/upshit-monitor/blob/main/src/app/page.tsx): `src/app/page.tsx`
- [Uptime Status View](https://github.com/rzalvaero/upshit-monitor/blob/main/src/app/page.tsx): `src/app/page.tsx`

### Persistence

- [Monitor Records](https://github.com/rzalvaero/upshit-monitor/blob/main/prisma/schema.prisma): `prisma/schema.prisma`
- [Ping History](https://github.com/rzalvaero/upshit-monitor/blob/main/prisma/schema.prisma): `prisma/schema.prisma`

### Other components

- **Admin**
- **Dashboard Visitor**
- **Cron Scheduler**
- **Monitored Endpoint**
- **Supabase Postgres**

## Connections

- Dashboard Visitor → Monitor Dashboard: opens
- Admin → Admin Login Modal: submits password
- Admin Login Modal → Server Actions: calls login
- Admin → Add Monitor Form: enters target
- Add Monitor Form → Server Actions: calls add
- Monitor Dashboard → Monitor Records: queries monitors
- Monitor Dashboard → Ping History: queries history
- Monitor Dashboard → Uptime Status View: renders status
- Admin → Visibility Toggle: changes visibility
- Visibility Toggle → Server Actions: calls toggle
- Admin → Monitor Delete: requests deletion
- Monitor Delete → Server Actions: calls delete
- Admin → Admin Logout: logs out
- Admin Logout → Server Actions: calls logout
- Server Actions → Monitor Records: creates or updates
- Server Actions → Ping History: deletes history
- Manual Check → Check Endpoint: fetches check
- Manual Check → Monitor Dashboard: refreshes view
- Cron Scheduler → Check Endpoint: invokes periodically
- Check Endpoint → Monitor Records: loads and updates
- Check Endpoint → Monitored Endpoint: probes URL
- Check Endpoint → Ping History: records result
- Monitor Records → Supabase Postgres: persists records
- Ping History → Supabase Postgres: persists history
