Skip to content

A robust Spring Boot application for managing inventory with secure authentication and RESTful API endpoints.

OPCODE-Open-Spring-Fest/Inventory-Management-Tool-OPCODE

Repository files navigation

📦 Inventory Management Tool

Spring Boot Java JWT Docker.

A robust Spring Boot application for managing inventory with secure authentication and RESTful API endpoints.

✨ Features

  • 🔐 JWT-based user authentication
  • 📝 Add, update, and view products
  • 📊 Manage product quantities
  • 📱 Responsive API design
  • 🔄 Paginated product listings
  • 🐳 Docker container support

🛠️ Prerequisites

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)

🚀 Installation & Setup

  1. Clone the repository
    git clone -b https://github.com/OPCODE-Open-Spring-Fest/Inventory-Management-Tool-OPCODE#
    cd Inventory-Management-Tool
    
  2. 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

🌏 Docker Hub Image

You can directly pull and run the pre-built image from Docker Hub:

docker pull atulsingh17/opcode-inventorymanagement:1.0 docker run -p 8080:8082 atulsingh17/opcode-inventorymanagement:1.0

  1. 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

  1. User Authentication

Endpoint: POST /login'

Request: {

"username": "string",

"password": "string"

}

Response:

Success: JWT token

Failure: Invalid credentials Screenshot (84)

  1. 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

Screenshot (81)
  1. Update Product Quantity

Endpoint: PUT /products/{id}/quantity

Payload: {

"quantity": 10

}

Authentication: Required (JWT) Response: Updated product details

Screenshot (82)
  1. Get Products

Endpoint: GET /products

Parameters: page, size (for pagination)

Authentication: Required (JWT)

Response: Paginated list of products

image

🐳 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

About

A robust Spring Boot application for managing inventory with secure authentication and RESTful API endpoints.

Topics

Resources

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •