A comprehensive full-stack inventory solution built with a secure Spring Boot REST API and a dynamic React frontend, delivering role-based access, real-time stock monitoring, and analytical insights.
- Features
- Tech Stack
- Project Structure
- Architecture Overview
- Database Schema
- API Reference
- Security & Roles
- Getting Started
- Configuration Reference
- Running Tests
- Known Issues & Notes
-
JWT Authentication Stateless authentication using JJWT (HS256) with a 24-hour token lifespan.
-
Role-Based Access Control Supports three roles:
ADMIN,SUPPLIER,CUSTOMER. -
Product Management Full CRUD functionality with both soft deletion (deactivation) and permanent removal.
-
Stock Handling Controlled stock updates with safeguards against invalid quantities.
-
Search & Filtering Flexible product lookup by name, category, or supplier.
-
Low-Stock Alerts Automated email notifications triggered during stock reduction or report execution.
-
Initial Data Seeding Categories and suppliers populate automatically on first launch.
-
Validation Layer Strict validation at the service level ensures data integrity.
-
Dual-panel Authentication UI Clean login and registration interface with theme switching support.
-
Dashboard Displays KPIs, category-based charts, and low-stock alerts.
-
Product Management Interface Searchable tables, inline editing, and role-based actions.
-
Product Creation Module Validated form restricted to authorized roles.
-
Reports Section Multiple analytical views computed directly from product data.
-
User Management Admin-only functionality for account creation.
-
Theme Support Persistent dark/light mode using local storage.
-
Notification System Toast-based alerts for system feedback.
-
Role Enforcement UI adapts dynamically based on user permissions.
- Java 21
- Spring Boot 3.2.5
- Spring Security + JWT
- Hibernate + JPA
- MySQL 8
- Jakarta Validation
- Jakarta Mail
- Lombok
- JUnit, Mockito
- Maven
Note: For Java 23 compatibility, upgrade Spring Boot to version 3.3.5.
- JavaScript (ES2022)
- React 18
- React Router v6
- Axios
- Custom Canvas Charts
- CSS (with variables and theming)
- Create React App
.
βββ backend/
β βββ src/
β β βββ main/
β β β βββ java/com/
β β β β βββ database/
β β β β β βββ DatabaseConnection.java
β β β β βββ inventory/
β β β β βββ ServerApplication.java
β β β β βββ config/
β β β β β βββ StarterDataConfig.java
β β β β βββ controller/
β β β β β βββ Controller.java
β β β β β βββ AuthController.java
β β β β βββ authservice/
β β β β β βββ AuthService.java
β β β β β βββ CustomUserDetailsService.java
β β β β βββ security/
β β β β β βββ WebSecurityConfig.java
β β β β β βββ SecurityBeansConfig.java
β β β β β βββ JwtAuthenticationFilter.java
β β β β β βββ CorsConfig.java
β β β β βββ utils/
β β β β β βββ AuthUtil.java
β β β β βββ entity/
β β β β β βββ User.java
β β β β β βββ Role.java
β β β β βββ repository/
β β β β β βββ UserRepository.java
β β β β βββ dto/
β β β β β βββ AuthRequest.java
β β β β β βββ AuthResponse.java
β β β β β βββ RegisterRequest.java
β β β β βββ database_system/
β β β β β βββ entity/
β β β β β β βββ Product.java
β β β β β β βββ Category.java
β β β β β β βββ Supplier.java
β β β β β β βββ Transaction.java
β β β β β βββ repository/
β β β β β βββ ProductRepository.java
β β β β β βββ CategoryRepository.java
β β β β β βββ SupplierRepository.java
β β β β βββ dao/
β β β β β βββ ProductDAO.java
β β β β βββ service/
β β β β β βββ ProductService.java
β β β β β βββ InventoryService.java
β β β β β βββ validation/
β β β β β βββ ProductValidator.java
β β β β β βββ InventoryValidator.java
β β β β βββ Report/
β β β β βββ InventoryReportService.java
β β β β βββ EmailService.java
β β β βββ resources/
β β β βββ application.properties
β β β βββ stockmanagement.sql
β β βββ test/java/com/inventory/
β β βββ ControllerTest.java
β β βββ InventoryServiceTest.java
β β βββ InventoryValidatorTest.java
β β βββ ProductDAOTest.java
β β βββ ProductEntityTest.java
β β βββ ProductServiceTest.java
β β βββ ProductValidatorTest.java
β β βββ ServerApplicationTests.java
β β βββ security/
β β βββ AuthControllerTest.java
β β βββ AuthServiceTest.java
β β βββ AuthUtilTest.java
β β βββ CustomUserDetailsServiceTest.java
β β βββ JwtAuthenticationFilterTest.java
β βββ pom.xml
β
βββ frontend/
βββ public/
β βββ index.html
βββ src/
β βββ App.js
β βββ pages/
β β βββ LoginPage.jsx
β β βββ RegisterPage.jsx
β β βββ DashboardPage.jsx
β β βββ ProductsPage.jsx
β β βββ AddProductPage.jsx
β β βββ ReportsPage.jsx
β β βββ AddUserPage.jsx
β βββ components/
β β βββ Navbar.jsx
β β βββ Sidebar.jsx
β β βββ ProductForm.jsx
β β βββ ProductTable.jsx
β β βββ ChartComponent.jsx
β β βββ SummaryCard.jsx
β β βββ LowStockBadge.jsx
β βββ context/
β β βββ AuthContext.js
β β βββ InventoryContext.jsx
β β βββ ThemeContext.js
β β βββ ToastContext.jsx
β βββ hooks/
β β βββ useAuth.js
β β βββ useProducts.js
β β βββ useReports.js
β βββ services/
β β βββ AuthService.js
β β βββ ProductService.js
β β βββ UserService.js
β βββ utilities/
β β βββ ApiUtils.js
β β βββ Constants.js
β β βββ StorageUtils.js
β β βββ ValidationUtils.js
β β βββ FormatUtils.js
β βββ styles/
β βββ global.css
β βββ dashboard.css
β βββ inventory.css
β βββ login.css
βββ package.json
React Frontend (Browser)
|
| HTTP Requests (JWT Auth)
v
Spring Boot Backend
|
| JPA / Hibernate
v
MySQL Database
Core backend responsibilities include:
- Token validation
- Request authorization
- Business logic execution
- Data persistence
Stores authentication and role data.
Core inventory entity with stock tracking and metadata.
Product classification (auto-seeded on first launch).
Staff contact information.
Logs stock movement history.
Tables are generated automatically via Hibernate.
POST /auth/registerPOST /auth/login
- Retrieve, search, filter, add, update, delete, deactivate.
- Increase or reduce product quantities.
- Generate low-stock alerts via email.
- User logs in and receives a token
- Token is stored on the client
- Token is sent with each request
- Backend validates and authorizes the request
| Action | CUSTOMER | SUPPLIER | ADMIN |
|---|---|---|---|
| View Data | β | β | β |
| Modify Products | β | β | β |
| Delete Products | β | β | β |
| Manage Users | β | β | β |
- Java 21
- Maven
- Node.js
- MySQL
- Gmail account (for SMTP alerts)
CREATE DATABASE stockmanagement;- Enable Gmail 2FA
- Generate an App Password
- Insert credentials into
EmailService
cd backend
./mvnw spring-boot:runRuns on: http://localhost:8080
cd frontend
npm install
npm startRuns on: http://localhost:3000
Key properties include:
- Database connection settings
- Hibernate behavior
- JWT secret and expiration
Always replace the default JWT secret before deploying to production.
./mvnw testIncludes:
- Controller tests
- Service tests
- Security tests
- Validation tests
-
Java 23 Compatibility Requires a Spring Boot upgrade due to Mockito limitations.
-
Backend Authorization Role enforcement is primarily handled on the frontend side.
-
CORS Restriction Default configuration allows only
localhost:3000. -
Email Setup Required No default recipient address is configured out of the box.
-
Legacy Code Present Some unused classes and SQL files are retained for reference purposes.
-
Static Dropdown Values Category and supplier IDs are currently hardcoded in the frontend.