How akadim/central-perk works
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.