# vishwajeet-gupta-001/api-sentinel architecture

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

- Interactive diagram: https://gitdiagram.com/vishwajeet-gupta-001/api-sentinel
- Repository: https://github.com/vishwajeet-gupta-001/api-sentinel

## Overview

API Sentinel lets users authenticate, configure API monitors, inspect health history and analytics, and manage incidents. Its runtime monitoring flow schedules due monitors into BullMQ, processes checks against external APIs, stores results, evaluates incident creation or recovery, and broadcasts events through Redis Pub/Sub and Socket.IO to the dashboard. The README documents the overall real-time and background-job architecture; source excerpts establish several key calls and route relationships, while some integration wiring is documented rather than sampled.

Main entry points: [`server/server.js`](https://github.com/vishwajeet-gupta-001/api-sentinel/blob/main/server/server.js) (Express and Socket.IO), [`frontend/src/App.jsx`](https://github.com/vishwajeet-gupta-001/api-sentinel/blob/main/frontend/src/App.jsx) (React application), [`server/workers/monitoringWorker.js`](https://github.com/vishwajeet-gupta-001/api-sentinel/blob/main/server/workers/monitoringWorker.js) (Check worker), [`server/controllers/dashboardController.js`](https://github.com/vishwajeet-gupta-001/api-sentinel/blob/main/server/controllers/dashboardController.js) (Summary and analytics)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web dashboard"]
  node_app["React application<br/>[App.jsx]"]
  node_authui["Authentication state<br/>[AuthContext.jsx]"]
  node_monitorui["Monitor management<br/>[CreateMonitor.jsx]"]
  node_monitorviews["Monitor views<br/>[MonitorDetails.jsx]"]
  node_dashboard["Dashboard analytics<br/>[Dashboard.jsx]"]
  node_incidentui["Incident views<br/>[Incidents.jsx]"]
  node_apiurl["API endpoint config<br/>[config.js]"]
end

subgraph group_api["API and access"]
  node_server["Express and Socket.IO<br/>[server.js]"]
  node_authroutes["Authentication routes<br/>[authRoutes.js]"]
  node_authctrl["Authentication service<br/>[authController.js]"]
  node_monitorroutes["Monitor routes<br/>[monitorRoutes.js]"]
  node_monitorctrl["Monitor operations"]
  node_incidentroutes["Incident routes<br/>[incidentRoutes.js]"]
  node_incidentctrl["Incident operations"]
  node_dashroutes["Dashboard routes<br/>[dashboardRoutes.js]"]
  node_dashctrl["Summary and analytics"]
end

subgraph group_monitoring["Monitoring pipeline"]
  node_scheduler["Monitoring scheduler"]
  node_queue["BullMQ job queue<br/>[monitoringQueue.js]"]
  node_worker["Check worker"]
end

subgraph group_data["Application data"]
  node_mongo[("MongoDB records<br/>[db.js]")]
  node_monitor["Monitor records<br/>[Monitor.js]"]
  node_check["Check history<br/>[CheckResult.js]"]
  node_incident["Incident records<br/>[Incident.js]"]
end

subgraph group_realtime["Live events"]
  node_publisher["Event publisher<br/>[pubsubPublisher.js]"]
  node_subscriber["Event subscriber"]
  node_redis[("Redis Pub/Sub<br/>[redis.js]")]
end

node_user(("Monitor user"))
node_target{{"Monitored APIs"}}

node_user -->|"uses"| node_app
node_app -->|"provides auth"| node_authui
node_app -->|"routes to"| node_monitorui
node_app -->|"routes to"| node_monitorviews
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_incidentui
node_monitorui -->|"uses endpoint"| node_apiurl
node_monitorviews -->|"uses endpoint"| node_apiurl
node_dashboard -->|"uses endpoint"| node_apiurl
node_incidentui -->|"uses endpoint"| node_apiurl
node_app -->|"calls API"| node_server
node_server -->|"mounts routes"| node_authroutes
node_server -->|"mounts routes"| node_monitorroutes
node_server -->|"mounts routes"| node_incidentroutes
node_server -->|"mounts routes"| node_dashroutes
node_authroutes -->|"dispatches"| node_authctrl
node_monitorroutes -->|"dispatches"| node_monitorctrl
node_incidentroutes -->|"dispatches"| node_incidentctrl
node_dashroutes -->|"dispatches"| node_dashctrl
node_server -->|"starts"| node_scheduler
node_scheduler -->|"finds due monitors"| node_monitor
node_scheduler -->|"enqueues jobs"| node_queue
node_queue -->|"delivers jobs"| node_worker
node_worker -->|"checks API"| node_target
node_worker -->|"stores results"| node_check
node_worker -->|"updates status"| node_monitor
node_worker -.->|"evaluates incidents"| node_incidentctrl
node_worker -->|"evaluates failures"| node_incident
node_monitorctrl -->|"reads and writes"| node_monitor
node_monitorctrl -->|"reads history"| node_check
node_dashctrl -->|"counts monitors"| node_monitor
node_dashctrl -->|"reads analytics"| node_check
node_dashctrl -->|"counts incidents"| node_incident
node_incidentctrl -->|"manages incidents"| node_incident
node_worker -->|"publishes changes"| node_publisher
node_incident -->|"publishes transitions"| node_publisher
node_publisher -->|"publishes events"| node_redis
node_redis -->|"forwards events"| node_subscriber
node_server -->|"initializes"| node_subscriber
node_subscriber -->|"emits Socket.IO"| node_server
node_server -->|"pushes live updates"| node_app

click node_app "https://github.com/vishwajeet-gupta-001/api-sentinel/blob/main/frontend/src/App.jsx"
click node_authui "https://github.com/vishwajeet-gupta-001/api-sentinel/blob/main/frontend/src/context/AuthContext.jsx"
click node_monitorui "https://github.com/vishwajeet-gupta-001/api-sentinel/blob/main/frontend/src/pages/CreateMonitor.jsx"
click node_monitorviews "https://github.com/vishwajeet-gupta-001/api-sentinel/blob/main/frontend/src/pages/MonitorDetails.jsx"
click node_dashboard "https://github.com/vishwajeet-gupta-001/api-sentinel/blob/main/frontend/src/pages/Dashboard.jsx"
click node_incidentui "https://github.com/vishwajeet-gupta-001/api-sentinel/blob/main/frontend/src/pages/Incidents.jsx"
click node_apiurl "https://github.com/vishwajeet-gupta-001/api-sentinel/blob/main/frontend/src/config.js"
click node_server "https://github.com/vishwajeet-gupta-001/api-sentinel/blob/main/server/server.js"
click node_authroutes "https://github.com/vishwajeet-gupta-001/api-sentinel/blob/main/server/routes/authRoutes.js"
click node_authctrl "https://github.com/vishwajeet-gupta-001/api-sentinel/blob/main/server/controllers/authController.js"
click node_monitorroutes "https://github.com/vishwajeet-gupta-001/api-sentinel/blob/main/server/routes/monitorRoutes.js"
click node_monitorctrl "https://github.com/vishwajeet-gupta-001/api-sentinel/blob/main/server/controllers/monitorController.js"
click node_incidentroutes "https://github.com/vishwajeet-gupta-001/api-sentinel/blob/main/server/routes/incidentRoutes.js"
click node_incidentctrl "https://github.com/vishwajeet-gupta-001/api-sentinel/blob/main/server/controllers/incidentController.js"
click node_dashroutes "https://github.com/vishwajeet-gupta-001/api-sentinel/blob/main/server/routes/dashboardRoutes.js"
click node_dashctrl "https://github.com/vishwajeet-gupta-001/api-sentinel/blob/main/server/controllers/dashboardController.js"
click node_scheduler "https://github.com/vishwajeet-gupta-001/api-sentinel/blob/main/server/scheduler/monitoringScheduler.js"
click node_queue "https://github.com/vishwajeet-gupta-001/api-sentinel/blob/main/server/queues/monitoringQueue.js"
click node_worker "https://github.com/vishwajeet-gupta-001/api-sentinel/blob/main/server/workers/monitoringWorker.js"
click node_mongo "https://github.com/vishwajeet-gupta-001/api-sentinel/blob/main/server/config/db.js"
click node_monitor "https://github.com/vishwajeet-gupta-001/api-sentinel/blob/main/server/models/Monitor.js"
click node_check "https://github.com/vishwajeet-gupta-001/api-sentinel/blob/main/server/models/CheckResult.js"
click node_incident "https://github.com/vishwajeet-gupta-001/api-sentinel/blob/main/server/models/Incident.js"
click node_publisher "https://github.com/vishwajeet-gupta-001/api-sentinel/blob/main/server/pubsub/pubsubPublisher.js"
click node_subscriber "https://github.com/vishwajeet-gupta-001/api-sentinel/blob/main/server/pubsub/pubsubSubscriber.js"
click node_redis "https://github.com/vishwajeet-gupta-001/api-sentinel/blob/main/server/config/redis.js"

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_authui,node_monitorui,node_monitorviews,node_dashboard,node_incidentui,node_apiurl,node_user toneBlue
class node_server,node_authroutes,node_authctrl,node_monitorroutes,node_monitorctrl,node_incidentroutes,node_incidentctrl,node_dashroutes,node_dashctrl toneAmber
class node_scheduler,node_queue,node_worker,node_target toneMint
class node_mongo,node_monitor,node_check,node_incident toneRose
class node_publisher,node_subscriber,node_redis toneIndigo
```

## Components

### Web dashboard

- [React application](https://github.com/vishwajeet-gupta-001/api-sentinel/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Authentication state](https://github.com/vishwajeet-gupta-001/api-sentinel/blob/main/frontend/src/context/AuthContext.jsx): `frontend/src/context/AuthContext.jsx`
- [Monitor management](https://github.com/vishwajeet-gupta-001/api-sentinel/blob/main/frontend/src/pages/CreateMonitor.jsx): `frontend/src/pages/CreateMonitor.jsx`
- [Monitor views](https://github.com/vishwajeet-gupta-001/api-sentinel/blob/main/frontend/src/pages/MonitorDetails.jsx): `frontend/src/pages/MonitorDetails.jsx`
- [Dashboard analytics](https://github.com/vishwajeet-gupta-001/api-sentinel/blob/main/frontend/src/pages/Dashboard.jsx): `frontend/src/pages/Dashboard.jsx`
- [Incident views](https://github.com/vishwajeet-gupta-001/api-sentinel/blob/main/frontend/src/pages/Incidents.jsx): `frontend/src/pages/Incidents.jsx`
- [API endpoint config](https://github.com/vishwajeet-gupta-001/api-sentinel/blob/main/frontend/src/config.js): `frontend/src/config.js`

### API and access

- [Express and Socket.IO](https://github.com/vishwajeet-gupta-001/api-sentinel/blob/main/server/server.js): `server/server.js`
- [Authentication routes](https://github.com/vishwajeet-gupta-001/api-sentinel/blob/main/server/routes/authRoutes.js): `server/routes/authRoutes.js`
- [Authentication service](https://github.com/vishwajeet-gupta-001/api-sentinel/blob/main/server/controllers/authController.js): `server/controllers/authController.js`
- [Monitor routes](https://github.com/vishwajeet-gupta-001/api-sentinel/blob/main/server/routes/monitorRoutes.js): `server/routes/monitorRoutes.js`
- [Monitor operations](https://github.com/vishwajeet-gupta-001/api-sentinel/blob/main/server/controllers/monitorController.js): `server/controllers/monitorController.js`
- [Incident routes](https://github.com/vishwajeet-gupta-001/api-sentinel/blob/main/server/routes/incidentRoutes.js): `server/routes/incidentRoutes.js`
- [Incident operations](https://github.com/vishwajeet-gupta-001/api-sentinel/blob/main/server/controllers/incidentController.js): `server/controllers/incidentController.js`
- [Dashboard routes](https://github.com/vishwajeet-gupta-001/api-sentinel/blob/main/server/routes/dashboardRoutes.js): `server/routes/dashboardRoutes.js`
- [Summary and analytics](https://github.com/vishwajeet-gupta-001/api-sentinel/blob/main/server/controllers/dashboardController.js): `server/controllers/dashboardController.js`

### Monitoring pipeline

- [Monitoring scheduler](https://github.com/vishwajeet-gupta-001/api-sentinel/blob/main/server/scheduler/monitoringScheduler.js): `server/scheduler/monitoringScheduler.js`
- [BullMQ job queue](https://github.com/vishwajeet-gupta-001/api-sentinel/blob/main/server/queues/monitoringQueue.js): `server/queues/monitoringQueue.js`
- [Check worker](https://github.com/vishwajeet-gupta-001/api-sentinel/blob/main/server/workers/monitoringWorker.js): `server/workers/monitoringWorker.js`

### Application data

- [MongoDB records](https://github.com/vishwajeet-gupta-001/api-sentinel/blob/main/server/config/db.js): `server/config/db.js`
- [Monitor records](https://github.com/vishwajeet-gupta-001/api-sentinel/blob/main/server/models/Monitor.js): `server/models/Monitor.js`
- [Check history](https://github.com/vishwajeet-gupta-001/api-sentinel/blob/main/server/models/CheckResult.js): `server/models/CheckResult.js`
- [Incident records](https://github.com/vishwajeet-gupta-001/api-sentinel/blob/main/server/models/Incident.js): `server/models/Incident.js`

### Live events

- [Event publisher](https://github.com/vishwajeet-gupta-001/api-sentinel/blob/main/server/pubsub/pubsubPublisher.js): `server/pubsub/pubsubPublisher.js`
- [Event subscriber](https://github.com/vishwajeet-gupta-001/api-sentinel/blob/main/server/pubsub/pubsubSubscriber.js): `server/pubsub/pubsubSubscriber.js`
- [Redis Pub/Sub](https://github.com/vishwajeet-gupta-001/api-sentinel/blob/main/server/config/redis.js): `server/config/redis.js`

### Other components

- **Monitor user**
- **Monitored APIs**

## Connections

- Monitor user → React application: uses (evidence: `README.md`)
- React application → Authentication state: provides auth (evidence: `frontend/src/main.jsx`)
- React application → Monitor management: routes to (evidence: `frontend/src/App.jsx`)
- React application → Monitor views: routes to (evidence: `frontend/src/App.jsx`)
- React application → Dashboard analytics: routes to (evidence: `frontend/src/App.jsx`)
- React application → Incident views: routes to (evidence: `frontend/src/App.jsx`)
- Monitor management → API endpoint config: uses endpoint (evidence: `frontend/src/pages/CreateMonitor.jsx`)
- Monitor views → API endpoint config: uses endpoint (evidence: `frontend/src/pages/MonitorDetails.jsx`)
- Dashboard analytics → API endpoint config: uses endpoint (evidence: `frontend/src/pages/Dashboard.jsx`)
- Incident views → API endpoint config: uses endpoint (evidence: `frontend/src/pages/Incidents.jsx`)
- React application → Express and Socket.IO: calls API (evidence: `README.md`)
- Express and Socket.IO → Authentication routes: mounts routes (evidence: `server/server.js`)
- Express and Socket.IO → Monitor routes: mounts routes (evidence: `server/server.js`)
- Express and Socket.IO → Incident routes: mounts routes (evidence: `server/server.js`)
- Express and Socket.IO → Dashboard routes: mounts routes (evidence: `server/server.js`)
- Authentication routes → Authentication service: dispatches (evidence: `server/routes/authRoutes.js`)
- Monitor routes → Monitor operations: dispatches (evidence: `server/routes/monitorRoutes.js`)
- Incident routes → Incident operations: dispatches (evidence: `server/routes/incidentRoutes.js`)
- Dashboard routes → Summary and analytics: dispatches (evidence: `server/routes/dashboardRoutes.js`)
- Express and Socket.IO → Monitoring scheduler: starts (evidence: `server/server.js`)
- Monitoring scheduler → Monitor records: finds due monitors (evidence: `server/scheduler/monitoringScheduler.js`)
- Monitoring scheduler → BullMQ job queue: enqueues jobs (evidence: `server/scheduler/monitoringScheduler.js`)
- BullMQ job queue → Check worker: delivers jobs (evidence: `README.md`)
- Check worker → Monitored APIs: checks API (evidence: `README.md`)
- Check worker → Check history: stores results (evidence: `README.md`)
- Check worker → Monitor records: updates status (evidence: `server/workers/monitoringWorker.js`)
- Check worker → Incident operations: evaluates incidents
- Check worker → Incident records: evaluates failures
- Monitor operations → Monitor records: reads and writes (evidence: `server/controllers/monitorController.js`)
- Monitor operations → Check history: reads history (evidence: `server/controllers/monitorController.js`)
- Summary and analytics → Monitor records: counts monitors (evidence: `server/controllers/dashboardController.js`)
- Summary and analytics → Check history: reads analytics (evidence: `server/controllers/dashboardController.js`)
- Summary and analytics → Incident records: counts incidents (evidence: `server/controllers/dashboardController.js`)
- Incident operations → Incident records: manages incidents (evidence: `server/controllers/incidentController.js`)
- Check worker → Event publisher: publishes changes (evidence: `server/workers/monitoringWorker.js`)
- Incident records → Event publisher: publishes transitions (evidence: `server/services/incidentEngine.js`)
- Event publisher → Redis Pub/Sub: publishes events
- Redis Pub/Sub → Event subscriber: forwards events (evidence: `README.md`)
- Express and Socket.IO → Event subscriber: initializes (evidence: `server/server.js`)
- Event subscriber → Express and Socket.IO: emits Socket.IO (evidence: `README.md`)
- Express and Socket.IO → React application: pushes live updates (evidence: `README.md`)
