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.
- 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
orADMIN
. - 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.
- 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.
- Basic unit with name, price, description, stock, etc.
- Connected to OrderItems and InventoryMovements.
- Represents a system user performing inventory actions.
- Provides products.
- Linked to orders.
- Each order is placed to a supplier and contains multiple order items.
- Manual stock movements (
IN
,OUT
). - Updates product stock on creation.
- Linked to both Product and User.
POST /api/orders
– Create a new orderGET /api/orders/{id}
– Retrieve order by IDPOST /api/movements
– Create a manual inventory movementGET /api/products
– List all productsGET /api/movements/product/{productId}
– Get movements by product
Environment variables can be injected via application.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.
-
Clone the repo
-
Set up your database and configure environment variables
-
Build and run:
./mvnw spring-boot:run
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:
http://localhost:8080/swagger-ui/index.html
- Swagger UI:
GET /swagger-ui/index.html
- OpenAPI JSON:
GET /v3/api-docs
- OpenAPI YAML:
GET /v3/api-docs.yaml
Feel free to reach out:
- GitHub: @Sebaspallero
- Email: sebastianpallerodev@gmail.com
⭐ Please consider giving it a star! It helps visibility and motivates further development.