Project Overview
This project was developed during my summer internship in the Enterprise Applications Department. The purpose of the project was to mock a REST API for an Order & Stock Management System.
I used Spring Boot as the main framework and implemented role-based authentication and authorization with Spring Security.
🔑 Key Features
Role-Based Authentication & Authorization
Implemented with Spring Security (JWT).
Two main roles:
ADMIN → Manages products, updates order/return statuses, adjusts stock, and supervises customer operations.
USER → Customers who can place orders, view their own orders, and create return requests only for their own purchases.
Order Management
Customers can place new orders.
Orders go through defined status transitions (Created → Confirmed → Shipped → Delivered → Returned/Cancelled).
Status transitions are validated with a custom validator to ensure correct flow.
Return Management
Users can request returns only for their own orders.
Admin can confirm or reject returns.
On confirmed returns, stock is automatically updated.
Product & Stock Management
Admin can add, update, or delete products.
Stock levels are updated on orders and returns.
Exception Handling
Custom global exception handling for different scenarios (e.g., insufficient stock, unauthorized access, not found errors).
Clear error messages with business-specific error codes.
Metrics & Monitoring
Integrated Spring Boot Actuator for application health and metrics.
Custom metrics added:
Total number of orders
Total number of returns
Total stock quantity across products
Logging
Important business operations (authentication, orders, returns, stock updates) are logged.
Logs can be extended to external systems like MongoDB or ELK Stack for monitoring.
🛠️ Tech Stack
Java 17
Spring Boot
Spring Security (JWT)
Spring Data JPA (Hibernate)
H2 / PostgreSQL (configurable)
Spring Actuator
Lombok
🚀 How It Works
Admin
Manages the catalog and system state.
Updates stock and order statuses.
Confirms or rejects return requests.
User
Registers and logs in.
Places orders and tracks them.
Requests returns for their own orders only.
🤝 Contributing & Feedback
This project will be opened to the public. Feel free to contribute, open pull requests, or report bugs/issues. Any feedback to improve the project is always welcome!
📧 You can also contact me directly for questions or suggestions.