A scalable Spring Boot REST API for managing products, categories, and inventory with:
- 🔐 JWT Authentication
- 🛡️ Role-Based Access Control (RBAC)
- ⚡ Redis Caching for performance optimization
- 🔐 Secure Authentication (JWT)
- 🛡️ Role-Based Authorization (ADMIN, MANAGER, USER)
- 📦 Product Management
- 🗂️ Category Management
- 📊 Inventory Tracking & Logs
- ⚡ Redis Caching for high-volume endpoints
- 🔎 Search & Filtering
- 📉 Low Stock Alerts
- ✅ Method-level security using
@PreAuthorize
- Backend: Spring Boot
- Security: Spring Security + JWT
- Caching: Redis
- API Docs: Swagger / OpenAPI
POST /auth/login{
"username": "admin",
"password": "password"
}{
"token": "jwt-token",
"username": "admin",
"role": "ADMIN"
}👉 Use token in headers:
Authorization: Bearer <token>| Feature / Endpoint Type | ADMIN | MANAGER | USER |
|---|---|---|---|
| Products - Read | ✅ | ✅ | ✅ |
| Products - Create | ✅ | ❌ | ❌ |
| Products - Update | ✅ | ❌ | ❌ |
| Products - Delete | ✅ | ❌ | ❌ |
| Low Stock Products | ✅ | ✅ | ❌ |
| Categories | ✅ | ❌ | ❌ |
| Inventory | ✅ | ✅ | ❌ |
| User Registration | ✅ | ✅ | ✅ |
Caching is applied to frequently accessed and large datasets:
/products/products/search/products/category/{categoryId}
- 🚀 Faster response time
- 📉 Reduced database load
- ⚡ Improved scalability
| Method | Endpoint | Access |
|---|---|---|
| GET | /products |
All |
| GET | /products/{id} |
All |
| GET | /products/sku/{sku} |
All |
| GET | /products/search?name= |
All |
| GET | /products/category/{categoryId} |
All |
| GET | /products/low-stock |
ADMIN, MANAGER |
| POST | /products |
ADMIN |
| PATCH | /products/{id} |
ADMIN |
| DELETE | /products/{id} |
ADMIN |
| Method | Endpoint | Access |
|---|---|---|
| GET | /categories |
All |
| GET | /categories/{id} |
All |
| POST | /categories |
ADMIN |
| PUT | /categories/{id} |
ADMIN |
| DELETE | /categories/{id} |
ADMIN |
| Method | Endpoint | Access |
|---|---|---|
| POST | /inventory/update |
ADMIN, MANAGER |
| GET | /inventory/logs/recent |
ADMIN, MANAGER |
| GET | /inventory/logs/product/{productId} |
ADMIN, MANAGER |
| Method | Endpoint | Access |
|---|---|---|
| POST | /users/register |
Public |
Swagger UI:
http://localhost:8080/swagger-ui/index.htmlOpenAPI Spec:
http://localhost:8080/v3/api-docs# Clone repository
git clone https://github.com/YugTank/InventoryManagement
# Navigate to project
cd inventory-management
# Run application
./mvnw spring-boot:run- Pagination & Sorting
- Rate Limiting
- Dockerization
- API Versioning
- Unit & Integration Testing