# akadim/central-perk architecture

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

- Interactive diagram: https://gitdiagram.com/akadim/central-perk
- Repository: https://github.com/akadim/central-perk

## Overview

##### Project Type and Purpose
- This is a full-stack web application for managing a rewards system (“Central Perk”).
- Frontend: React (Vite, Material UI, Redux Toolkit, React Router)
- Backend: Java Spring Boot REST API
- Database: MySQL (rewards, reward_details, orders, order_details, customers, categories)

##### File Structure Analysis
- Top level:
- README.md (project overview)
- /backend (Maven-based Spring Boot service)
- /frontend (Vite + React application)
- Backend:
- pom.xml, mvnw wrapper → standard Maven project
- src/main/java/com/invenboost/centralperk
– CentralperkApplication.java (entry point)
– entities/ (JPA @Entity classes: Category, Customer, Reward, RewardDetail)
- src/main/resources/application.properties (DB configuration)
- Frontend:
- package.json, vite.config.js → Node + Vite setup
- public/, src/
– src/components/, modals/, ui/ (UI hierarchy)
– src/store/ (Redux slices: categoriesSlice.js, customersSlice.js, rewardsSlice.js)
– src/data/mockData.js (local mocks for image uploads & rewards)
– src/App.jsx, main.jsx (app bootstrap)

##### README Insights
- Backend exposes REST endpoints for loyal customers and CRUD on rewards.
- Frontend consumes API, local image uploads (no cloud persistence).
- Tech risks & mitigation (e.g., Docker for env consistency; UX sign-off on mockup).

a. Main Components
- Client Browser (User Interface)
- Frontend App (React/Vite)
- Backend Service (Spring Boot REST API)
- MySQL Database
- (Optional) Static File Store or Local FS for uploaded images
b. Relationships & Data Flows
1. Browser ←→ React App (HTTP/HTTPS)
2. React App dispatches Redux actions → slices → renders UI
3. React App → REST calls to Spring Boot (Axios or fetch)
4. Spring Boot Controllers → Services (business logic) → Repositories (JPA) → MySQL
5. (If implemented) Spring Boot → local FS for image writes
c. Architectural Patterns & Principles
- Frontend: Component hierarchy + Redux for global state (unidirectional data flow)
- Backend: MVC pattern (Controllers → Services → Repositories)
- Separation of concerns (UI, state management, API, data persistence)
- RESTful API conventions (GET, POST, PUT, DELETE)
d. Key Technologies
- React, Redux Toolkit, Material UI, Vite
- Java, Spring Boot, Spring Data JPA, Maven
- MySQL
- Third-party libs: react-circular-progressbar, Styled Components

9. Optionally, annotate where risk mitigation (e.g., Docker) fits in.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Container
    subgraph "Frontend" 
        direction TB
        Browser["Client Browser"]:::external
        ReactApp["React App"]:::frontend
        UIComponents["UI Components"]:::ui
        ReduxStore["Redux Store"]:::store
        MockData["Mock Data"]:::data
        Config["Config & Assets"]:::config
    end

    %% Backend Container
    subgraph "Backend" 
        direction TB
        SpringApp["CentralperkApplication"]:::backend
        Controllers["Controllers (REST API)"]:::backend
        Services["Services (Business Logic)"]:::backend
        Repositories["Repositories (JPA)"]:::backend
        Entities["JPA Entities"]:::backend
        ConfigBackend["application.properties"]:::config
        Maven["Maven Build"]:::config
        Tests["Backend Tests"]:::test
    end

    %% Data Container
    subgraph "Data" 
        direction TB
        MySQLDB["MySQL Database"]:::database
        FileStore["Local File Store"]:::storage
    end

    %% Connections
    Browser -->|"interacts via HTTP/HTTPS"| ReactApp
    ReactApp -->|"dispatch Redux actions"| ReduxStore
    ReactApp -->|"renders UI components"| UIComponents
    ReactApp -->|"uses mock data"| MockData
    ReactApp -->|"fetches config/assets"| Config

    ReactApp -->|"REST calls (GET/POST/...)"| Controllers
    Controllers -->|"calls"| Services
    Services -->|"uses"| Repositories
    Repositories -->|"CRUD JSON data"| MySQLDB
    Controllers -->|"writes images"| FileStore

    SpringApp -->|"initializes"| Controllers
    SpringApp -->|"reads config"| ConfigBackend
    SpringApp -->|"build via"| Maven
    SpringApp -->|"tested by"| Tests

    %% Click Events Frontend
    click ReactApp "https://github.com/akadim/central-perk/tree/master/frontend/"
    click Browser "https://github.com/akadim/central-perk/blob/master/frontend/src/main.jsx"
    click ReactApp "https://github.com/akadim/central-perk/blob/master/frontend/src/App.jsx"
    click UIComponents "https://github.com/akadim/central-perk/tree/master/frontend/src/components/"
    click Dashboard "https://github.com/akadim/central-perk/blob/master/frontend/src/components/Dashboard.jsx"
    click Sidebar "https://github.com/akadim/central-perk/blob/master/frontend/src/components/Sidebar.jsx"
    click RewardsList "https://github.com/akadim/central-perk/blob/master/frontend/src/components/RewardsList.jsx"
    click CategoriesList "https://github.com/akadim/central-perk/blob/master/frontend/src/components/CategoriesList.jsx"
    click LoyalCustomers "https://github.com/akadim/central-perk/blob/master/frontend/src/components/LoyalCustomers.jsx"
    click PopularRewards "https://github.com/akadim/central-perk/blob/master/frontend/src/components/PopularRewards.jsx"
    click RewardCharts "https://github.com/akadim/central-perk/blob/master/frontend/src/components/RewardCharts.jsx"
    click SalesChart "https://github.com/akadim/central-perk/blob/master/frontend/src/components/SalesChart.jsx"
    click Layout "https://github.com/akadim/central-perk/blob/master/frontend/src/components/Layout.jsx"
    click Modals "https://github.com/akadim/central-perk/tree/master/frontend/src/components/modals/"
    click RewardModal "https://github.com/akadim/central-perk/blob/master/frontend/src/components/modals/RewardModal.jsx"
    click UploadImage "https://github.com/akadim/central-perk/blob/master/frontend/src/components/modals/UploadImage.jsx"
    click UIHelpers "https://github.com/akadim/central-perk/tree/master/frontend/src/components/ui/"
    click RewardCard "https://github.com/akadim/central-perk/blob/master/frontend/src/components/ui/RewardCard.jsx"
    click RoundedButton "https://github.com/akadim/central-perk/blob/master/frontend/src/components/ui/RoundedButton.jsx"
    click StyledCard "https://github.com/akadim/central-perk/blob/master/frontend/src/components/ui/StyledCard.jsx"
    click ReduxStore "https://github.com/akadim/central-perk/blob/master/frontend/src/store/index.js"
    click CategoriesSlice "https://github.com/akadim/central-perk/blob/master/frontend/src/store/categoriesSlice.js"
    click CustomersSlice "https://github.com/akadim/central-perk/blob/master/frontend/src/store/customersSlice.js"
    click RewardsSlice "https://github.com/akadim/central-perk/blob/master/frontend/src/store/rewardsSlice.js"
    click MockData "https://github.com/akadim/central-perk/blob/master/frontend/src/data/mockData.js"
    click Config "https://github.com/akadim/central-perk/blob/master/frontend/package.json"
    click Config "https://github.com/akadim/central-perk/blob/master/frontend/vite.config.js"
    click Config "https://github.com/akadim/central-perk/tree/master/frontend/public/"

    %% Click Events Backend
    click SpringApp "https://github.com/akadim/central-perk/tree/master/backend/centralperk/"
    click SpringApp "https://github.com/akadim/central-perk/blob/master/backend/centralperk/src/main/java/com/invenboost/centralperk/CentralperkApplication.java"
    click Entities "https://github.com/akadim/central-perk/tree/master/backend/centralperk/src/main/java/com/invenboost/centralperk/entities/"
    click CategoryEntity "https://github.com/akadim/central-perk/blob/master/backend/centralperk/src/main/java/com/invenboost/centralperk/entities/Category.java"
    click CustomerEntity "https://github.com/akadim/central-perk/blob/master/backend/centralperk/src/main/java/com/invenboost/centralperk/entities/Customer.java"
    click RewardEntity "https://github.com/akadim/central-perk/blob/master/backend/centralperk/src/main/java/com/invenboost/centralperk/entities/Reward.java"
    click RewardDetailEntity "https://github.com/akadim/central-perk/blob/master/backend/centralperk/src/main/java/com/invenboost/centralperk/entities/RewardDetail.java"
    click ConfigBackend "https://github.com/akadim/central-perk/blob/master/backend/centralperk/src/main/resources/application.properties"
    click Maven "https://github.com/akadim/central-perk/blob/master/backend/centralperk/pom.xml"
    click Maven "https://github.com/akadim/central-perk/tree/master/backend/mvnw"
    click Maven "https://github.com/akadim/central-perk/blob/master/backend/mvnw.cmd"
    click Maven "https://github.com/akadim/central-perk/tree/master/backend/.mvn/wrapper/"
    click Tests "https://github.com/akadim/central-perk/blob/master/backend/centralperk/src/test/java/com/invenboost/centralperk/CentralperkApplicationTests.java"

    %% Styles
    classDef external fill:#e0f7fa,stroke:#006064;
    classDef frontend fill:#bbdefb,stroke:#0d47a1;
    classDef ui fill:#e3f2fd,stroke:#42a5f5;
    classDef store fill:#c8e6c9,stroke:#2e7d32;
    classDef data fill:#f3e5f5,stroke:#6a1b9a;
    classDef config fill:#fff9c4,stroke:#f9a825;
    classDef backend fill:#c8e6c9,stroke:#2e7d32;
    classDef database fill:#ffe0b2,stroke:#e65100,stroke-width:2px;
    classDef storage fill:#d7ccc8,stroke:#5d4037;
    classDef test fill:#f8bbd0,stroke:#880e4f;
```
