# tuanluck/menvibe architecture

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

- Interactive diagram: https://gitdiagram.com/tuanluck/menvibe
- Repository: https://github.com/tuanluck/menvibe

## Overview

##### Project type and purpose
- MenVibe is a full-stack e-commerce web application.
- The frontend is a ReactJS single-page application (SPA) using TailwindCSS and React Router.
- The backend (not in this repo) is a Java Spring Boot MVC service secured by JWT, persisting data in MySQL via Spring Data JPA.
- Key user roles are Guest, Authenticated User, and Admin, each with progressively broader capabilities (browsing, cart management, ordering, admin management).

##### File structure
- Top level: package.json, postcss.config.js, public, src → typical React project.
- public/ contains index.html, manifest.json, robots.txt for static asset delivery.
- src/ houses:
– index.js → ReactDOM.render, entry point.
– App.js, App.css → root component and styling.
– src/Pages/ → page components (LoginPage, RegisterPage, ForgotPassword, ResetPassword).
– css/ → global CSS index.css.
– setupTests.js, reportWebVitals.js, App.test.js → test and telemetry scaffolding.
- No backend code here; the frontend communicates with a separate Spring Boot API over fetch.

##### Extract additional insights from README
- The README outlines user stories and features per role.
- It specifies the tech stack: ReactJS + TailwindCSS + React Router + fetch + LocalStorage on frontend; Java Spring Boot + JWT + Spring Data JPA + MySQL on backend.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend Layer"
        Browser["User Browser"]:::frontend
        subgraph "React SPA" 
            HTML["index.html"]:::frontend
            JS["src/index.js"]:::frontend
            App["App.js"]:::frontend
            CSS1["App.css"]:::frontend
            CSS2["index.css"]:::frontend
            subgraph "Pages"
                Login["LoginPage.jsx"]:::frontend
                Register["RegisterPage.jsx"]:::frontend
                Forgot["ForgotPassword.jsx"]:::frontend
                Reset["ResetPassword.jsx"]:::frontend
            end
            Storage["LocalStorage (cart & JWT)"]:::storage
        end
        Manifest["manifest.json"]:::frontend
        Robots["robots.txt"]:::frontend
        Package["package.json"]:::frontend
        PackageLock["package-lock.json"]:::frontend
        PostCSS["postcss.config.js"]:::frontend
        SetupTests["setupTests.js"]:::frontend
        ReportWebVitals["reportWebVitals.js"]:::frontend
        AppTest["App.test.js"]:::frontend
    end

    %% Backend Layer
    subgraph "Backend Layer"
        API["Java Spring Boot Service"]:::backend
        subgraph "Controllers"
            AuthCtrl["Auth Controller"]:::backend
            ProductCtrl["Product Controller"]:::backend
        end
        subgraph "Services"
            AuthSvc["Auth Service"]:::backend
            ProductSvc["Product Service"]:::backend
        end
        subgraph "Repositories"
            Repo["Spring Data JPA Repositories"]:::backend
        end
        DB["MySQL Database"]:::database
    end

    %% Connections
    Browser -->|"loads"| HTML
    Browser -->|"loads"| Manifest
    Browser -->|"loads"| Robots
    HTML -->|"bootstraps"| JS
    JS -->|"renders"| App
    App -->|"routes to"| Login
    App -->|"routes to"| Register
    App -->|"routes to"| Forgot
    App -->|"routes to"| Reset
    JS -->|"imports"| CSS1
    JS -->|"imports"| CSS2
    App -->|"reads/writes"| Storage
    App -->|"fetch API calls"| AuthCtrl
    App -->|"fetch API calls"| ProductCtrl
    AuthCtrl -->|"calls"| AuthSvc
    ProductCtrl -->|"calls"| ProductSvc
    AuthSvc -->|"uses"| Repo
    ProductSvc -->|"uses"| Repo
    Repo -->|"queries"| DB
    AuthCtrl -->|"returns JWT"| App

    %% Click Events
    click HTML "https://github.com/tuanluck/menvibe/blob/master/public/index.html"
    click JS "https://github.com/tuanluck/menvibe/blob/master/src/index.js"
    click App "https://github.com/tuanluck/menvibe/blob/master/src/App.js"
    click CSS1 "https://github.com/tuanluck/menvibe/blob/master/src/App.css"
    click CSS2 "https://github.com/tuanluck/menvibe/blob/master/src/css/index.css"
    click Login "https://github.com/tuanluck/menvibe/blob/master/src/Pages/LoginPage.jsx"
    click Register "https://github.com/tuanluck/menvibe/blob/master/src/Pages/RegisterPage.jsx"
    click Forgot "https://github.com/tuanluck/menvibe/blob/master/src/Pages/ForgotPassword.jsx"
    click Reset "https://github.com/tuanluck/menvibe/blob/master/src/Pages/ResetPassword.jsx"
    click Manifest "https://github.com/tuanluck/menvibe/blob/master/public/manifest.json"
    click Robots "https://github.com/tuanluck/menvibe/blob/master/public/robots.txt"
    click Package "https://github.com/tuanluck/menvibe/blob/master/package.json"
    click PackageLock "https://github.com/tuanluck/menvibe/blob/master/package-lock.json"
    click PostCSS "https://github.com/tuanluck/menvibe/blob/master/postcss.config.js"
    click SetupTests "https://github.com/tuanluck/menvibe/blob/master/src/setupTests.js"
    click ReportWebVitals "https://github.com/tuanluck/menvibe/blob/master/src/reportWebVitals.js"
    click AppTest "https://github.com/tuanluck/menvibe/blob/master/src/App.test.js"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef backend fill:#90EE90,stroke:#333,stroke-width:1px
    classDef database fill:#F4A460,stroke:#333,stroke-width:1px
    classDef storage fill:#FFFACD,stroke:#333,stroke-width:1px
```
