Skip to content

Garuda API - The core backend service for API Garuda, a real-time API health monitoring and alerting system. It efficiently tracks uptime, response times, and status codes, leveraging Redis and RabbitMQ for optimized performance. ๐Ÿš€

Notifications You must be signed in to change notification settings

AtharvaPanegai/garuda-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

77 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿš€ Garuda API โ€“ Scalable API Health Monitoring System

Website
GitHub Issues
GitHub Stars

Garuda API Radar is a comprehensive API monitoring and alerting system designed to help you track your APIs' performance and availability in real time. This project provides a robust backend built with Node.js, Express, and MongoDB, along with various utilities and services to ensure your APIs are always up and running.


๐Ÿ”— Garuda Ecosystem

Garuda is a multi-service platform, and this repo serves as the core backend. Below are the other services in the ecosystem:

Service Description Repo Link
Garuda API (Backend) Main backend handling API monitoring and data processing ๐Ÿ”— Garuda API
Garuda UI (Frontend) Web dashboard for real-time API analytics ๐Ÿ”— Garuda UI
Garuda Caching Service Redis-based caching layer for optimized monitoring ๐Ÿ”— Garuda Caching
API Radar NPM package for auto-collecting API health metrics ๐Ÿ”— API Radar

๐Ÿš€ Features

โœ… Real-time API monitoring โ€“ Track uptime, response time & availability
โœ… Incident detection & alerting โ€“ Get alerts via email when APIs fail
โœ… Secure API key management โ€“ Protect APIs with unique keys
โœ… User authentication & authorization โ€“ Secure login & access control
โœ… Project & API tracking โ€“ Manage multiple projects efficiently
โœ… Detailed analytics & reporting โ€“ Get insights into API performance


๐Ÿ› ๏ธ Tech Stack

  • Backend: Node.js, Express.js
  • Database: MongoDB, Redis
  • Messaging & Streaming: Kafka, RabbitMQ
  • Frontend: React.js (UI repo linked above)

๐Ÿ“œ Table of Contents


โš“ Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/garuda-api-radar.git
    cd garuda-api-radar
  2. Install dependencies:

    npm install
  3. Create a .env file in the root directory and add the following environment variables:

    DB_CONNECTION_STRING=your_mongodb_connection_string
    PORT=4000
    JWT_SECRET=your_jwt_secret
    JWT_EXPIRY=7d
    COOKIE_TIME=7
    EMAIL_FROM=your_email@example.com
    EMAIL_AUTH_TOKEN=your_email_auth_token
  4. Start the server:

    npm start

๐Ÿ’ป Configuration

The application uses environment variables for configuration. Ensure you have a .env file with the necessary variables as shown in the installation section.

๐Ÿ˜Ž Usage

Running the Application

To run the application in development mode:

npm run dev

To run the application in production mode:

npm start

๐Ÿ“ƒ API Documentation

User Authentication

Sign Up

  • Endpoint: /api/v1/signup
  • Method: POST
  • Description: Register a new user.
  • Request Body:
    {
        "username": "john_doe",
        "emailId": "john@example.com",
        "phoneNumber": "1234567890",
        "companyName": "Example Inc",
        "password": "password123"
    }
  • Response:
    {
        "success": true,
        "token": "jwt_token",
        "user": {
            "username": "john_doe",
            "emailId": "john@example.com",
            "phoneNumber": "1234567890",
            "companyName": "Example Inc"
        }
    }

Sign In

  • Endpoint: /api/v1/signin
  • Method: POST
  • Description: Authenticate a user.
  • Request Body:
    {
        "email": "john@example.com",
        "password": "password123"
    }
  • Response:
    {
        "success": true,
        "token": "jwt_token",
        "user": {
            "username": "john_doe",
            "emailId": "john@example.com",
            "phoneNumber": "1234567890",
            "companyName": "Example Inc"
        }
    }

Project Management

Create Project

  • Endpoint: /api/v1/project/create
  • Method: POST
  • Description: Create a new project.
  • Request Body:
    {
        "userId": "user_id",
        "projectName": "New Project"
    }
  • Response:
    {
        "message": "Project Created successfully!",
        "project": {
            "projectName": "New Project",
            "customer": "user_id"
        }
    }

Create Project API Key

  • Endpoint: /api/v1/project/createapikey
  • Method: POST
  • Description: Generate an API key for a project.
  • Request Body:
    {
        "userId": "user_id",
        "projectId": "project_id"
    }
  • Response:
    {
        "message": "API Key for project Created!",
        "apiKey": "generated_api_key"
    }

API Monitoring

Onboard APIs as per Hits

  • Endpoint: /api/v1/radar/monitorapi
  • Method: POST
  • Description: Process API hits and onboard APIs.
  • Request Body:
    {
        "projectId": "project_id",
        "method": "POST",
        "path": "/api/v1/signin",
        "headers": {
            "content-type": "application/json"
        },
        "statusCode": 200,
        "responseTime": "266.686 ms"
    }
  • Response:
    {
        "message": "Hit Recorded!"
    }

Incident Reporting

Get Cumulative Project Report

  • Endpoint: /api/v1/project/report
  • Method: POST
  • Description: Get a cumulative report for a project.
  • Request Body:
    {
        "projectId": "project_id"
    }
  • Response:
    {
        "message": "Project Report Generated Successfully!",
        "projectReport": {
            "project": {
                "projectName": "New Project",
                "customer": "user_id"
            },
            "totalApisCount": 5,
            "totalIncidentsReported": 2,
            "overAllStatusCode": 200,
            "projectAge": "2 days ago",
            "onCallPerson": "John Doe",
            "apiHitsReport": [
                {
                    "date": "2023-10-01",
                    "hits": 100
                }
            ],
            "statusSummaryArray": [
                {
                    "name": "Success",
                    "value": 90
                }
            ],
            "totalApisForProject": [
                {
                    "apiEndPoint": "/api/v1/signin",
                    "apiMethod": "POST"
                }
            ]
        }
    }

Garuda API Monitoring System - Architecture & HLD Diagrams (ASCII Format)

1. SYSTEM ARCHITECTURE DIAGRAM

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                         CLIENT APPLICATION LAYER                             โ”‚
โ”‚                                                                               โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”‚
โ”‚  โ”‚  User Application with api-radar NPM Package                         โ”‚   โ”‚
โ”‚  โ”‚  - Express.js Middleware                                             โ”‚   โ”‚
โ”‚  โ”‚  - Auto-captures: method, path, status, responseTime                 โ”‚   โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                        โ”‚
                                        โ”‚ API Requests + Metrics
                                        โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                           GATEWAY LAYER (NGINX)                              โ”‚
โ”‚                                                                               โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”‚
โ”‚  โ”‚  NGINX Gateway / Load Balancer                                       โ”‚   โ”‚
โ”‚  โ”‚  - Routes traffic to Garuda-Caching                                  โ”‚   โ”‚
โ”‚  โ”‚  - Load balancing                                                    โ”‚   โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                        โ”‚
                                        โ”‚ Route Traffic
                                        โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                     CACHING & MESSAGE QUEUE LAYER                            โ”‚
โ”‚                                                                               โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
โ”‚  โ”‚  Garuda-Caching Service  โ”‚โ—„โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บโ”‚  Redis Cache                     โ”‚ โ”‚
โ”‚  โ”‚  - Port: 5095            โ”‚         โ”‚  - Monitoring Status             โ”‚ โ”‚
โ”‚  โ”‚  - Node.js + Express     โ”‚         โ”‚  - API Configurations            โ”‚ โ”‚
โ”‚  โ”‚  - Route Decision Logic  โ”‚         โ”‚  - Fast Lookups                  โ”‚ โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
โ”‚              โ”‚                                                               โ”‚
โ”‚              โ”‚                                                               โ”‚
โ”‚              โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บ [Critical/New API] โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”             โ”‚
โ”‚              โ”‚                                                 โ”‚             โ”‚
โ”‚              โ”‚                                                 โ”‚             โ”‚
โ”‚              โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บ [Normal Traffic] โ”€โ”€โ”€โ”€โ”€โ”€โ”             โ”‚             โ”‚
โ”‚                                                  โ”‚             โ”‚             โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚             โ”‚             โ”‚
โ”‚  โ”‚  RabbitMQ Message Queue                   โ”‚โ—„โ”€โ”˜             โ”‚             โ”‚
โ”‚  โ”‚  - Queue: garuda.monitorapi               โ”‚                โ”‚             โ”‚
โ”‚  โ”‚  - Async message buffering                โ”‚                โ”‚             โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                โ”‚             โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                         โ”‚                                       โ”‚
                         โ”‚ Consume Messages                      โ”‚ Direct Route
                         โ–ผ                                       โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
โ”‚              BATCH PROCESSING LAYER                          โ”‚ โ”‚
โ”‚                                                               โ”‚ โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”‚ โ”‚
โ”‚  โ”‚  Batch Consumer Service                              โ”‚   โ”‚ โ”‚
โ”‚  โ”‚  - Aggregates in-memory                              โ”‚   โ”‚ โ”‚
โ”‚  โ”‚  - Max Batch Size: 500 messages                      โ”‚   โ”‚ โ”‚
โ”‚  โ”‚  - Flush Interval: 60 seconds                        โ”‚   โ”‚ โ”‚
โ”‚  โ”‚                                                       โ”‚   โ”‚ โ”‚
โ”‚  โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”            โ”‚   โ”‚ โ”‚
โ”‚  โ”‚  โ”‚  In-Memory Batch Storage            โ”‚            โ”‚   โ”‚ โ”‚
โ”‚  โ”‚  โ”‚  {                                  โ”‚            โ”‚   โ”‚ โ”‚
โ”‚  โ”‚  โ”‚    "projectId_apiPath": {          โ”‚            โ”‚   โ”‚ โ”‚
โ”‚  โ”‚  โ”‚      hits: count,                   โ”‚            โ”‚   โ”‚ โ”‚
โ”‚  โ”‚  โ”‚      apiLogs: [...]                โ”‚            โ”‚   โ”‚ โ”‚
โ”‚  โ”‚  โ”‚    }                                โ”‚            โ”‚   โ”‚ โ”‚
โ”‚  โ”‚  โ”‚  }                                  โ”‚            โ”‚   โ”‚ โ”‚
โ”‚  โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜            โ”‚   โ”‚ โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ”‚ โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
                           โ”‚ POST /radar/bulkupdate             โ”‚
                           โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                            โ”‚
                                            โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                         CORE SERVICES LAYER                                  โ”‚
โ”‚                                                                               โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”‚
โ”‚  โ”‚  Garuda-API Service (Port: 5094)                                     โ”‚   โ”‚
โ”‚  โ”‚                                                                       โ”‚   โ”‚
โ”‚  โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚   โ”‚
โ”‚  โ”‚  โ”‚ User Controller  โ”‚  โ”‚ Project          โ”‚  โ”‚ Radar Controller โ”‚  โ”‚   โ”‚
โ”‚  โ”‚  โ”‚ - Signup/Signin  โ”‚  โ”‚ Controller       โ”‚  โ”‚ - Process Hits   โ”‚  โ”‚   โ”‚
โ”‚  โ”‚  โ”‚ - Authentication โ”‚  โ”‚ - CRUD Ops       โ”‚  โ”‚ - Bulk Updates   โ”‚  โ”‚   โ”‚
โ”‚  โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚   โ”‚
โ”‚  โ”‚                                                                       โ”‚   โ”‚
โ”‚  โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚   โ”‚
โ”‚  โ”‚  โ”‚                     Services Layer                             โ”‚ โ”‚   โ”‚
โ”‚  โ”‚  โ”‚  - Email Service (Nodemailer + Brevo SMTP)                     โ”‚ โ”‚   โ”‚
โ”‚  โ”‚  โ”‚  - Redis Service (Cache Operations)                            โ”‚ โ”‚   โ”‚
โ”‚  โ”‚  โ”‚  - Kafka Service (Stream Processing)                           โ”‚ โ”‚   โ”‚
โ”‚  โ”‚  โ”‚  - RabbitMQ Service (Message Publishing)                       โ”‚ โ”‚   โ”‚
โ”‚  โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚   โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                         โ”‚
                                         โ”‚ Read/Write Operations
                                         โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                           DATA PERSISTENCE LAYER                             โ”‚
โ”‚                                                                               โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”‚
โ”‚  โ”‚                      MongoDB Database                                โ”‚   โ”‚
โ”‚  โ”‚                                                                       โ”‚   โ”‚
โ”‚  โ”‚  Collections:                                                        โ”‚   โ”‚
โ”‚  โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”             โ”‚   โ”‚
โ”‚  โ”‚  โ”‚  Users       โ”‚  โ”‚  Projects    โ”‚  โ”‚  APIs        โ”‚             โ”‚   โ”‚
โ”‚  โ”‚  โ”‚  - Auth Data โ”‚  โ”‚  - API Keys  โ”‚  โ”‚  - Endpoints โ”‚             โ”‚   โ”‚
โ”‚  โ”‚  โ”‚  - Profile   โ”‚  โ”‚  - On-call   โ”‚  โ”‚  - Status    โ”‚             โ”‚   โ”‚
โ”‚  โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜             โ”‚   โ”‚
โ”‚  โ”‚                                                                       โ”‚   โ”‚
โ”‚  โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                                โ”‚   โ”‚
โ”‚  โ”‚  โ”‚  Radar       โ”‚  โ”‚  Incidents   โ”‚                                โ”‚   โ”‚
โ”‚  โ”‚  โ”‚  - Metrics   โ”‚  โ”‚  - Failures  โ”‚                                โ”‚   โ”‚
โ”‚  โ”‚  โ”‚  - Response  โ”‚  โ”‚  - Alerts    โ”‚                                โ”‚   โ”‚
โ”‚  โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                                โ”‚   โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                        โ”‚
                                        โ”‚ On API Failure (5xx)
                                        โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                        NOTIFICATION SERVICES                                 โ”‚
โ”‚                                                                               โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”      โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”‚
โ”‚  โ”‚  Email Alert Service         โ”‚      โ”‚  SMS Service (Optional)      โ”‚    โ”‚
โ”‚  โ”‚  - Nodemailer                โ”‚      โ”‚  - Twilio Integration        โ”‚    โ”‚
โ”‚  โ”‚  - Brevo SMTP Relay          โ”‚      โ”‚  - SMS Notifications         โ”‚    โ”‚
โ”‚  โ”‚  - Alert on-call person      โ”‚      โ”‚                              โ”‚    โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜      โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜


โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                            FRONTEND LAYER                                    โ”‚
โ”‚                                                                               โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”‚
โ”‚  โ”‚  Garuda-UI Dashboard                                                 โ”‚   โ”‚
โ”‚  โ”‚  - React 18 + Redux                                                  โ”‚   โ”‚
โ”‚  โ”‚  - Tailwind CSS                                                      โ”‚   โ”‚
โ”‚  โ”‚  - Recharts for Analytics                                            โ”‚   โ”‚
โ”‚  โ”‚  - Real-time Monitoring                                              โ”‚   โ”‚
โ”‚  โ”‚  - Project Management                                                โ”‚   โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

2. HIGH-LEVEL DESIGN (HLD) - REQUEST FLOW

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Client App   โ”‚  Step 1: User makes API request
โ”‚ (api-radar)  โ”‚          AddRadar middleware captures metrics
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜          (method, path, status, responseTime)
       โ”‚
       โ”‚ POST with metrics
       โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚    NGINX     โ”‚  Step 2: Gateway routes to Caching Service
โ”‚   Gateway    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
       โ”‚
       โ”‚ Route to /api/v1/cache/monitorapi
       โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Garuda-Caching   โ”‚  Step 3: Check Redis for monitoring status
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         โ”‚
         โ”‚ GET monitoring status
         โ–ผ
     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”
     โ”‚Redis โ”‚  Step 4: Return status (enabled/disabled)
     โ””โ”€โ”€โ”€โ”ฌโ”€โ”€โ”˜
         โ”‚
         โ”‚ Status returned
         โ–ผ
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚  DECISION: Is API Critical or New?  โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
              โ”‚              โ”‚
     YES (5xx โ”‚              โ”‚ NO (2xx/3xx/4xx)
     or New)  โ”‚              โ”‚
              โ–ผ              โ–ผ
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚ DIRECT ROUTE โ”‚   โ”‚ QUEUE ROUTE  โ”‚  Step 5: Route decision
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
           โ”‚                  โ”‚
           โ”‚                  โ”‚ Publish message
           โ”‚                  โ–ผ
           โ”‚            โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
           โ”‚            โ”‚  RabbitMQ    โ”‚  Step 6: Queue for batch processing
           โ”‚            โ”‚    Queue     โ”‚
           โ”‚            โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
           โ”‚                   โ”‚
           โ”‚                   โ”‚ Consume
           โ”‚                   โ–ผ
           โ”‚            โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
           โ”‚            โ”‚ Batch Consumer   โ”‚  Step 7: Aggregate messages
           โ”‚            โ”‚                  โ”‚          in memory
           โ”‚            โ”‚ Count: N/500     โ”‚
           โ”‚            โ”‚ Timer: T/60s     โ”‚
           โ”‚            โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
           โ”‚                   โ”‚
           โ”‚                   โ”‚ When Nโ‰ฅ500 OR Tโ‰ฅ60s
           โ”‚                   โ”‚
           โ”‚                   โ”‚ POST /radar/bulkupdate
           โ”‚                   โ”‚
           โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                                                  โ–ผ
                                          โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                                          โ”‚ Garuda-API   โ”‚  Step 8: Process request
                                          โ”‚   Service    โ”‚
                                          โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                                 โ”‚
                                                 โ”‚ Validate API Key & Project
                                                 โ–ผ
                                          โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                                          โ”‚ Create/Updateโ”‚  Step 9: Update API model
                                          โ”‚  API Model   โ”‚
                                          โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                                 โ”‚
                                                 โ–ผ
                                          โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                                          โ”‚ Update Radar โ”‚  Step 10: Update metrics
                                          โ”‚   Metrics    โ”‚
                                          โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                                 โ”‚
                                                 โ”‚
                                      โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                                      โ”‚ Is API Down (5xx)?  โ”‚  Step 11: Check for incidents
                                      โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                          YESโ”‚      โ”‚NO
                                             โ”‚      โ”‚
                                             โ–ผ      โ–ผ
                                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                                    โ”‚ Create   โ”‚  โ”‚  Save  โ”‚
                                    โ”‚ Incident โ”‚  โ”‚   to   โ”‚
                                    โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚MongoDB โ”‚
                                         โ”‚        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                         โ”‚ Check recent
                                         โ”‚ (within 15 min)
                                         โ–ผ
                                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                                    โ”‚   Send   โ”‚  Step 12: Alert on-call person
                                    โ”‚  Email   โ”‚
                                    โ”‚  Alert   โ”‚
                                    โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜
                                         โ”‚
                                         โ–ผ
                                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                                    โ”‚   Save   โ”‚  Step 13: Persist to database
                                    โ”‚    to    โ”‚
                                    โ”‚ MongoDB  โ”‚
                                    โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜
                                         โ”‚
                                         โ–ผ
                                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                                    โ”‚ Response โ”‚  Step 14: Complete
                                    โ”‚ Complete โ”‚
                                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜


FRONTEND FLOW:
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Garuda UI   โ”‚  User views dashboard
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
       โ”‚
       โ”‚ GET /api/v1/project/report
       โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Garuda-API   โ”‚  Query MongoDB
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
       โ”‚
       โ”‚ Query metrics
       โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   MongoDB    โ”‚  Return data
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
       โ”‚
       โ”‚ JSON response
       โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Garuda UI   โ”‚  Render charts & analytics
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

3. BATCH PROCESSING FLOW DIAGRAM

                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                    โ”‚  RabbitMQ Queue: garuda.monitorapi  โ”‚
                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                   โ”‚
                                   โ”‚ Consume Messages
                                   โ–ผ
                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                    โ”‚     BATCH CONSUMER SERVICE           โ”‚
                    โ”‚                                      โ”‚
                    โ”‚  Configuration:                      โ”‚
                    โ”‚  - MAX_BATCH_SIZE: 500              โ”‚
                    โ”‚  - BATCH_INTERVAL: 60 seconds       โ”‚
                    โ”‚  - Storage: In-memory Map           โ”‚
                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                   โ”‚
                                   โ”‚ Add to batchStorage
                                   โ–ผ
     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
     โ”‚              IN-MEMORY BATCH STORAGE                          โ”‚
     โ”‚                                                                โ”‚
     โ”‚  Data Structure:                                              โ”‚
     โ”‚  {                                                            โ”‚
     โ”‚    "projectId_/api/path": {                                   โ”‚
     โ”‚      hits: 45,                                                โ”‚
     โ”‚      apiLogs: [                                               โ”‚
     โ”‚        { projectId, path, method, status, responseTime },     โ”‚
     โ”‚        { projectId, path, method, status, responseTime },     โ”‚
     โ”‚        ...                                                    โ”‚
     โ”‚      ]                                                        โ”‚
     โ”‚    },                                                         โ”‚
     โ”‚    "projectId_/api/another": {                                โ”‚
     โ”‚      hits: 127,                                               โ”‚
     โ”‚      apiLogs: [...]                                           โ”‚
     โ”‚    }                                                          โ”‚
     โ”‚  }                                                            โ”‚
     โ”‚                                                                โ”‚
     โ”‚  Current Batch Count: N / 500                                โ”‚
     โ”‚  Time Elapsed: T / 60s                                       โ”‚
     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                              โ”‚
                              โ”‚
              โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
              โ”‚  CHECK TRIGGER CONDITIONS       โ”‚
              โ”‚                                  โ”‚
              โ”‚  Condition 1: Count >= 500      โ”‚
              โ”‚       OR                         โ”‚
              โ”‚  Condition 2: Time >= 60 seconds โ”‚
              โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                          โ”‚            โ”‚
                    NO    โ”‚            โ”‚  YES
                          โ”‚            โ”‚
                          โ–ผ            โ–ผ
                  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                  โ”‚ WAIT FOR    โ”‚  โ”‚ PREPARE PAYLOAD    โ”‚
                  โ”‚ MORE        โ”‚  โ”‚                    โ”‚
                  โ”‚ MESSAGES    โ”‚  โ”‚ Create bulk update โ”‚
                  โ”‚             โ”‚  โ”‚ request body       โ”‚
                  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                          โ–ฒ                 โ”‚
                          โ”‚                 โ”‚ POST /api/v1/radar/bulkupdate
                          โ”‚                 โ–ผ
                          โ”‚          โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                          โ”‚          โ”‚  SEND TO          โ”‚
                          โ”‚          โ”‚  GARUDA-API       โ”‚
                          โ”‚          โ”‚                   โ”‚
                          โ”‚          โ”‚  Endpoint:        โ”‚
                          โ”‚          โ”‚  /radar/bulkupdateโ”‚
                          โ”‚          โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                          โ”‚                   โ”‚
                          โ”‚                   โ”‚
                          โ”‚        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                          โ”‚        โ”‚   HTTP RESPONSE     โ”‚
                          โ”‚        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                          โ”‚               โ”‚      โ”‚
                          โ”‚         200   โ”‚      โ”‚  5xx
                          โ”‚               โ”‚      โ”‚
                          โ”‚               โ–ผ      โ–ผ
                          โ”‚        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                          โ”‚        โ”‚ SUCCESS  โ”‚ โ”‚  RETRY  โ”‚
                          โ”‚        โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”˜
                          โ”‚             โ”‚            โ”‚
                          โ”‚             โ”‚            โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”
                          โ”‚             โ–ผ                   โ”‚
                          โ”‚      โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”        โ”‚
                          โ”‚      โ”‚ CLEAR STORAGE   โ”‚        โ”‚
                          โ”‚      โ”‚                 โ”‚        โ”‚
                          โ”‚      โ”‚ - Reset counter โ”‚        โ”‚
                          โ”‚      โ”‚ - Clear map     โ”‚        โ”‚
                          โ”‚      โ”‚ - Ready for new โ”‚        โ”‚
                          โ”‚      โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜        โ”‚
                          โ”‚               โ”‚                 โ”‚
                          โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

BATCH AGGREGATION EXAMPLE:
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€

Time 0s:    Message 1 arrives โ†’ batchStorage["proj1_/api/users"] = { hits: 1, logs: [...] }
Time 5s:    Message 2 arrives โ†’ batchStorage["proj1_/api/users"] = { hits: 2, logs: [...] }
Time 10s:   Message 3 arrives โ†’ batchStorage["proj1_/api/orders"] = { hits: 1, logs: [...] }
...
Time 58s:   Total 487 messages in storage
Time 60s:   โฐ TIMER TRIGGER! โ†’ Send bulk update with 487 aggregated hits
Time 60s:   Storage cleared, ready for next batch

OR

Messages 1-499:   Accumulating in memory
Message 500:      ๐ŸŽฏ SIZE TRIGGER! โ†’ Send bulk update immediately
                  Storage cleared, timer reset

BENEFITS:
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
โœ“ Reduces DB writes by 95%+
โœ“ Improves throughput
โœ“ Lower database load
โœ“ Efficient aggregation
โœ“ No data loss (RabbitMQ durability)

4. DATA FLOW DECISION TREE

                         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                         โ”‚   API Request       โ”‚
                         โ”‚   Initiated         โ”‚
                         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                    โ”‚
                                    โ–ผ
                         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                         โ”‚   api-radar         โ”‚
                         โ”‚   Middleware        โ”‚
                         โ”‚   Collect Metrics   โ”‚
                         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                    โ”‚
                                    โ–ผ
                         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                         โ”‚   NGINX Gateway     โ”‚
                         โ”‚   Route Traffic     โ”‚
                         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                    โ”‚
                                    โ–ผ
                         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                         โ”‚ Garuda-Caching      โ”‚
                         โ”‚ Service             โ”‚
                         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                    โ”‚
                                    โ”‚ Check Redis
                                    โ–ผ
                         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                         โ”‚ Redis Cache Lookup  โ”‚
                         โ”‚ Monitoring Status?  โ”‚
                         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                    โ”‚
                                    โ”‚
                         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                         โ”‚  Status Found?      โ”‚
                         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                              NOโ”‚      โ”‚YES
                                โ”‚      โ”‚
                                โ–ผ      โ–ผ
                         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                         โ”‚  Route   โ”‚ โ”‚  Check API Condition     โ”‚
                         โ”‚  Direct  โ”‚ โ”‚                          โ”‚
                         โ”‚  to API  โ”‚ โ”‚  Is it:                  โ”‚
                         โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚  1. 5xx Status?         โ”‚
                              โ”‚       โ”‚  2. New API?            โ”‚
                              โ”‚       โ”‚  3. Critical Priority?  โ”‚
                              โ”‚       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                              โ”‚              YESโ”‚        โ”‚NO
                              โ”‚                 โ”‚        โ”‚
                              โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค        โ”‚
                                                โ”‚        โ”‚
                                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”   โ”‚
                                    โ”‚  DIRECT ROUTE  โ”‚   โ”‚
                                    โ”‚  ============  โ”‚   โ”‚
                                    โ”‚  Bypass Queue  โ”‚   โ”‚
                                    โ”‚  Immediate     โ”‚   โ”‚
                                    โ”‚  Processing    โ”‚   โ”‚
                                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ”‚
                                            โ”‚            โ”‚
                                            โ”‚            โ”‚
                                            โ”‚            โ”‚
                                            โ”‚   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                                            โ”‚   โ”‚  QUEUE ROUTE    โ”‚
                                            โ”‚   โ”‚  ===========    โ”‚
                                            โ”‚   โ”‚  Publish to     โ”‚
                                            โ”‚   โ”‚  RabbitMQ       โ”‚
                                            โ”‚   โ”‚  Batch Later    โ”‚
                                            โ”‚   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                            โ”‚            โ”‚
                                            โ”‚            โ”‚ To Queue
                                            โ”‚            โ–ผ
                                            โ”‚   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                                            โ”‚   โ”‚   RabbitMQ      โ”‚
                                            โ”‚   โ”‚   Queue         โ”‚
                                            โ”‚   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                            โ”‚            โ”‚
                                            โ”‚            โ”‚ Batch Processing
                                            โ”‚            โ–ผ
                                            โ”‚   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                                            โ”‚   โ”‚ Batch Consumer  โ”‚
                                            โ”‚   โ”‚ Aggregate 60s   โ”‚
                                            โ”‚   โ”‚ or 500 msgs     โ”‚
                                            โ”‚   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                            โ”‚            โ”‚
                                            โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
                                                         โ”‚
                                        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                                        โ”‚      GARUDA-API SERVICE      โ”‚
                                        โ”‚                              โ”‚
                                        โ”‚  1. Validate API Key         โ”‚
                                        โ”‚  2. Validate Project ID      โ”‚
                                        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                                         โ”‚
                                        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                                        โ”‚   CREATE/UPDATE API MODEL    โ”‚
                                        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                                         โ”‚
                                        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                                        โ”‚   UPDATE RADAR METRICS       โ”‚
                                        โ”‚                              โ”‚
                                        โ”‚   - Hits per timeframe       โ”‚
                                        โ”‚   - Status codes             โ”‚
                                        โ”‚   - Response times           โ”‚
                                        โ”‚   - Average calculations     โ”‚
                                        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                                         โ”‚
                                        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                                        โ”‚   CHECK API HEALTH           โ”‚
                                        โ”‚   Is status 5xx?             โ”‚
                                        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                              YESโ”‚          โ”‚NO
                                                 โ”‚          โ”‚
                                                 โ–ผ          โ–ผ
                                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                                    โ”‚ INCIDENT FLOW   โ”‚  โ”‚  SAVE TO DB  โ”‚
                                    โ”‚                 โ”‚  โ”‚              โ”‚
                                    โ”‚ 1. Check recent โ”‚  โ”‚  Update:     โ”‚
                                    โ”‚    (15 min)     โ”‚  โ”‚  - API model โ”‚
                                    โ”‚ 2. Create/Updateโ”‚  โ”‚  - Radar     โ”‚
                                    โ”‚    Incident     โ”‚  โ”‚  Complete    โ”‚
                                    โ”‚ 3. Set API Down โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                    โ”‚ 4. Fetch On-callโ”‚
                                    โ”‚ 5. Send Alert   โ”‚
                                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                             โ”‚
                                             โ–ผ
                                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                                    โ”‚  EMAIL SERVICE  โ”‚
                                    โ”‚                 โ”‚
                                    โ”‚  Nodemailer +   โ”‚
                                    โ”‚  Brevo SMTP     โ”‚
                                    โ”‚                 โ”‚
                                    โ”‚  Alert sent to  โ”‚
                                    โ”‚  on-call person โ”‚
                                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                             โ”‚
                                             โ–ผ
                                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                                    โ”‚  SAVE INCIDENT  โ”‚
                                    โ”‚  TO MONGODB     โ”‚
                                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                             โ”‚
                                             โ–ผ
                                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                                    โ”‚   COMPLETE      โ”‚
                                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

5. COMPONENT INTERACTION DIAGRAM

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                           FRONTEND LAYER                                โ”‚
โ”‚                                                                          โ”‚
โ”‚   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”‚
โ”‚   โ”‚  Garuda-UI Dashboard (React + Redux + Tailwind)              โ”‚    โ”‚
โ”‚   โ”‚  - User Authentication Pages                                  โ”‚    โ”‚
โ”‚   โ”‚  - Project Management Interface                               โ”‚    โ”‚
โ”‚   โ”‚  - API Monitoring Dashboard                                   โ”‚    โ”‚
โ”‚   โ”‚  - Analytics & Reports (Recharts)                            โ”‚    โ”‚
โ”‚   โ”‚  - Incident Tracking                                          โ”‚    โ”‚
โ”‚   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                             โ”‚
                             โ”‚ REST API Calls (axios)
                             โ”‚ - GET /api/v1/project/report
                             โ”‚ - POST /api/v1/signin
                             โ”‚ - POST /api/v1/radar/singlereport
                             โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                         API GATEWAY LAYER                              โ”‚
โ”‚                                                                          โ”‚
โ”‚   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”‚
โ”‚   โ”‚  Authentication Middleware (JWT)                              โ”‚    โ”‚
โ”‚   โ”‚  - isLoggedIn                                                 โ”‚    โ”‚
โ”‚   โ”‚  - Token Verification                                         โ”‚    โ”‚
โ”‚   โ”‚  - Cookie Validation                                          โ”‚    โ”‚
โ”‚   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                             โ”‚
                             โ”‚ Route to Controllers
                             โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                      CONTROLLER LAYER                                  โ”‚
โ”‚                                                                          โ”‚
โ”‚   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
โ”‚   โ”‚ User Controller โ”‚  โ”‚ Project          โ”‚  โ”‚ Radar Controller    โ”‚ โ”‚
โ”‚   โ”‚ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚  โ”‚ Controller       โ”‚  โ”‚ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ โ”‚ โ”‚
โ”‚   โ”‚ - signup()      โ”‚  โ”‚ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚  โ”‚ - monitorApi()      โ”‚ โ”‚
โ”‚   โ”‚ - signin()      โ”‚  โ”‚ - createProject()โ”‚  โ”‚ - singleReport()    โ”‚ โ”‚
โ”‚   โ”‚ - signout()     โ”‚  โ”‚ - createApiKey() โ”‚  โ”‚ - bulkUpdate()      โ”‚ โ”‚
โ”‚   โ”‚ - getUser()     โ”‚  โ”‚ - addOnCall()    โ”‚  โ”‚ - configRadar()     โ”‚ โ”‚
โ”‚   โ”‚ - updateUser()  โ”‚  โ”‚ - getApis()      โ”‚  โ”‚                     โ”‚ โ”‚
โ”‚   โ”‚ - deleteUser()  โ”‚  โ”‚ - getReport()    โ”‚  โ”‚                     โ”‚ โ”‚
โ”‚   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
             โ”‚                     โ”‚                        โ”‚
             โ”‚                     โ”‚                        โ”‚
             โ”‚                     โ”‚                        โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                         SERVICE LAYER                                  โ”‚
โ”‚                                                                          โ”‚
โ”‚   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”โ”‚
โ”‚   โ”‚ Email Service    โ”‚  โ”‚ Redis Service    โ”‚  โ”‚ RabbitMQ Service    โ”‚โ”‚
โ”‚   โ”‚ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚  โ”‚ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚  โ”‚ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚โ”‚
โ”‚   โ”‚ - sendAlert()    โ”‚  โ”‚ - get()          โ”‚  โ”‚ - publishMessage()  โ”‚โ”‚
โ”‚   โ”‚ - templates      โ”‚  โ”‚ - set()          โ”‚  โ”‚ - consumeMessages() โ”‚โ”‚
โ”‚   โ”‚                  โ”‚  โ”‚ - delete()       โ”‚  โ”‚ - createChannel()   โ”‚โ”‚
โ”‚   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜โ”‚
โ”‚                                                                          โ”‚
โ”‚   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                          โ”‚
โ”‚   โ”‚ Kafka Service    โ”‚  โ”‚ Bulk Update Svc  โ”‚                          โ”‚
โ”‚   โ”‚ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚  โ”‚ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚                          โ”‚
โ”‚   โ”‚ - produce()      โ”‚  โ”‚ - batchConsumer()โ”‚                          โ”‚
โ”‚   โ”‚ - consume()      โ”‚  โ”‚ - aggregate()    โ”‚                          โ”‚
โ”‚   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                          โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                 โ”‚
                                 โ”‚ Database Operations
                                 โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                    DATA ACCESS LAYER (Models)                          โ”‚
โ”‚                                                                          โ”‚
โ”‚   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
โ”‚   โ”‚   User    โ”‚  โ”‚ Project  โ”‚  โ”‚  API   โ”‚  โ”‚ Radar  โ”‚  โ”‚ Incident โ”‚ โ”‚
โ”‚   โ”‚   Model   โ”‚  โ”‚  Model   โ”‚  โ”‚  Model โ”‚  โ”‚ Model  โ”‚  โ”‚  Model   โ”‚ โ”‚
โ”‚   โ”‚ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ โ”‚  โ”‚ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ โ”‚  โ”‚ โ”€โ”€โ”€โ”€โ”€โ”€ โ”‚  โ”‚ โ”€โ”€โ”€โ”€โ”€โ”€ โ”‚  โ”‚ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ โ”‚ โ”‚
โ”‚   โ”‚ Schema:   โ”‚  โ”‚ Schema:  โ”‚  โ”‚Schema: โ”‚  โ”‚Schema: โ”‚  โ”‚ Schema:  โ”‚ โ”‚
โ”‚   โ”‚           โ”‚  โ”‚          โ”‚  โ”‚        โ”‚  โ”‚        โ”‚  โ”‚          โ”‚ โ”‚
โ”‚   โ”‚ username  โ”‚  โ”‚ name     โ”‚  โ”‚endpointโ”‚  โ”‚ apiId  โ”‚  โ”‚ apiId    โ”‚ โ”‚
โ”‚   โ”‚ email     โ”‚  โ”‚ customer โ”‚  โ”‚ method โ”‚  โ”‚ hits   โ”‚  โ”‚ time     โ”‚ โ”‚
โ”‚   โ”‚ password  โ”‚  โ”‚ apiKey   โ”‚  โ”‚ projectโ”‚  โ”‚ status โ”‚  โ”‚ logs     โ”‚ โ”‚
โ”‚   โ”‚ phone     โ”‚  โ”‚ onCall   โ”‚  โ”‚ status โ”‚  โ”‚ avgRes โ”‚  โ”‚ count    โ”‚ โ”‚
โ”‚   โ”‚ projects[]โ”‚  โ”‚ totalApi โ”‚  โ”‚ radar  โ”‚  โ”‚ metricsโ”‚  โ”‚          โ”‚ โ”‚
โ”‚   โ””โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
          โ”‚             โ”‚            โ”‚           โ”‚             โ”‚
          โ”‚             โ”‚            โ”‚           โ”‚             โ”‚
          โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                     โ”‚
                                     โ”‚ CRUD Operations
                                     โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                         DATABASE LAYER                                   โ”‚
โ”‚                                                                           โ”‚
โ”‚   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”‚
โ”‚   โ”‚                      MongoDB                                   โ”‚    โ”‚
โ”‚   โ”‚                                                                 โ”‚    โ”‚
โ”‚   โ”‚  Collections:                                                  โ”‚    โ”‚
โ”‚   โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”        โ”‚    โ”‚
โ”‚   โ”‚  โ”‚  users   โ”‚ โ”‚ projects โ”‚ โ”‚   apis   โ”‚ โ”‚  radars  โ”‚        โ”‚    โ”‚
โ”‚   โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜        โ”‚    โ”‚
โ”‚   โ”‚                                                                 โ”‚    โ”‚
โ”‚   โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                                                 โ”‚    โ”‚
โ”‚   โ”‚  โ”‚incidents โ”‚                                                 โ”‚    โ”‚
โ”‚   โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                                                 โ”‚    โ”‚
โ”‚   โ”‚                                                                 โ”‚    โ”‚
โ”‚   โ”‚  Indexes: username, email, apiKey, apiEndPoint                โ”‚    โ”‚
โ”‚   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

DATA FLOW:
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€

Frontend Request โ†’ Auth Middleware โ†’ Controller โ†’ Service Layer โ†’ Model โ†’ Database
                                                      โ†“
                                            External Services
                                            (Email, Redis, RabbitMQ)

6. DEPLOYMENT ARCHITECTURE

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                        DOCKER CONTAINERS                                 โ”‚
โ”‚                                                                           โ”‚
โ”‚   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚
โ”‚   โ”‚  Container 1: Garuda-API                                         โ”‚  โ”‚
โ”‚   โ”‚  โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•  โ”‚  โ”‚
โ”‚   โ”‚                                                                   โ”‚  โ”‚
โ”‚   โ”‚  Image: node:18-slim                                             โ”‚  โ”‚
โ”‚   โ”‚  Port: 5094 (exposed)                                            โ”‚  โ”‚
โ”‚   โ”‚  Working Dir: /app                                               โ”‚  โ”‚
โ”‚   โ”‚                                                                   โ”‚  โ”‚
โ”‚   โ”‚  Environment Variables:                                          โ”‚  โ”‚
โ”‚   โ”‚  - DB_CONNECTION_STRING (MongoDB URI)                            โ”‚  โ”‚
โ”‚   โ”‚  - JWT_SECRET                                                    โ”‚  โ”‚
โ”‚   โ”‚  - REDIS_HOST, REDIS_PORT                                        โ”‚  โ”‚
โ”‚   โ”‚  - RABBITMQ_URL                                                  โ”‚  โ”‚
โ”‚   โ”‚  - EMAIL_AUTH_TOKEN                                              โ”‚  โ”‚
โ”‚   โ”‚                                                                   โ”‚  โ”‚
โ”‚   โ”‚  Command: node index.js                                          โ”‚  โ”‚
โ”‚   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
โ”‚                               โ”‚                                         โ”‚
โ”‚   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
โ”‚   โ”‚  Container 2: Garuda-Caching                                      โ”‚ โ”‚
โ”‚   โ”‚  โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•  โ”‚ โ”‚
โ”‚   โ”‚                                                                   โ”‚ โ”‚
โ”‚   โ”‚  Image: node:18-slim                                             โ”‚ โ”‚
โ”‚   โ”‚  Port: 5095 (exposed)                                            โ”‚ โ”‚
โ”‚   โ”‚  Working Dir: /app                                               โ”‚ โ”‚
โ”‚   โ”‚                                                                   โ”‚ โ”‚
โ”‚   โ”‚  Environment Variables:                                          โ”‚ โ”‚
โ”‚   โ”‚  - DB_CONNECTION_STRING                                          โ”‚ โ”‚
โ”‚   โ”‚  - REDIS_HOST, REDIS_PORT                                        โ”‚ โ”‚
โ”‚   โ”‚  - RABBITMQ_URL                                                  โ”‚ โ”‚
โ”‚   โ”‚  - GARUDA_API (http://garuda-api:5094)                           โ”‚ โ”‚
โ”‚   โ”‚                                                                   โ”‚ โ”‚
โ”‚   โ”‚  Command: node index.js                                          โ”‚ โ”‚
โ”‚   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
โ”‚                               โ”‚                                         โ”‚
โ”‚   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
โ”‚   โ”‚  Container 3: Garuda-UI                                           โ”‚ โ”‚
โ”‚   โ”‚  โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•  โ”‚ โ”‚
โ”‚   โ”‚                                                                   โ”‚ โ”‚
โ”‚   โ”‚  Image: node:18 (with nginx for serving)                         โ”‚ โ”‚
โ”‚   โ”‚  Port: 3000 (development) / 80 (production)                      โ”‚ โ”‚
โ”‚   โ”‚  Build Tool: Vite                                                โ”‚ โ”‚
โ”‚   โ”‚                                                                   โ”‚ โ”‚
โ”‚   โ”‚  Environment Variables:                                          โ”‚ โ”‚
โ”‚   โ”‚  - VITE_API_URL (http://garuda-api:5094)                         โ”‚ โ”‚
โ”‚   โ”‚                                                                   โ”‚ โ”‚
โ”‚   โ”‚  Command: npm run dev / npm run build + serve                    โ”‚ โ”‚
โ”‚   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                โ”‚
                                โ”‚ Network: Bridge / Host
                                โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                    EXTERNAL / MANAGED SERVICES                           โ”‚
โ”‚                                                                           โ”‚
โ”‚   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                   โ”‚
โ”‚   โ”‚  MongoDB Atlas       โ”‚  โ”‚  Redis Cloud         โ”‚                   โ”‚
โ”‚   โ”‚  โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•  โ”‚  โ”‚  โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•  โ”‚                   โ”‚
โ”‚   โ”‚                      โ”‚  โ”‚                      โ”‚                   โ”‚
โ”‚   โ”‚  Collections:        โ”‚  โ”‚  Data:               โ”‚                   โ”‚
โ”‚   โ”‚  - users             โ”‚  โ”‚  - API monitoring    โ”‚                   โ”‚
โ”‚   โ”‚  - projects          โ”‚  โ”‚    status            โ”‚                   โ”‚
โ”‚   โ”‚  - apis              โ”‚  โ”‚  - Cache configs     โ”‚                   โ”‚
โ”‚   โ”‚  - radars            โ”‚  โ”‚                      โ”‚                   โ”‚
โ”‚   โ”‚  - incidents         โ”‚  โ”‚  TTL: Configurable   โ”‚                   โ”‚
โ”‚   โ”‚                      โ”‚  โ”‚  Persistence: Yes    โ”‚                   โ”‚
โ”‚   โ”‚  Replica Set: Yes    โ”‚  โ”‚                      โ”‚                   โ”‚
โ”‚   โ”‚  Backup: Automated   โ”‚  โ”‚                      โ”‚                   โ”‚
โ”‚   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                   โ”‚
โ”‚                                                                           โ”‚
โ”‚   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                   โ”‚
โ”‚   โ”‚  RabbitMQ            โ”‚  โ”‚  Brevo SMTP          โ”‚                   โ”‚
โ”‚   โ”‚  โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•  โ”‚  โ”‚  โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•  โ”‚                   โ”‚
โ”‚   โ”‚                      โ”‚  โ”‚                      โ”‚                   โ”‚
โ”‚   โ”‚  Queue:              โ”‚  โ”‚  Service:            โ”‚                   โ”‚
โ”‚   โ”‚  - garuda.monitorapi โ”‚  โ”‚  - Email alerts      โ”‚                   โ”‚
โ”‚   โ”‚                      โ”‚  โ”‚  - From:             โ”‚                   โ”‚
โ”‚   โ”‚  Durable: Yes        โ”‚  โ”‚    alerts@garuda.com โ”‚                   โ”‚
โ”‚   โ”‚  Auto-ACK: No        โ”‚  โ”‚                      โ”‚                   โ”‚
โ”‚   โ”‚  Prefetch: 1         โ”‚  โ”‚  Templates:          โ”‚                   โ”‚
โ”‚   โ”‚                      โ”‚  โ”‚  - HTML alerts       โ”‚                   โ”‚
โ”‚   โ”‚  Management UI:      โ”‚  โ”‚  - Support emails    โ”‚                   โ”‚
โ”‚   โ”‚  Port 15672          โ”‚  โ”‚                      โ”‚                   โ”‚
โ”‚   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                     MONITORING & OBSERVABILITY                            โ”‚
โ”‚                                                                             โ”‚
โ”‚   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                     โ”‚
โ”‚   โ”‚  Application Logs    โ”‚  โ”‚  Performance Metrics โ”‚                     โ”‚
โ”‚   โ”‚  โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•  โ”‚  โ”‚  โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•  โ”‚                     โ”‚
โ”‚   โ”‚                      โ”‚  โ”‚                      โ”‚                     โ”‚
โ”‚   โ”‚  Package: logat      โ”‚  โ”‚  Source: Radar Data  โ”‚                     โ”‚
โ”‚   โ”‚                      โ”‚  โ”‚                      โ”‚                     โ”‚
โ”‚   โ”‚  Logs:               โ”‚  โ”‚  Metrics:            โ”‚                     โ”‚
โ”‚   โ”‚  - API hits          โ”‚  โ”‚  - Response times    โ”‚                     โ”‚
โ”‚   โ”‚  - Errors            โ”‚  โ”‚  - Status codes      โ”‚                     โ”‚
โ”‚   โ”‚  - System events     โ”‚  โ”‚  - Hit counts        โ”‚                     โ”‚
โ”‚   โ”‚  - Batch processing  โ”‚  โ”‚  - Incident rates    โ”‚                     โ”‚
โ”‚   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

CONTAINER NETWORKING:
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€

garuda-api:5094      โ†โ”€โ”€โ”€โ”€ HTTP calls from garuda-caching
       โ†•
MongoDB Atlas        โ†โ”€โ”€โ”€โ”€ Database operations
       โ†•
Redis Cloud          โ†โ”€โ”€โ”€โ”€ Cache operations
       โ†•
RabbitMQ             โ†โ”€โ”€โ”€โ”€ Message queue
       โ†•
Brevo SMTP           โ†โ”€โ”€โ”€โ”€ Email alerts


garuda-caching:5095  โ†โ”€โ”€โ”€โ”€ HTTP calls from NGINX / api-radar
       โ†•
Redis Cloud          โ†โ”€โ”€โ”€โ”€ Fast lookups
       โ†•
RabbitMQ             โ†โ”€โ”€โ”€โ”€ Publish messages


garuda-ui:3000       โ†โ”€โ”€โ”€โ”€ Browser requests
       โ†•
garuda-api:5094      โ†โ”€โ”€โ”€โ”€ REST API calls

7. ALERT & INCIDENT MANAGEMENT FLOW

                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                    โ”‚   API Hit Received       โ”‚
                    โ”‚   at Garuda-API          โ”‚
                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                 โ”‚
                                 โ–ผ
                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                    โ”‚  Extract Status Code     โ”‚
                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                 โ”‚
                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                    โ”‚  Check Status Code       โ”‚
                    โ”‚                          โ”‚
                    โ”‚  2xx? 3xx? 4xx? 5xx?     โ”‚
                    โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜
                         โ”‚               โ”‚
               2xx/3xx/4xxโ”‚               โ”‚5xx
            (Normal)      โ”‚               โ”‚(Error)
                         โ”‚               โ”‚
                         โ–ผ               โ–ผ
            โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
            โ”‚  Normal Flow    โ”‚  โ”‚  ALERT FLOW BEGINS   โ”‚
            โ”‚  โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€  โ”‚  โ”‚  โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ• โ”‚
            โ”‚                 โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
            โ”‚  1. Update      โ”‚             โ”‚
            โ”‚     Radar       โ”‚             โ”‚
            โ”‚     Metrics     โ”‚             โ”‚ Step 1: Query recent incidents
            โ”‚                 โ”‚             โ–ผ
            โ”‚  2. Save to DB  โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
            โ”‚                 โ”‚  โ”‚  Check for Recent    โ”‚
            โ”‚  3. Done        โ”‚  โ”‚  Incident            โ”‚
            โ”‚                 โ”‚  โ”‚                      โ”‚
            โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚  Query:              โ”‚
                                 โ”‚  - Same API          โ”‚
                                 โ”‚  - Within 15 minutes โ”‚
                                 โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                            โ”‚
                                โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                                โ”‚   Recent Incident?    โ”‚
                                โ””โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”˜
                                    โ”‚               โ”‚
                              NO    โ”‚               โ”‚  YES
                         (New Issue)โ”‚               โ”‚  (Ongoing Issue)
                                    โ”‚               โ”‚
                                    โ–ผ               โ–ผ
                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                    โ”‚  CREATE NEW INCIDENT  โ”‚  โ”‚  UPDATE EXISTING       โ”‚
                    โ”‚  โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•   โ”‚  โ”‚  INCIDENT              โ”‚
                    โ”‚                       โ”‚  โ”‚  โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•  โ”‚
                    โ”‚  incident = {         โ”‚  โ”‚                        โ”‚
                    โ”‚    project: ObjectId  โ”‚  โ”‚  Push to:              โ”‚
                    โ”‚    apiId: ObjectId    โ”‚  โ”‚  stepsAfterFailure[]   โ”‚
                    โ”‚    time: timestamp    โ”‚  โ”‚                        โ”‚
                    โ”‚    firstFailedLog: {  โ”‚  โ”‚  Increment:            โ”‚
                    โ”‚      status,          โ”‚  โ”‚  totalFailedApiCalls   โ”‚
                    โ”‚      responseTime,    โ”‚  โ”‚                        โ”‚
                    โ”‚      ...              โ”‚  โ”‚  Log details:          โ”‚
                    โ”‚    },                 โ”‚  โ”‚  - Status code         โ”‚
                    โ”‚    totalFailed: 1     โ”‚  โ”‚  - Response time       โ”‚
                    โ”‚  }                    โ”‚  โ”‚  - Timestamp           โ”‚
                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                โ”‚                           โ”‚
                                โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                            โ”‚
                                            โ–ผ
                                โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                                โ”‚  SET API STATUS        โ”‚
                                โ”‚  isCurrentlyDown=true  โ”‚
                                โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                             โ”‚
                                             โ–ผ
                                โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                                โ”‚  FETCH PROJECT DETAILS โ”‚
                                โ”‚                        โ”‚
                                โ”‚  Get:                  โ”‚
                                โ”‚  - On-call person name โ”‚
                                โ”‚  - On-call email       โ”‚
                                โ”‚  - On-call phone       โ”‚
                                โ”‚  - Project name        โ”‚
                                โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                             โ”‚
                                โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                                โ”‚  On-call person        โ”‚
                                โ”‚  configured?           โ”‚
                                โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”˜
                                   YESโ”‚              โ”‚NO
                                      โ”‚              โ”‚
                                      โ–ผ              โ–ผ
                        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                        โ”‚  PREPARE EMAIL       โ”‚  โ”‚  LOG WARNING    โ”‚
                        โ”‚  โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•    โ”‚  โ”‚  No on-call     โ”‚
                        โ”‚                      โ”‚  โ”‚  configured     โ”‚
                        โ”‚  Parse template:     โ”‚  โ”‚                 โ”‚
                        โ”‚  alert.email.templateโ”‚  โ”‚  Skip alert     โ”‚
                        โ”‚                      โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                        โ”‚  Variables:          โ”‚
                        โ”‚  - API endpoint      โ”‚
                        โ”‚  - Status code       โ”‚
                        โ”‚  - Response time     โ”‚
                        โ”‚  - Incident time     โ”‚
                        โ”‚  - Project name      โ”‚
                        โ”‚  - Failed count      โ”‚
                        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                   โ”‚
                                   โ–ผ
                        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                        โ”‚  SEND EMAIL via      โ”‚
                        โ”‚  Nodemailer          โ”‚
                        โ”‚                      โ”‚
                        โ”‚  SMTP: Brevo         โ”‚
                        โ”‚  From: alerts@...    โ”‚
                        โ”‚  To: on-call email   โ”‚
                        โ”‚  Subject: API Alert  โ”‚
                        โ”‚  Body: HTML template โ”‚
                        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                   โ”‚
                        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                        โ”‚  Email Send Result   โ”‚
                        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”˜
                             SUCCESSโ”‚      โ”‚FAILURE
                                    โ”‚      โ”‚
                                    โ–ผ      โ–ผ
                        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                        โ”‚  LOG        โ”‚  โ”‚  LOG ERROR   โ”‚
                        โ”‚  SUCCESS    โ”‚  โ”‚  Retry logic โ”‚
                        โ”‚             โ”‚  โ”‚  (optional)  โ”‚
                        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                               โ”‚                โ”‚
                               โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                        โ”‚
                                        โ–ผ
                            โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                            โ”‚  SAVE INCIDENT TO DB   โ”‚
                            โ”‚                        โ”‚
                            โ”‚  MongoDB.incidents     โ”‚
                            โ”‚  .save()               โ”‚
                            โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                         โ”‚
                                         โ–ผ
                            โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                            โ”‚  UPDATE API MODEL      โ”‚
                            โ”‚  isCurrentlyDown=true  โ”‚
                            โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                         โ”‚
                                         โ–ผ
                            โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                            โ”‚  CONTINUE MONITORING   โ”‚
                            โ”‚                        โ”‚
                            โ”‚  Wait for next API hit โ”‚
                            โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

EMAIL ALERT TEMPLATE:
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Subject: ๐Ÿšจ API Alert - [API_ENDPOINT] is Down          โ”‚
โ”‚                                                           โ”‚
โ”‚  Dear [ON_CALL_NAME],                                    โ”‚
โ”‚                                                           โ”‚
โ”‚  An API in your project has experienced an error:        โ”‚
โ”‚                                                           โ”‚
โ”‚  Project: [PROJECT_NAME]                                 โ”‚
โ”‚  API Endpoint: [API_METHOD] [API_PATH]                   โ”‚
โ”‚  Status Code: [STATUS_CODE]                              โ”‚
โ”‚  Response Time: [RESPONSE_TIME]ms                        โ”‚
โ”‚  Incident Time: [TIMESTAMP]                              โ”‚
โ”‚  Failed Calls: [COUNT]                                   โ”‚
โ”‚                                                           โ”‚
โ”‚  Please investigate immediately.                          โ”‚
โ”‚                                                           โ”‚
โ”‚  Best regards,                                            โ”‚
โ”‚  Garuda Monitoring System                                โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

INCIDENT TRACKING:
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€

Incident Document:
{
  _id: ObjectId,
  project: ObjectId("..."),
  apiId: ObjectId("..."),
  timeOfIncident: "2024-01-15T10:30:00Z",
  firstFailedApiLog: {
    method: "GET",
    path: "/api/users",
    statusCode: 503,
    responseTime: 5000
  },
  stepsAfterFailure: [
    { status: 503, time: "10:31:00Z" },
    { status: 502, time: "10:32:00Z" },
    ...
  ],
  totalFailedApiCalls: 15,
  createdAt: Date
}

15-MINUTE WINDOW LOGIC:
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
Current Time: 10:35:00
Query: incidents.find({
  apiId: [API_ID],
  createdAt: { $gte: 10:20:00 }  // 15 min ago
})

If found โ†’ Update existing
If not found โ†’ Create new incident

8. PERFORMANCE METRICS CALCULATION

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                 RADAR PERFORMANCE METRICS                            โ”‚
โ”‚                                                                       โ”‚
โ”‚  Calculated and stored for each API endpoint:                       โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

1. HITS PER TIMEFRAME
   โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

   Data Structure:
   hitsPerTimeFrame: [
     { timeframe: "2024-01-15T10:00:00Z", hits: 145 },
     { timeframe: "2024-01-15T11:00:00Z", hits: 203 },
     { timeframe: "2024-01-15T12:00:00Z", hits: 187 },
     ...
   ]

   Calculation:
   - Group API hits by hour/day/week
   - Increment counter for each timeframe
   - Used for trend analysis


2. STATUS CODES PER TIMEFRAME
   โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

   Data Structure:
   statusCodesPerTimeFrame: [
     {
       timeframe: "2024-01-15T10:00:00Z",
       statusCodes: [
         { statusCode: 200, count: 140 },
         { statusCode: 404, count: 3 },
         { statusCode: 500, count: 2 }
       ]
     },
     ...
   ]

   Calculation:
   - Track frequency of each status code
   - Group by timeframe
   - Used for error rate analysis


3. AVERAGE RESPONSE TIME
   โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

   Formula:
   avgResponseTime = (ฮฃ all response times) / (total hits)

   Example:
   Request 1: 120ms
   Request 2: 150ms
   Request 3: 130ms
   Average = (120 + 150 + 130) / 3 = 133.33ms

   Stored as: "133.33"


4. MOST CAPTURED STATUS CODE
   โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

   Algorithm:
   statusCodeMap = {}
   for each log:
     statusCodeMap[log.status] = (statusCodeMap[log.status] || 0) + 1

   mostCaptured = max(statusCodeMap by value)

   Example:
   200: 500 times
   404: 10 times
   500: 5 times
   โ†’ Most captured: "200"


5. MOST RECENT STATUS CODE & RESPONSE TIME
   โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

   Simply store the latest values from the most recent API hit:

   apiMostRecentStatusCode: "200"
   apiMostRecentResponseTime: "145"


6. TOTAL HITS TILL NOW
   โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

   Simple counter incremented on each API hit:

   totalHitsTillNow: 1523


7. BULK UPDATE AVERAGE CALCULATION
   โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

   When batch updates arrive with aggregated data:

   existing = currentRadar.apiAverageResponseTime
   existingHits = currentRadar.totalHitsTillNow
   newHits = bulkData.hits
   newAvg = bulkData.averageResponseTime

   updatedAvg = (
     (existing * existingHits) + (newAvg * newHits)
   ) / (existingHits + newHits)

   Example:
   Existing: 100ms avg over 1000 hits
   New batch: 150ms avg over 500 hits

   Updated = (100 * 1000 + 150 * 500) / (1000 + 500)
           = (100000 + 75000) / 1500
           = 116.67ms


โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                    METRICS VISUALIZATION                             โ”‚
โ”‚                                                                       โ”‚
โ”‚  Used in Garuda-UI Dashboard with Recharts:                         โ”‚
โ”‚                                                                       โ”‚
โ”‚  - Line charts: Hits over time                                       โ”‚
โ”‚  - Bar charts: Status code distribution                              โ”‚
โ”‚  - Pie charts: Status code breakdown                                 โ”‚
โ”‚  - Number displays: Average response time, total hits                โ”‚
โ”‚  - Health indicators: Current API status (up/down)                   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

System Configuration Summary

Technology Stack

Backend:
- Runtime: Node.js 18
- Framework: Express.js 4.19
- Database: MongoDB (Mongoose 8.4)
- Cache: Redis (ioredis 5.4)
- Queue: RabbitMQ (amqplib 0.10)
- Stream: Kafka (kafkajs 2.2)
- Auth: JWT + bcryptjs
- Email: Nodemailer + Brevo SMTP

Frontend:
- Framework: React 18
- Build: Vite 5.4
- Styling: Tailwind CSS 3.4
- State: Redux 5.0
- Charts: Recharts 2.13
- UI: Radix UI components

Infrastructure:
- Containers: Docker (node:18-slim)
- Gateway: NGINX
- Monitoring: logat package

Key Performance Numbers

Batch Processing:
- Max batch size: 500 messages
- Flush interval: 60 seconds
- DB write reduction: ~95%

Caching:
- Redis lookup: <1ms
- Cache hit rate: High for monitoring status

Alert System:
- Incident check window: 15 minutes
- Email delivery: <5 seconds (Brevo SMTP)
- Alert trigger: Immediate on 5xx errors

Ports

garuda-api: 5094
garuda-caching: 5095
garuda-ui: 3000 (dev) / 80 (prod)
redis: 6379
rabbitmq: 5672 (AMQP), 15672 (Management UI)
mongodb: 27017

Environment Requirements

- Node.js 18+
- MongoDB 4.4+
- Redis 6.0+
- RabbitMQ 3.8+
- Docker (optional)
- SMTP access (Brevo or similar)

๐Ÿ‘ฉโ€๐Ÿ’ป Contributing

We welcome contributions to Garuda API Radar! Please follow these steps to contribute:

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature-branch).
  3. Make your changes and commit them (git commit -m 'Add new feature').
  4. Push to the branch (git push origin feature-branch).
  5. Create a pull request.

๐Ÿ‘ฎโ€โ™‚๏ธ Code of Conduct

Please adhere to the Contributor Covenant Code of Conduct when contributing to this project.

ยฉ License

This project is licensed under the MIT License. See the LICENSE file for details.

About

Garuda API - The core backend service for API Garuda, a real-time API health monitoring and alerting system. It efficiently tracks uptime, response times, and status codes, leveraging Redis and RabbitMQ for optimized performance. ๐Ÿš€

Topics

Resources

Stars

Watchers

Forks

Contributors 2

  •  
  •