Skip to content

Commit 62432e9

Browse files
Project Setup
1 parent 94c3c7f commit 62432e9

26 files changed

Lines changed: 1376 additions & 2 deletions

README.md

Lines changed: 174 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,174 @@
1-
# template
2-
A Template Repository for OpenSpringFest (OSF)
1+
# 📦 Inventory Management Tool
2+
3+
![Spring Boot](https://img.shields.io/badge/Spring_Boot-3.7.0-green.svg)
4+
![Java](https://img.shields.io/badge/Java-21-blue.svg)
5+
![JWT](https://img.shields.io/badge/JWT-Authentication-orange)
6+
![Docker](https://img.shields.io/badge/Docker-Containerized-blue).
7+
8+
A robust Spring Boot application for managing inventory with secure authentication and RESTful API endpoints.
9+
10+
## ✨ Features
11+
12+
- 🔐 JWT-based user authentication
13+
- 📝 Add, update, and view products
14+
- 📊 Manage product quantities
15+
- 📱 Responsive API design
16+
- 🔄 Paginated product listings
17+
- 🐳 Docker container support
18+
19+
## 🛠️ Prerequisites
20+
21+
Before you begin, ensure you have installed:
22+
23+
- Java 21 or higher
24+
- Maven 3.8.6 or higher
25+
- MySQL 8.0 or compatible database
26+
- Postman (for API testing)
27+
28+
## 🚀 Installation & Setup
29+
30+
1. **Clone the repository**
31+
```bash
32+
git clone -b im-01 https://github.com/Abhaytomar2004/Inventory-Management-Tool.git
33+
cd Inventory-Management-Tool
34+
35+
2. **Configure database**
36+
37+
Create a MySQL database named inventory_db
38+
39+
40+
Update application.properties with your credentials:
41+
42+
spring.datasource.url=jdbc:mysql://localhost:3306/inventory_db
43+
44+
spring.datasource.username=your_username
45+
46+
spring.datasource.password=your_password
47+
48+
49+
3. **Build and run**
50+
```bash
51+
mvn clean install
52+
53+
mvn spring-boot:run
54+
```
55+
56+
Option 2: **Docker Deployment**
57+
1. Build Docker image
58+
```
59+
docker build -t inventory-management .
60+
```
61+
2. Run with Docker Compose
62+
```
63+
docker-compose up -d
64+
```
65+
66+
This will start:
67+
68+
MySQL container
69+
70+
Spring Boot application container
71+
72+
Automatic database initialization
73+
74+
Access the application
75+
76+
API will be available at http://localhost:8082
77+
78+
79+
🌐 API Endpoints
80+
81+
1. User Authentication
82+
83+
Endpoint: POST /login'
84+
85+
Request:
86+
{
87+
88+
"username": "string",
89+
90+
"password": "string"
91+
92+
}
93+
94+
Response:
95+
96+
Success: JWT token
97+
98+
Failure: Invalid credentials
99+
<img width="1920" height="1080" alt="Screenshot (84)" src="https://github.com/user-attachments/assets/e6325944-1c47-4aad-8115-3061414013ee" />
100+
101+
2. Add Product
102+
103+
Endpoint: POST /products
104+
105+
Payload:
106+
107+
{
108+
109+
"name": "string",
110+
111+
"type": "string",
112+
113+
"sku": "string",
114+
115+
"image_url": "string",
116+
117+
"description": "string",
118+
119+
"quantity": 10,
120+
121+
"price": 99.99
122+
123+
}
124+
125+
Authentication: Required (JWT)
126+
Response: Product ID and confirmation
127+
128+
<img width="1920" height="1080" alt="Screenshot (81)" src="https://github.com/user-attachments/assets/21dfd8f8-5ad2-40c1-8c05-0a8ef1adb87e" />
129+
130+
131+
3. Update Product Quantity
132+
133+
Endpoint: PUT /products/{id}/quantity
134+
135+
Payload:
136+
{
137+
138+
"quantity": 10
139+
140+
}
141+
142+
Authentication: Required (JWT)
143+
Response: Updated product details
144+
145+
<img width="1920" height="1080" alt="Screenshot (82)" src="https://github.com/user-attachments/assets/38d357f0-8044-46fc-b013-17a1ce55e051" />
146+
147+
148+
5. Get Products
149+
150+
Endpoint: GET /products
151+
152+
Parameters: page, size (for pagination)
153+
154+
Authentication: Required (JWT)
155+
156+
157+
Response: Paginated list of products
158+
159+
<img width="1920" height="1080" alt="image" src="https://github.com/user-attachments/assets/2814fd24-8cf7-4aa0-8430-a1cda6f5d5e5" />
160+
161+
🐳 Docker Configuration Details
162+
163+
The application includes:
164+
165+
Dockerfile for building the Spring Boot application image
166+
167+
docker-compose.yml for orchestration with MySQL
168+
169+
Automatic database schema initialization
170+
171+
Environment variables for easy configuration
172+
173+
174+

0 commit comments

Comments
 (0)