A robust, full-stack Inventory Management System designed to handle product operations, stock tracking, and real-time metrics.
This project demonstrates a Clean Architecture approach, implementing SOLID principles in the backend and a Context-driven state management system in the frontend.
- Java
- Spring Boot (Web, DevTools)
- Maven (Build Tool)
- Layered Architecture (Controller - Service - Repository)
- React
- TypeScript
- Vite
- ShadCN UI & Tailwind CSS
- Axios (Service Layer)
- Context API (State Management)
This project moves away from monolithic patterns to a modular, scalable design.
The Spring Boot application is divided into three distinct layers to ensure Separation of Concerns (SoC):
- Controller Layer: Handles HTTP requests and response formatting. It delegates business logic to the Service layer.
- Service Layer: Contains all business rules, validations, and metric calculations. It uses Java Streams for efficient data processing.
- Repository Layer: Abstraction for data persistence (currently In-Memory, adaptable to JPA).
The React application decouples UI from Logic:
- Service Layer (
productService.ts): Implements an Adapter Pattern to map Backend DTOs (e.g.,productName) to Frontend Interfaces (e.g.,name), ensuring type safety and preventinganytypes. - Context Provider (
ProductContext): Centralizes the state (Products, Metrics, Filters, Pagination). It eliminates prop-drilling. - Components: Divided into "Smart" Containers (
ProductSection,MetricsSection) that consume the Context, and "Dumb" UI components (Table,Dropdowns) that simply render data.
Before running the project, ensure you have the following installed:
- Java Development Kit (JDK) or higher.
- Node.js (v18 or higher) & npm.
- Maven (optional, wrapper included).
To run the full stack application, you need two terminal instances.
The backend runs on port 9090 to avoid conflicts with the frontend.
- Navigate to the backend folder:
cd Backend - Run the application using Maven:
Alternatively, if you have the wrapper:
mvn spring-boot:run
./mvnw spring-boot:run
Success: You should see
Tomcat started on port(s): 9090in the console.
The frontend uses Vite and runs on port 8080 (default).
- Navigate to the frontend folder:
cd BToyI - Install dependencies (first time only):
npm install
- Start the development server:
(Note: This is an alias for
npm run start
vite dev)
Success: Click the link shown in the terminal (usually
http://localhost:8080) to open the app.
root/
├── backend/
│ ├── src/main/java/com/breakableToy/demo/
│ │ ├── Config/ # CORS Configuration
│ │ ├── Controller/ # REST Endpoints
│ │ ├── Service/ # Business Logic
│ │ ├── Repository/ # Data Access
│ │ ├── Entities/ # Domain Models
│ │ └── DTO/ # Data Transfer Objects
│ └── application.properties # Server Port: 9090
│
└── frontend/
├── src/
│ ├── components/
│ │ ├── BToyParts/ # App specific components (Sections, Dropdowns)
│ │ └── ui/ # ShadCN reusable components
│ ├── context/ # ProductProvider (Global State)
│ ├── services/ # Axios & Adapters
│ ├── types/ # TypeScript Interfaces
│ └── pages/ # Layouts
└── package.json # Scripts