https://github.com/sebaspallero/inventory-management-api
An inventory management REST API built with Spring Boot, designed to handle product stock, supplier relationships, order processing, and manual inventory movements. This project is intended as a foundational backend system for managing inventory in small to mid-sized businesses.
https://github.com/sebaspallero/inventory-management-api
backend java managment-system springboot
Last synced: 4 months ago
JSON representation
An inventory management REST API built with Spring Boot, designed to handle product stock, supplier relationships, order processing, and manual inventory movements. This project is intended as a foundational backend system for managing inventory in small to mid-sized businesses.
- Host: GitHub
- URL: https://github.com/sebaspallero/inventory-management-api
- Owner: Sebaspallero
- Created: 2025-04-03T18:45:58.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-04-30T18:46:40.000Z (about 1 year ago)
- Last Synced: 2025-08-29T06:15:00.083Z (10 months ago)
- Topics: backend, java, managment-system, springboot
- Language: Java
- Homepage:
- Size: 157 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Inventory Management System - Backend
This repository contains the **backend** of an Inventory Management System built with **Spring Boot**. It exposes a RESTful API to handle business logic and data operations such as product tracking, supplier management, order processing, and manual stock movements.
The backend is designed to serve as the core logic and data provider for the system. It can be consumed by any frontend or external system. A **frontend** client for this system is also available and can be found [here](https://github.com/Sebaspallero/inventory-managment-front).
## π Features
- **User Management**: Create and manage system users.
- **Product Management**: Register products with price and stock tracking.
- **Supplier Management**: Store and retrieve supplier data.
- **Order Management**: Create, view, update, and delete purchase orders linked to suppliers.
- **Order Items**: Each order includes one or more items, connected to products.
- **Inventory Movements**: Manually register `IN` (incoming) stock operations.
- **Stock Updates**: Stock levels are automatically updated when a movement is created.
- **Date-based Queries**: Retrieve orders or movements between date ranges.
- **User Authentication**: Register users with different roles: `EMPLOYEE` or `ADMIN`.
- **User Authorization**: Protect endpoints based on user role.
- **Export Data**: Export data from the system in PDF and Excel format.
- **Event Listener**: Record activities such as adding a product, creating an order, deleting a supplier, etc.
## π§ Tech Stack
- Java 17
- Spring Boot 3
- Spring Data JPA
- MySQL (or any SQL database)
- Spring Security + JWT
- MapStruct
- Maven
- Lombok
- Validation API
- JUnit & Mockito
- Postman for testing
- OpenApi for testing and visual endpoints.
## π¦ Entities Overview
### Product
- Basic unit with name, price, description, stock, etc.
- Connected to OrderItems and InventoryMovements.
### User
- Represents a system user performing inventory actions.
### Supplier
- Provides products.
- Linked to orders.
### Order & OrderItem
- Each order is placed to a supplier and contains multiple order items.
### InventoryMovement
- Manual stock movements (`IN`, `OUT`).
- Updates product stock on creation.
- Linked to both Product and User.
## π§ͺ Sample Endpoints
- `POST /api/orders` β Create a new order
- `GET /api/orders/{id}` β Retrieve order by ID
- `POST /api/movements` β Create a manual inventory movement
- `GET /api/products` β List all products
- `GET /api/movements/product/{productId}` β Get movements by product
## βοΈ Environment Configuration
Environment variables can be injected via `application.properties`:
```properties
spring.datasource.url=${DB_URL}
spring.datasource.username=${DB_USERNAME}
spring.datasource.password=${DB_PASSWORD}
jwt.secret=${JWT_SECRET}
```
Set variables in .vscode/launch.json or your environment before running the app.
## π§° How to Run
1. Clone the repo
2. Set up your database and configure environment variables
3. Build and run:
```bash
./mvnw spring-boot:run
```
## πRelated Repositories
- [Frontend Client - React App](https://github.com/Sebaspallero/inventory-managment-front).
## π OpenAPI Documentation
This project uses OpenAPI 2.8.6 and Swagger UI to provide interactive documentation for the REST API.
Once the application is running, you can access the Swagger UI at:
```bash
http://localhost:8080/swagger-ui/index.html
```
### π Available Documentation Endpoints
- Swagger UI: ```GET /swagger-ui/index.html```
- OpenAPI JSON: ```GET /v3/api-docs```
- OpenAPI YAML: ```GET /v3/api-docs.yaml```
## π« Contact
Feel free to reach out:
- GitHub: [@Sebaspallero](https://github.com/Sebaspallero)
- Email: sebastianpallerodev@gmail.com
β **Please consider giving it a star!** It helps visibility and motivates further development.