A Spring Boot REST API for managing inventory items, built with JPA and H2 Database.
- RESTful API with full CRUD operations
- H2 in-memory database (auto-creates tables)
- Spring Data JPA for database access
- Clean layered architecture (Controller → Repository → Entity)
- Java 17+
- Spring Boot 3.2
- Spring Data JPA
- H2 Database
- Maven
# Clone the repo
git clone https://github.com/Sasaank79/Java-Inventory-System.git
cd Java-Inventory-System
# Run the application
mvn spring-boot:runThe API will be available at http://localhost:8080
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/items |
List all items |
| GET | /api/items/{id} |
Get item by ID |
| POST | /api/items |
Create new item |
| PUT | /api/items/{id} |
Update item |
| DELETE | /api/items/{id} |
Delete item |
| GET | /api/items/search?name=keyword |
Search by name |
Add an item:
curl -X POST http://localhost:8080/api/items \
-H "Content-Type: application/json" \
-d '{"name": "Laptop", "quantity": 10, "price": 999.99}'List all items:
curl http://localhost:8080/api/itemssrc/main/java/com/inventory/
├── InventoryApplication.java # Entry point
├── controller/
│ └── ItemController.java # REST endpoints
├── model/
│ └── Item.java # JPA Entity
└── repository/
└── ItemRepository.java # Data access layer
Access the database console at: http://localhost:8080/h2-console
- JDBC URL:
jdbc:h2:mem:inventory - Username:
sa - Password: (leave blank)
Built by Surya Sasaank Y.