A robust Spring Boot application for managing inventory with secure authentication and RESTful API endpoints.
- 🔐 JWT-based user authentication
- 📝 Add, update, and view products
- 📊 Manage product quantities
- 📱 Responsive API design
- 🔄 Paginated product listings
- 🐳 Docker container support
Before you begin, ensure you have installed:
- Java 21 or higher
- Maven 3.8.6 or higher
- MySQL 8.0 or compatible database
- Postman (for API testing)
- Clone the repository
git clone -b https://github.com/OPCODE-Open-Spring-Fest/Inventory-Management-Tool-OPCODE# cd Inventory-Management-Tool
- Configure database
Create a MySQL database named inventory_db
Update application.properties with your credentials:
spring.datasource.url=jdbc:mysql://localhost:3306/inventory_db
spring.datasource.username=your_username
spring.datasource.password=your_password
- Build and run
mvn clean install
mvn spring-boot:run
This will start:
MySQL container
Spring Boot application container
Automatic database initialization
Access the application
API will be available at http://localhost:8082
🌐 API Endpoints
- User Authentication
Endpoint: POST /login'
Request: {
"username": "string",
"password": "string"
}
Response:
Success: JWT token
- Add Product
Endpoint: POST /products
Payload:
{
"name": "string",
"type": "string",
"sku": "string",
"image_url": "string",
"description": "string",
"quantity": 10,
"price": 99.99
}
Authentication: Required (JWT) Response: Product ID and confirmation

- Update Product Quantity
Endpoint: PUT /products/{id}/quantity
Payload: {
"quantity": 10
}
Authentication: Required (JWT) Response: Updated product details

- Get Products
Endpoint: GET /products
Parameters: page, size (for pagination)
Authentication: Required (JWT)
Response: Paginated list of products

🐳 Docker Configuration Details
The application includes:
Dockerfile for building the Spring Boot application image
docker-compose.yml for orchestration with MySQL
Automatic database schema initialization
Environment variables for easy configuration