# pallaveejarad/product-app-backend architecture

> Architecture diagram of the GitHub repository pallaveejarad/product-app-backend, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pallaveejarad/product-app-backend
- Repository: https://github.com/pallaveejarad/product-app-backend

## Overview

##### Project type and purpose
- This is a Spring Boot-based RESTful backend service (“Product-App-Backend”) that exposes CRUD APIs for product management.
- It handles user authentication/authorization, integrates with a MySQL database, and performs error handling and input validation via a global exception handler.

##### File structure
- Top-level build files: pom.xml, maven wrapper.
- src/main/java/com/example/product: the codebase is organized by package:
- controller – REST endpoints (ProductController)
- service – business logic (ProductService)
- repository – data access (Spring Data JPA repos)
- mapper – DTO/entity conversions (ProductMapper)
- model – JPA entity classes (Product, CountryMasterData, ProductRange)
- pojo – request/response payloads (ProductPojo)
- exception – centralized error handling (GlobalExceptionHandler)
- src/main/resources/application.properties – configuration (we’ll point it to MySQL)
- tests mirror the main package structure.

##### README for additional insights
- Confirms features: CRUD, auth, database storage, error handling.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Client
    Client["External Client"]:::external

    %% Controller Layer
    subgraph "Controller Layer"
        PC["ProductController"]:::controller
    end

    %% Service Layer
    subgraph "Service Layer"
        PS["ProductService"]:::service
        PM["ProductMapper"]:::service
        POJO["ProductPojo"]:::dto
    end

    %% Repository Layer
    subgraph "Repository Layer"
        PR["ProductRepository"]:::repository
        CM["CountryMasterDataRepo"]:::repository
        RR["ProductRangeRepo"]:::repository
        PE["Product Entity"]:::entity
        CDE["CountryMasterData Entity"]:::entity
        PRE["ProductRange Entity"]:::entity
    end

    %% Cross-cutting
    ExceptionHandler["GlobalExceptionHandler"]:::cross

    %% Database
    DB(("MySQL Database")):::database

    %% Interactions
    Client -->|"HTTP GET/POST"| PC
    PC -->|"invokes"| PS
    PS -->|"maps DTO→Entity"| PM
    PM -->|"produces Entity"| PS
    PS -->|"uses DTO"| POJO
    PS -->|"save()/find() on Product"| PR
    PS -->|"query Countries"| CM
    PS -->|"query Ranges"| RR
    PR -->|"persists to"| PE
    CM -->|"maps to"| CDE
    RR -->|"maps to"| PRE
    PR -->|"JPA Query"| DB
    CM -->|"JPA Query"| DB
    RR -->|"JPA Query"| DB
    PS -->|"returns DTO"| PM
    PM -->|"maps Entity→DTO"| PS
    PS -->|"response data"| PC
    PC -->|"HTTP Response"| Client
    PC -->|error| ExceptionHandler
    PS -->|error| ExceptionHandler

    %% Click Events
    click PC "https://github.com/pallaveejarad/product-app-backend/blob/main/src/main/java/com/example/product/controller/ProductController.java"
    click PS "https://github.com/pallaveejarad/product-app-backend/blob/main/src/main/java/com/example/product/service/ProductService.java"
    click PR "https://github.com/pallaveejarad/product-app-backend/blob/main/src/main/java/com/example/product/repository/ProductRepository.java"
    click CM "https://github.com/pallaveejarad/product-app-backend/blob/main/src/main/java/com/example/product/repository/CountryMasterDataRepo.java"
    click RR "https://github.com/pallaveejarad/product-app-backend/blob/main/src/main/java/com/example/product/repository/ProductRangeRepo.java"
    click PM "https://github.com/pallaveejarad/product-app-backend/blob/main/src/main/java/com/example/product/mapper/ProductMapper.java"
    click ExceptionHandler "https://github.com/pallaveejarad/product-app-backend/blob/main/src/main/java/com/example/product/exception/GlobalExceptionHandler.java"
    click POJO "https://github.com/pallaveejarad/product-app-backend/blob/main/src/main/java/com/example/product/pojo/ProductPojo.java"
    click PE "https://github.com/pallaveejarad/product-app-backend/blob/main/src/main/java/com/example/product/model/Product.java"
    click CDE "https://github.com/pallaveejarad/product-app-backend/blob/main/src/main/java/com/example/product/model/CountryMasterData.java"
    click PRE "https://github.com/pallaveejarad/product-app-backend/blob/main/src/main/java/com/example/product/model/ProductRange.java"
    click DB "https://github.com/pallaveejarad/product-app-backend/blob/main/src/main/resources/application.properties"

    %% Styles
    classDef external fill:#f9f,stroke:#333,stroke-width:1px
    classDef controller fill:#cce5ff,stroke:#333,stroke-width:1px
    classDef service fill:#d4edda,stroke:#333,stroke-width:1px
    classDef repository fill:#fff3cd,stroke:#333,stroke-width:1px
    classDef database fill:#d6d8d9,stroke:#333,stroke-width:1px
    classDef cross fill:#e2e3e5,stroke:#333,stroke-width:1px
    classDef dto fill:#f5d0fe,stroke:#333,stroke-width:1px
    classDef entity fill:#ffe4b5,stroke:#333,stroke-width:1px
```
