# praveensaharan/vendor-management architecture

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

- Interactive diagram: https://gitdiagram.com/praveensaharan/vendor-management
- Repository: https://github.com/praveensaharan/vendor-management

## Overview

##### Main Components
- Frontend Client: Represented by the React application. Key elements include components for login (Firebase Google login), vendor display, and operations like create, update, and delete vendor information.
- Backend Server: A Node.js application that acts as an intermediary between the frontend and the database.
- Database: Firebase Realtime Database, which stores vendor profiles and related data.
- External Services:
- Firebase Authentication: Used for secure login via Google.
- Hosting services: The frontend is hosted on Netlify, and the backend is hosted on Microsoft Azure.

##### Relationships and Interactions
- The user’s browser loads the React application (frontend) which is served by Netlify.
- Upon login, the frontend interacts with Firebase Auth for Google authentication.
- When vendor data is created, edited, or deleted, the React app sends requests to the backend Node.js server.
- The Node.js server receives these requests and interacts with Firebase Realtime Database for persistence.
- Data flows back from the database to the backend and then to the frontend to update the UI.

##### Important Architectural Patterns and Technologies
- Separation of Concerns / Layered Architecture:
- Frontend: UI, user authentication, and vendor management operations.
- Backend: API layer that manages business logic and database interactions.
- Database: Managed persistence layer.
- RESTful communication (or similar API requests) between the frontend and backend services.
- Use of Firebase for authentication which integrates with both the frontend (via Firebase SDK) and the backend (to confirm tokens or perform secure operations).
- Cloud Hosting: Distinction in deployment with frontend on Netlify and backend on Azure.

##### Detailed Advice
- Keep the labels clear and consider including port numbers, if applicable (e.g., port 5173 for the frontend and port 5000 for the backend).
- Integration of Firebase authentication both at the UI layer (for logging in via Google) and at service level where needed for secure operations.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client & Hosting Layer
    U["User (Browser)"]:::client
    N["Netlify (Hosting)"]:::hosting

    %% Frontend Layer
    subgraph "Frontend Layer"
        FE["Frontend (React+Tailwind CSS)"]:::frontend
        UIC["UI Components (Login,Vendor Display,CRUD)"]:::frontend
        FAI["Firebase Auth Integration"]:::frontend
        FPR["Frontend Pages & Routing"]:::frontend
    end

    %% External Service for Authentication
    FA["Firebase Authentication"]:::external

    %% Backend & Database Layer
    subgraph "Backend & Database"
        BE["Backend Server (Node.js)"]:::backend
        D["Firebase Realtime Database"]:::database
        A["Microsoft Azure (Hosting)"]:::hosting
    end

    %% Connections between Layers
    U -->|"loads"| FE
    N -->|"hosts"| FE

    FE -->|"contains"| UIC
    FE -->|"contains"| FAI
    FE -->|"contains"| FPR

    FE -->|"Google_login"| FA
    FAI -->|"integrates"| FA

    FE -->|"VendorAPIRequest"| BE
    BE -->|"DB_Write/Read"| D
    D -->|"DB_Response"| BE
    BE -->|"APIResponse"| FE

    A -->|"hosts"| BE

    %% Click Events
    click FE "https://github.com/praveensaharan/vendor-management/tree/main/frontend/"
    click UIC "https://github.com/praveensaharan/vendor-management/tree/main/frontend/src/components/"
    click FAI "https://github.com/praveensaharan/vendor-management/blob/main/frontend/src/firebase.js"
    click FPR "https://github.com/praveensaharan/vendor-management/tree/main/frontend/src/Pages/"
    click BE "https://github.com/praveensaharan/vendor-management/blob/main/backend/index.js"

    %% Styles
    classDef client fill:#fce4d6,stroke:#e67e22,stroke-width:2px;
    classDef frontend fill:#d0e6f8,stroke:#3498db,stroke-width:2px;
    classDef backend fill:#d4edda,stroke:#28a745,stroke-width:2px;
    classDef database fill:#f8d7da,stroke:#dc3545,stroke-width:2px;
    classDef hosting fill:#e2e3e5,stroke:#6c757d,stroke-width:2px;
    classDef external fill:#fff3cd,stroke:#ffc107,stroke-width:2px;
```
