# lakshay1509/hackhazard-25 architecture

> Architecture diagram of the GitHub repository lakshay1509/hackhazard-25, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lakshay1509/hackhazard-25
- Repository: https://github.com/lakshay1509/hackhazard-25

## Overview

##### Project Type & Purpose
- This is a full-stack, microservice-oriented application for real-time vocal health analysis.
- Core user touchpoints:
- Web client (React + Redux)
- Telegram bot (Python)
- Core processing:
- Node/Express API server
- AI microservice (Python model inference in Docker)
- Data store: MongoDB
- External services: Groq API, Cloudinary, Google APIs, hosting/CDN

##### Top-Level Component Breakdown
- Frontend “client” directory ➔ React (Vite), TailwindCSS, Redux
- Backend “server” directory ➔ Node.js + Express, controllers, routes, models, MongoDB driver
- AI microservice “ai” directory ➔ Python inference code, TensorFlow saved model, report generator, runs in its own Docker container
- Telegram service “telegram” directory ➔ Python bot, report generator, interacts with users via Telegram Bot API

##### Key External Dependencies & Hosting
- MongoDB Atlas or self-hosted MongoDB
- Cloudinary for file storage (audio file uploads, PDF reports)
- Groq API for low-latency voice/NLP inference
- Google VGGish embeddings
- Netlify (frontend hosting), Azure or Docker Swarm (server & AI containers)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Layers and Components
    User["User Browser/Mobile"]:::external

    subgraph "Client Layer"
        React["React/Vite Frontend"]:::frontend
    end

    subgraph "API Layer"
        API["Express API Server"]:::api
    end

    subgraph "Processing Layer"
        AI["AI Microservice (Docker)"]:::micro
        TEL["Telegram Bot Service (Docker)"]:::micro
    end

    subgraph "Data & Storage Layer"
        Mongo(("MongoDB")):::data
        Cloudinary["Cloudinary Storage"]:::external
    end

    subgraph "External AI Services"
        Groq["Groq API"]:::external
        Google["Google VGGish"]:::external
    end

    %% Data Flows
    User <-->|"HTTP/WebSocket"| React
    React -->|"REST calls /api/*"| API
    API -->|"CRUD (users, doctors, exercises, reports)"| Mongo
    API -->|"uploadAudio(), uploadReport()"| Cloudinary
    API -->|"POST /api/ai/report"| AI
    AI -->|"inference()"| Groq
    AI -->|"embeddings()"| Google
    AI -->|"reportJSON"| API
    User <-->|"Telegram Bot API"| TEL
    TEL -->|"webhook /api/report"| API

    %% Click Events
    click React "https://github.com/lakshay1509/hackhazard-25/tree/main/client/"
    click React "https://github.com/lakshay1509/hackhazard-25/blob/main/client/src/main.jsx"
    click API "https://github.com/lakshay1509/hackhazard-25/tree/main/server/"
    click API "https://github.com/lakshay1509/hackhazard-25/blob/main/server/src/index.js"
    click AI "https://github.com/lakshay1509/hackhazard-25/tree/main/ai/"
    click AI "https://github.com/lakshay1509/hackhazard-25/blob/main/ai/main.py"
    click TEL "https://github.com/lakshay1509/hackhazard-25/tree/main/telegram/"
    click TEL "https://github.com/lakshay1509/hackhazard-25/blob/main/telegram/main.py"

    %% Styles
    classDef frontend fill:#e0f7e9,stroke:#2d8f67,color:#000;
    classDef api fill:#e0f0ff,stroke:#3366cc,color:#000;
    classDef micro fill:#fff4e6,stroke:#ff9933,color:#000;
    classDef data fill:#f2f2f2,stroke:#999,color:#000;
    classDef external fill:#ffffff,stroke-dasharray: 5 5,stroke:#666,color:#000;
```
