# durgesh2001/emaildashboard architecture

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

- Interactive diagram: https://gitdiagram.com/durgesh2001/emaildashboard
- Repository: https://github.com/durgesh2001/emaildashboard

## Overview

##### Project type and purpose
- This is a full-stack “Support-AI-Email-Dashboard” application.
- Frontend: a Vite-powered React SPA that displays and interacts with support emails.
- Backend: a Spring Boot service that fetches, stores, and serves emails via REST.
- Purpose: allow support agents (or an AI assistant) to view, process, and manage email conversations.

##### File structure
- Top-level split into two directories:
- support-dashboard-frontend (React/Vite)
- support-dashboard (Spring Boot/Maven)
- Frontend files:
- src/App.jsx, src/api.js, src/main.jsx → defines UI components and API calls.
- .env → likely holds the backend URL.
- Backend files:
- com.emailassistant.controller.EmailController → exposes REST endpoints.
- com.emailassistant.service.* → business logic: EmailService, MailFetchService.
- com.emailassistant.repository.EmailRepository → JPA interface to DB.
- com.emailassistant.model.Email → JPA entity.
- application.properties → datasource and mail server configurations.
- Tests folder and Maven wrapper indicate a standard spring-boot/maven build pipeline.

##### Detailed breakdown of components (to capture essential architecture)
- Presentation Tier
- React App (App.jsx, main.jsx)
- API helper module (api.js)
- Application Tier
- Controller: EmailController
- Services: EmailService, MailFetchService
- Repository: EmailRepository
- Data Tier
- Email Entity model
- Database (configured via application.properties)
- External Email Server (via JavaMail or Spring Mail)

Putting it all together:
- Protocols (HTTP(S), JDBC, IMAP).

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Presentation Tier
    subgraph "Presentation Tier"
        Browser["User's Browser"]:::frontend
        ReactApp["React SPA"]:::frontend
        APIHelper["API Helper Module"]:::frontend
        ViteConfig["Vite Configuration"]:::frontend
        EnvConfig["Environment Configuration"]:::frontend
    end

    %% Application Tier
    subgraph "Application Tier"
        AppEntry["Spring Boot Application Entry Point"]:::backend
        Controller["EmailController"]:::backend
        EmailService["EmailService"]:::backend
        MailFetchService["MailFetchService"]:::backend
        Repository["EmailRepository"]:::backend
        DomainModel["Email Entity (Domain Model)"]:::backend
        AppConfig["Application Configuration"]:::backend
        Pom["Backend Build Configuration"]:::backend
    end

    %% Data Tier
    subgraph "Data & External Tier"
        DB["Relational Database"]:::database
        EmailServer["External Email Server"]:::external
    end

    %% Data Flows
    Browser -->|"loads SPA"| ViteConfig
    ViteConfig -->|"serves assets"| ReactApp
    ReactApp -->|"uses API helper"| APIHelper
    APIHelper -->|"HTTP GET/POST /emails"| Controller
    Controller -->|"invokes"| EmailService
    EmailService -->|"calls"| Repository
    Repository -->|"JDBC"| DB
    MailFetchService -->|"IMAP fetch"| EmailServer
    MailFetchService -->|"persists emails"| Repository
    Controller -->|"returns JSON"| ReactApp

    %% Entity Relationships
    DomainModel -->|"mapped by JPA"| Repository
    EmailService -->|"uses domain model"| DomainModel

    %% Click Events
    click ReactApp "https://github.com/durgesh2001/emaildashboard/blob/main/support-dashboard-frontend/src/App.jsx"
    click ReactApp "https://github.com/durgesh2001/emaildashboard/blob/main/support-dashboard-frontend/src/main.jsx"
    click APIHelper "https://github.com/durgesh2001/emaildashboard/blob/main/support-dashboard-frontend/src/api.js"
    click ViteConfig "https://github.com/durgesh2001/emaildashboard/blob/main/support-dashboard-frontend/vite.config.js"
    click EnvConfig "https://github.com/durgesh2001/emaildashboard/blob/main/support-dashboard-frontend/.env"
    click AppEntry "https://github.com/durgesh2001/emaildashboard/blob/main/support-dashboard/src/main/java/com/emailassistant/SupportDashboardApplication.java"
    click Controller "https://github.com/durgesh2001/emaildashboard/blob/main/support-dashboard/src/main/java/com/emailassistant/controller/EmailController.java"
    click EmailService "https://github.com/durgesh2001/emaildashboard/blob/main/support-dashboard/src/main/java/com/emailassistant/service/EmailService.java"
    click MailFetchService "https://github.com/durgesh2001/emaildashboard/blob/main/support-dashboard/src/main/java/com/emailassistant/service/MailFetchService.java"
    click Repository "https://github.com/durgesh2001/emaildashboard/blob/main/support-dashboard/src/main/java/com/emailassistant/repository/EmailRepository.java"
    click DomainModel "https://github.com/durgesh2001/emaildashboard/blob/main/support-dashboard/src/main/java/com/emailassistant/model/Email.java"
    click AppConfig "https://github.com/durgesh2001/emaildashboard/blob/main/support-dashboard/src/main/resources/application.properties"
    click Pom "https://github.com/durgesh2001/emaildashboard/blob/main/support-dashboard/pom.xml"

    %% Styles
    classDef frontend fill:#E0F7FA,stroke:#006064;
    classDef backend fill:#E8F5E9,stroke:#1B5E20;
    classDef database fill:#FFE0B2,stroke:#E65100,stroke-width:2px;
    classDef external fill:#CFD8DC,stroke:#37474F;
```
