# moazamdev/hemocell architecture

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

- Interactive diagram: https://gitdiagram.com/moazamdev/hemocell
- Repository: https://github.com/moazamdev/hemocell

## Overview

##### Project type and purpose
- From the file tree and README, HemoCell is a full-stack web application for managing blood donations, requests, and drives.
- The front end is a ReactJS single-page app (built with Vite and styled by Tailwind CSS). The back end (not shown in this tree but described in README) is a Node.js/Express REST API that persists data in a MySQL database.

##### File structure
- Top-level files:
- index.html, src/, public/ → React SPA assets and entry points
- vite.config.js, tailwind.config.js, postcss.config.js → build & styling configs
- package.json / package-lock.json → npm dependencies and scripts
- vercel.json → deployment target (Vercel)
- Under src/:
- main.jsx / App.jsx / App.css → application bootstrap
- assets/, components/ (layouts, pages, sections, sidebar, utility-functions), views/ → React component hierarchy
- No server folder is present here; assume a parallel /server directory housing Node.js/Express routes, controllers, models.

##### README
- Tech stack: ReactJS, Node.js, MySQL, Tailwind CSS
- Features: blood donation, requests, drive hosting, monetary donations
- Admin dashboard exposed at `/dashboard` for user/analytics management

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend Layer"
        direction TB
        CDN["CDN / Static Hosting"]:::infra
        ReactApp["React SPA"]:::frontend
        Vite["Vite Build & Dev Server"]:::infra
        Tailwind["Tailwind CSS Styling"]:::infra

        subgraph "SPA Assets"
            direction TB
            HTML["index.html"]:::frontend
            Main["src/main.jsx"]:::frontend
            AppComp["src/App.jsx"]:::frontend
            CSS["src/index.css"]:::frontend
            Public["public/"]:::frontend
        end

        subgraph "Core Pages"
            direction TB
            Home["home-page.jsx"]:::frontend
            DonatePage["donate-blood-page.jsx"]:::frontend
            NeedPage["need-blood-page.jsx"]:::frontend
            HostDrive["host-blood-drive.jsx"]:::frontend
            Contact["contact-page.jsx"]:::frontend
        end

        subgraph "Admin Dashboard"
            direction TB
            AdminLayout["layouts/admin.jsx"]:::frontend
            AdminDash["views/admin/dashboard.jsx"]:::frontend
            AdminDonate["views/admin/admin-donate-blood.jsx"]:::frontend
            AdminNeed["views/admin/admin-need-blood.jsx"]:::frontend
            AdminHost["views/admin/admin-host-blood-drive.jsx"]:::frontend
            AdminHelp["views/admin/admin-need-help.jsx"]:::frontend
        end

        subgraph "UI Sections"
            direction TB
            Sections["src/components/sections/"]:::frontend
        end

        subgraph "Sidebar & Utils"
            direction TB
            Sidebar["sidebar/sidebar.jsx"]:::frontend
            InitFetch["initial-data-fetching.jsx"]:::frontend
            NewUser["new-users-insert-request.jsx"]:::frontend
            InputBlock["input-rendering-block.jsx"]:::frontend
        end
    end

    %% Backend Layer
    subgraph "Backend Layer"
        direction TB
        APIGW["API Gateway / Load Balancer"]:::infra
        ExpressAPI["Express API Server"]:::backend
        MySQLDB["MySQL Database"]:::database
        ExtServices["External Services"]:::external
    end

    %% CI/CD
    CICD["CI/CD (GitHub → Vercel)"]:::infra

    %% Relationships
    User["User's Browser"]:::external -->|requests| CDN
    CDN -->|serves SPA| ReactApp
    ReactApp -->|REST API calls| APIGW
    APIGW -->|forwards| ExpressAPI
    ExpressAPI -->|CRUD ops| MySQLDB
    ExpressAPI -->|integrates| ExtServices
    ReactApp -->|admin requests| APIGW
    CICD -->|deploys| CDN
    CICD -->|deploys| ExpressAPI

    %% Click Events - Frontend
    click HTML "https://github.com/moazamdev/hemocell/blob/main/index.html"
    click Main "https://github.com/moazamdev/hemocell/blob/main/src/main.jsx"
    click AppComp "https://github.com/moazamdev/hemocell/blob/main/src/App.jsx"
    click CSS "https://github.com/moazamdev/hemocell/blob/main/src/index.css"
    click Public "https://github.com/moazamdev/hemocell/tree/main/public/"
    click Vite "https://github.com/moazamdev/hemocell/blob/main/vite.config.js"
    click Tailwind "https://github.com/moazamdev/hemocell/blob/main/tailwind.config.js"
    click Tailwind "https://github.com/moazamdev/hemocell/blob/main/postcss.config.js"
    click Home "https://github.com/moazamdev/hemocell/blob/main/src/components/pages/home/home-page.jsx"
    click DonatePage "https://github.com/moazamdev/hemocell/blob/main/src/components/pages/donate-blood/donate-blood-page.jsx"
    click NeedPage "https://github.com/moazamdev/hemocell/blob/main/src/components/pages/need-blood/need-blood-page.jsx"
    click HostDrive "https://github.com/moazamdev/hemocell/blob/main/src/components/pages/host-blood-drive/host-blood-drive.jsx"
    click Contact "https://github.com/moazamdev/hemocell/blob/main/src/components/pages/contact/contact-page.jsx"
    click AdminLayout "https://github.com/moazamdev/hemocell/blob/main/src/components/layouts/admin.jsx"
    click AdminDash "https://github.com/moazamdev/hemocell/blob/main/src/components/views/admin/dashboard.jsx"
    click AdminDonate "https://github.com/moazamdev/hemocell/blob/main/src/components/views/admin/admin-donate-blood.jsx"
    click AdminNeed "https://github.com/moazamdev/hemocell/blob/main/src/components/views/admin/admin-need-blood.jsx"
    click AdminHost "https://github.com/moazamdev/hemocell/blob/main/src/components/views/admin/admin-host-blood-drive.jsx"
    click AdminHelp "https://github.com/moazamdev/hemocell/blob/main/src/components/views/admin/admin-need-help.jsx"
    click Sections "https://github.com/moazamdev/hemocell/tree/main/src/components/sections/"
    click Sidebar "https://github.com/moazamdev/hemocell/blob/main/src/components/sidebar/sidebar.jsx"
    click InitFetch "https://github.com/moazamdev/hemocell/blob/main/src/components/utility-functions/initial-data-fetching.jsx"
    click NewUser "https://github.com/moazamdev/hemocell/blob/main/src/components/utility-functions/new-users-insert-request.jsx"
    click InputBlock "https://github.com/moazamdev/hemocell/blob/main/src/components/utility-functions/input-rendering-block.jsx"
    click CICD "https://github.com/moazamdev/hemocell/blob/main/vercel.json"
    click CICD "https://github.com/moazamdev/hemocell/blob/main/package.json"
    click CICD "https://github.com/moazamdev/hemocell/blob/main/package-lock.json"

    %% Styles
    classDef frontend fill:#AEDFFD,stroke:#0366d6,color:#000
    classDef backend fill:#C6F6D5,stroke:#276749,color:#000
    classDef external fill:#FEEBC8,stroke:#b76e00,color:#000
    classDef database fill:#FDE2F3,stroke:#97266d,color:#000
    classDef infra fill:#E2E8F0,stroke:#4a5568,color:#000
```
