# eziokwuche/sentinel-api architecture

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

- Interactive diagram: https://gitdiagram.com/eziokwuche/sentinel-api
- Repository: https://github.com/eziokwuche/sentinel-api

## Overview

Sentinel API monitors registered HTTP endpoints on schedules or manual requests, persists check history and alert records, and presents status and latency analytics in a polling React dashboard. The graph follows the principal UI-to-API and check-to-result paths, plus documented alerting and analytics capabilities. Edges cite shown calls or README relationships; unsampled route/controller behavior is represented only where supported by the README and source index.

Main entry points: [`backend/src/index.js`](https://github.com/eziokwuche/sentinel-api/blob/main/backend/src/index.js) (Express API), [`frontend/src/services/api.js`](https://github.com/eziokwuche/sentinel-api/blob/main/frontend/src/services/api.js) (Axios client), [`frontend/src/App.jsx`](https://github.com/eziokwuche/sentinel-api/blob/main/frontend/src/App.jsx) (App), [`backend/src/services/monitorService.js`](https://github.com/eziokwuche/sentinel-api/blob/main/backend/src/services/monitorService.js) (Check and classify)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["React dashboard"]
  node_app["App<br/>[App.jsx]"]
  node_endpoint_form["Endpoint form"]
  node_dashboard["Dashboard<br/>[Dashboard.jsx]"]
  node_endpoint_card["Endpoint card<br/>[EndpointCard.jsx]"]
  node_latency_chart["Latency chart"]
  node_status_badge["Status badge<br/>[StatusBadge.jsx]"]
  node_endpoint_hook["Endpoint polling<br/>[useEndpoints.js]"]
  node_api_client["Axios client<br/>[api.js]"]
end

subgraph group_api["REST API"]
  node_express_api["Express API<br/>[index.js]"]
  node_endpoint_routes["Endpoint routes<br/>[endpointRoutes.js]"]
  node_endpoint_controller["Endpoint management"]
  node_check_routes["Check routes<br/>[checkRoutes.js]"]
  node_check_controller["Manual check handler<br/>[checkController.js]"]
  node_dashboard_routes["Dashboard routes<br/>[dashboardRoutes.js]"]
  node_health_routes["Health route<br/>[healthRoutes.js]"]
end

subgraph group_monitoring["Monitoring and alerts"]
  node_scheduler["Cron scheduler<br/>[cronJobs.js]"]
  node_monitor["Check and classify<br/>[monitorService.js]"]
  node_alert_service["Alert evaluation and email<br/>[alertService.js]"]
end

subgraph group_storage["Persistence"]
  node_db_service["Persistence and analytics queries<br/>[dbService.js]"]
  node_pg_pool[("PostgreSQL connection<br/>[db.js]")]
  node_schema["Database schema<br/>[schema.sql]"]
end

node_developer(("Developer"))
node_browser(("Browser user"))
node_target_endpoint(("Monitored HTTP endpoint"))
node_smtp(("Gmail SMTP"))
node_postgres[("PostgreSQL")]

node_browser -->|"uses"| node_app
node_app -->|"renders"| node_endpoint_form
node_app -->|"renders"| node_dashboard
node_app -->|"loads endpoints"| node_endpoint_hook
node_endpoint_form -->|"submits endpoint"| node_api_client
node_endpoint_hook -->|"polls endpoints"| node_api_client
node_dashboard -->|"loads summary"| node_api_client
node_dashboard -->|"renders"| node_endpoint_card
node_endpoint_card -->|"deletes endpoint"| node_api_client
node_endpoint_card -->|"renders"| node_latency_chart
node_endpoint_card -->|"renders"| node_status_badge
node_latency_chart -->|"loads history"| node_api_client
node_api_client -->|"sends REST requests"| node_express_api
node_express_api -->|"mounts"| node_endpoint_routes
node_express_api -->|"mounts"| node_check_routes
node_express_api -->|"mounts"| node_dashboard_routes
node_express_api -->|"mounts"| node_health_routes
node_endpoint_routes -->|"dispatches"| node_endpoint_controller
node_dashboard_routes -->|"dispatches"| node_endpoint_controller
node_check_routes -->|"dispatches"| node_check_controller
node_endpoint_controller -->|"manages endpoints"| node_db_service
node_endpoint_controller -->|"updates schedules"| node_scheduler
node_check_controller -->|"runs check"| node_monitor
node_scheduler -->|"loads active endpoints"| node_db_service
node_scheduler -->|"runs scheduled check"| node_monitor
node_monitor -->|"checks HTTP status"| node_target_endpoint
node_monitor -->|"reads and saves checks"| node_db_service
node_monitor -->|"evaluates alerts"| node_alert_service
node_alert_service -->|"stores alert"| node_db_service
node_alert_service -->|"sends email"| node_smtp
node_db_service -->|"queries"| node_pg_pool
node_pg_pool -.->|"connects"| node_postgres
node_schema -.->|"defines tables"| node_postgres
node_app -->|"refreshes after registration"| node_dashboard
node_express_api -->|"initializes jobs"| node_scheduler

click node_app "https://github.com/eziokwuche/sentinel-api/blob/main/frontend/src/App.jsx"
click node_endpoint_form "https://github.com/eziokwuche/sentinel-api/blob/main/frontend/src/components/AddEndpointForm.jsx"
click node_dashboard "https://github.com/eziokwuche/sentinel-api/blob/main/frontend/src/components/Dashboard.jsx"
click node_endpoint_card "https://github.com/eziokwuche/sentinel-api/blob/main/frontend/src/components/EndpointCard.jsx"
click node_latency_chart "https://github.com/eziokwuche/sentinel-api/blob/main/frontend/src/components/ResponseTimeChart.jsx"
click node_status_badge "https://github.com/eziokwuche/sentinel-api/blob/main/frontend/src/components/StatusBadge.jsx"
click node_endpoint_hook "https://github.com/eziokwuche/sentinel-api/blob/main/frontend/src/hooks/useEndpoints.js"
click node_api_client "https://github.com/eziokwuche/sentinel-api/blob/main/frontend/src/services/api.js"
click node_express_api "https://github.com/eziokwuche/sentinel-api/blob/main/backend/src/index.js"
click node_endpoint_routes "https://github.com/eziokwuche/sentinel-api/blob/main/backend/src/routes/endpointRoutes.js"
click node_endpoint_controller "https://github.com/eziokwuche/sentinel-api/blob/main/backend/src/controllers/endpointController.js"
click node_check_routes "https://github.com/eziokwuche/sentinel-api/blob/main/backend/src/routes/checkRoutes.js"
click node_check_controller "https://github.com/eziokwuche/sentinel-api/blob/main/backend/src/controllers/checkController.js"
click node_dashboard_routes "https://github.com/eziokwuche/sentinel-api/blob/main/backend/src/routes/dashboardRoutes.js"
click node_health_routes "https://github.com/eziokwuche/sentinel-api/blob/main/backend/src/routes/healthRoutes.js"
click node_scheduler "https://github.com/eziokwuche/sentinel-api/blob/main/backend/src/scheduler/cronJobs.js"
click node_monitor "https://github.com/eziokwuche/sentinel-api/blob/main/backend/src/services/monitorService.js"
click node_alert_service "https://github.com/eziokwuche/sentinel-api/blob/main/backend/src/services/alertService.js"
click node_db_service "https://github.com/eziokwuche/sentinel-api/blob/main/backend/src/services/dbService.js"
click node_pg_pool "https://github.com/eziokwuche/sentinel-api/blob/main/backend/src/config/db.js"
click node_schema "https://github.com/eziokwuche/sentinel-api/blob/main/backend/sql/schema.sql"

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_app,node_endpoint_form,node_dashboard,node_endpoint_card,node_latency_chart,node_status_badge,node_endpoint_hook,node_api_client,node_browser toneBlue
class node_express_api,node_endpoint_routes,node_endpoint_controller,node_check_routes,node_check_controller,node_dashboard_routes,node_health_routes,node_postgres toneAmber
class node_scheduler,node_monitor,node_alert_service toneMint
class node_db_service,node_pg_pool,node_schema toneRose
class node_developer,node_target_endpoint,node_smtp toneIndigo
```

## Components

### React dashboard

- [App](https://github.com/eziokwuche/sentinel-api/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Endpoint form](https://github.com/eziokwuche/sentinel-api/blob/main/frontend/src/components/AddEndpointForm.jsx): `frontend/src/components/AddEndpointForm.jsx`
- [Dashboard](https://github.com/eziokwuche/sentinel-api/blob/main/frontend/src/components/Dashboard.jsx): `frontend/src/components/Dashboard.jsx`
- [Endpoint card](https://github.com/eziokwuche/sentinel-api/blob/main/frontend/src/components/EndpointCard.jsx): `frontend/src/components/EndpointCard.jsx`
- [Latency chart](https://github.com/eziokwuche/sentinel-api/blob/main/frontend/src/components/ResponseTimeChart.jsx): `frontend/src/components/ResponseTimeChart.jsx`
- [Status badge](https://github.com/eziokwuche/sentinel-api/blob/main/frontend/src/components/StatusBadge.jsx): `frontend/src/components/StatusBadge.jsx`
- [Endpoint polling](https://github.com/eziokwuche/sentinel-api/blob/main/frontend/src/hooks/useEndpoints.js): `frontend/src/hooks/useEndpoints.js`
- [Axios client](https://github.com/eziokwuche/sentinel-api/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`

### REST API

- [Express API](https://github.com/eziokwuche/sentinel-api/blob/main/backend/src/index.js): `backend/src/index.js`
- [Endpoint routes](https://github.com/eziokwuche/sentinel-api/blob/main/backend/src/routes/endpointRoutes.js): `backend/src/routes/endpointRoutes.js`
- [Endpoint management](https://github.com/eziokwuche/sentinel-api/blob/main/backend/src/controllers/endpointController.js): `backend/src/controllers/endpointController.js`
- [Check routes](https://github.com/eziokwuche/sentinel-api/blob/main/backend/src/routes/checkRoutes.js): `backend/src/routes/checkRoutes.js`
- [Manual check handler](https://github.com/eziokwuche/sentinel-api/blob/main/backend/src/controllers/checkController.js): `backend/src/controllers/checkController.js`
- [Dashboard routes](https://github.com/eziokwuche/sentinel-api/blob/main/backend/src/routes/dashboardRoutes.js): `backend/src/routes/dashboardRoutes.js`
- [Health route](https://github.com/eziokwuche/sentinel-api/blob/main/backend/src/routes/healthRoutes.js): `backend/src/routes/healthRoutes.js`

### Monitoring and alerts

- [Cron scheduler](https://github.com/eziokwuche/sentinel-api/blob/main/backend/src/scheduler/cronJobs.js): `backend/src/scheduler/cronJobs.js`
- [Check and classify](https://github.com/eziokwuche/sentinel-api/blob/main/backend/src/services/monitorService.js): `backend/src/services/monitorService.js`
- [Alert evaluation and email](https://github.com/eziokwuche/sentinel-api/blob/main/backend/src/services/alertService.js): `backend/src/services/alertService.js`

### Persistence

- [Persistence and analytics queries](https://github.com/eziokwuche/sentinel-api/blob/main/backend/src/services/dbService.js): `backend/src/services/dbService.js`
- [PostgreSQL connection](https://github.com/eziokwuche/sentinel-api/blob/main/backend/src/config/db.js): `backend/src/config/db.js`
- [Database schema](https://github.com/eziokwuche/sentinel-api/blob/main/backend/sql/schema.sql): `backend/sql/schema.sql`

### Other components

- **Developer**
- **Browser user**
- **Monitored HTTP endpoint**
- **Gmail SMTP**
- **PostgreSQL**

## Connections

- Browser user → App: uses (evidence: `README.md`)
- App → Endpoint form: renders (evidence: `frontend/src/App.jsx`)
- App → Dashboard: renders (evidence: `frontend/src/App.jsx`)
- App → Endpoint polling: loads endpoints (evidence: `frontend/src/App.jsx`)
- Endpoint form → Axios client: submits endpoint (evidence: `frontend/src/components/AddEndpointForm.jsx`)
- Endpoint polling → Axios client: polls endpoints (evidence: `frontend/src/hooks/useEndpoints.js`)
- Dashboard → Axios client: loads summary (evidence: `frontend/src/components/Dashboard.jsx`)
- Dashboard → Endpoint card: renders (evidence: `frontend/src/components/Dashboard.jsx`)
- Endpoint card → Axios client: deletes endpoint (evidence: `frontend/src/components/EndpointCard.jsx`)
- Endpoint card → Latency chart: renders (evidence: `frontend/src/components/EndpointCard.jsx`)
- Endpoint card → Status badge: renders (evidence: `frontend/src/components/EndpointCard.jsx`)
- Latency chart → Axios client: loads history (evidence: `frontend/src/components/ResponseTimeChart.jsx`)
- Axios client → Express API: sends REST requests (evidence: `README.md`)
- Express API → Endpoint routes: mounts (evidence: `backend/src/index.js`)
- Express API → Check routes: mounts (evidence: `backend/src/index.js`)
- Express API → Dashboard routes: mounts (evidence: `backend/src/index.js`)
- Express API → Health route: mounts (evidence: `backend/src/index.js`)
- Endpoint routes → Endpoint management: dispatches (evidence: `backend/src/routes/endpointRoutes.js`)
- Dashboard routes → Endpoint management: dispatches (evidence: `backend/src/routes/dashboardRoutes.js`)
- Check routes → Manual check handler: dispatches (evidence: `backend/src/routes/checkRoutes.js`)
- Endpoint management → Persistence and analytics queries: manages endpoints (evidence: `backend/src/controllers/endpointController.js`)
- Endpoint management → Cron scheduler: updates schedules (evidence: `backend/src/controllers/endpointController.js`)
- Manual check handler → Check and classify: runs check (evidence: `backend/src/controllers/checkController.js`)
- Cron scheduler → Persistence and analytics queries: loads active endpoints (evidence: `backend/src/scheduler/cronJobs.js`)
- Cron scheduler → Check and classify: runs scheduled check (evidence: `backend/src/scheduler/cronJobs.js`)
- Check and classify → Monitored HTTP endpoint: checks HTTP status (evidence: `backend/src/services/monitorService.js`)
- Check and classify → Persistence and analytics queries: reads and saves checks (evidence: `backend/src/services/monitorService.js`)
- Check and classify → Alert evaluation and email: evaluates alerts (evidence: `backend/src/services/monitorService.js`)
- Alert evaluation and email → Persistence and analytics queries: stores alert (evidence: `backend/src/services/alertService.js`)
- Alert evaluation and email → Gmail SMTP: sends email (evidence: `backend/src/services/alertService.js`)
- Persistence and analytics queries → PostgreSQL connection: queries (evidence: `backend/src/services/dbService.js`)
- PostgreSQL connection → PostgreSQL: connects (evidence: `README.md`)
- Database schema → PostgreSQL: defines tables (evidence: `README.md`)
- App → Dashboard: refreshes after registration (evidence: `frontend/src/App.jsx`)
- Express API → Cron scheduler: initializes jobs (evidence: `backend/src/index.js`)
