# chiraggulati098/aura-email-frontend architecture

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

- Interactive diagram: https://gitdiagram.com/chiraggulati098/aura-email-frontend
- Repository: https://github.com/chiraggulati098/aura-email-frontend

## Overview

##### Project type and purpose
- This is a single‑page, full‑stack email client front‑end built in React + TypeScript.
- It provides inbox, sent mail, spam filtering, AI‑powered summarization and reply, and composes/deletes/marks emails via a REST API at `http://127.0.0.1:5000`.

##### File structure
- Top‑level & tooling:
- `package.json`, `vite.config.ts`, `tsconfig*.json`, `tailwind.config.ts` – front‑end build & lint config
- `public/` – static assets (robots.txt, index.html)
- Source tree (`src/`):
- `main.tsx` – application bootstrap (Vite + ReactDOM.render)
- `App.tsx` – root component, routing & context providers
- `pages/` – route views (`Index.tsx`, `NotFound.tsx`)
- `components/` – UI building blocks: domain‑specific (`EmailList`, `EmailDetail`, `ComposeEmail`, `EmailSidebar`) and a large `ui/` library of generic primitives
- `contexts/` – `UserEmailContext` for global email state
- `hooks/` – `use-mobile`, `use-toast`, plus data‑fetching hooks
- `lib/utils.ts` – helper functions (e.g., `convertUrlsToLinks`, filter mapping)

##### README for additional architectural insights
- Uses React Context + TanStack Query for state & data fetching.
- Styling with Tailwind CSS + PostCSS.
- Client–server API interactions for all email operations.
- A single REST API backend hosting authentication, email CRUD, AI features.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Presentation Layer
    Browser["Browser / User"]:::frontend
    subgraph "Presentation Layer"
        direction TB
        AppShell["App Shell & Router\n(src/App.tsx)"]:::frontend
        IndexPage["Index Page\n(src/pages/Index.tsx)"]:::frontend
        NotFoundPage["404 Page\n(src/pages/NotFound.tsx)"]:::frontend

        subgraph "Domain Components"
            direction TB
            EmailList["EmailList\n(src/components/EmailList.tsx)"]:::domain
            EmailDetail["EmailDetail\n(src/components/EmailDetail.tsx)"]:::domain
            ComposeEmail["ComposeEmail\n(src/components/ComposeEmail.tsx)"]:::domain
            EmailSidebar["EmailSidebar\n(src/components/EmailSidebar.tsx)"]:::domain
        end

        subgraph "UI Primitives Library"
            direction TB
            UIPrims["ui/*\n(src/components/ui/)"]:::ui
        end
    end

    %% State & Data Layer
    subgraph "State & Hooks Layer"
        direction TB
        Context["UserEmailContext\n(src/contexts/UserEmailContext.tsx)"]:::state
        subgraph "Hooks"
            direction TB
            UseMobile["use-mobile\n(src/hooks/use-mobile.tsx)"]:::hooks
            UseToast["use-toast\n(src/hooks/use-toast.ts)"]:::hooks
            TanStackQuery["Data-fetching Hooks\n(TanStack Query)"]:::hooks
        end
    end

    %% Utilities
    Utils["Utils\n(src/lib/utils.ts)"]:::util

    %% Backend & External
    RESTAPI["REST API Backend\nhttp://127.0.0.1:5000"]:::backend
    AIService["AI Service Endpoints"]:::external

    %% Flow Connections
    Browser --> AppShell
    AppShell --> Context
    AppShell --> IndexPage
    AppShell --> NotFoundPage

    IndexPage --> EmailList
    IndexPage --> EmailDetail
    IndexPage --> ComposeEmail
    IndexPage --> EmailSidebar

    EmailList --> UseMobile
    EmailList --> TanStackQuery
    EmailDetail --> TanStackQuery
    ComposeEmail --> TanStackQuery
    ComposeEmail --> UseToast
    EmailSidebar --> TanStackQuery

    UIPrims --> EmailList
    UIPrims --> EmailDetail
    UIPrims --> ComposeEmail
    UIPrims --> EmailSidebar

    Context --> TanStackQuery
    Context --> RESTAPI
    UseMobile --> RESTAPI
    UseToast --> RESTAPI
    TanStackQuery --> RESTAPI
    RESTAPI --> Context
    RESTAPI --> TanStackQuery
    RESTAPI --> AIService

    Utils --> EmailList
    Utils --> EmailDetail
    Utils --> ComposeEmail

    %% Click Events
    click AppShell "https://github.com/chiraggulati098/aura-email-frontend/blob/main/src/App.tsx"
    click Context "https://github.com/chiraggulati098/aura-email-frontend/blob/main/src/contexts/UserEmailContext.tsx"
    click IndexPage "https://github.com/chiraggulati098/aura-email-frontend/blob/main/src/pages/Index.tsx"
    click NotFoundPage "https://github.com/chiraggulati098/aura-email-frontend/blob/main/src/pages/NotFound.tsx"
    click EmailList "https://github.com/chiraggulati098/aura-email-frontend/blob/main/src/components/EmailList.tsx"
    click EmailDetail "https://github.com/chiraggulati098/aura-email-frontend/blob/main/src/components/EmailDetail.tsx"
    click ComposeEmail "https://github.com/chiraggulati098/aura-email-frontend/blob/main/src/components/ComposeEmail.tsx"
    click EmailSidebar "https://github.com/chiraggulati098/aura-email-frontend/blob/main/src/components/EmailSidebar.tsx"
    click UIPrims "https://github.com/chiraggulati098/aura-email-frontend/tree/main/src/components/ui/"
    click UseMobile "https://github.com/chiraggulati098/aura-email-frontend/blob/main/src/hooks/use-mobile.tsx"
    click UseToast "https://github.com/chiraggulati098/aura-email-frontend/blob/main/src/hooks/use-toast.ts"
    click Utils "https://github.com/chiraggulati098/aura-email-frontend/blob/main/src/lib/utils.ts"
    click main "https://github.com/chiraggulati098/aura-email-frontend/blob/main/src/main.tsx"

    %% Styles
    classDef frontend fill:#D0E8FF,stroke:#0366d6,stroke-width:1px
    classDef domain fill:#E8F4D0,stroke:#4F8A10,stroke-width:1px
    classDef ui fill:#F0E8FF,stroke:#8A2BE2,stroke-width:1px
    classDef state fill:#DFFFE0,stroke:#228B22,stroke-width:1px
    classDef hooks fill:#FFF5D0,stroke:#DAA520,stroke-width:1px
    classDef util fill:#FFEFD5,stroke:#CD853F,stroke-width:1px
    classDef backend fill:#FFE0E0,stroke:#d73a49,stroke-width:1px
    classDef external fill:#E8E8E8,stroke:#6a737d,stroke-width:1px
```
