This is the backend API for the BreakToy Inventory Management system. Built with Spring Boot 3.4.5 and Java 21, it provides RESTful endpoints for managing product data and inventory metrics.
- Java 17+
- Maven 3.x
- Clone the repository
git clone https://github.com/RaymundoZa/BackEnd_BreakToy.git
cd BackEnd_BreakToyThe backend will be available in http://localhost:9090.
GET /productsReturns a list of all products (with optional filters for name, category, and stock).
POST /products
Content-Type: application/json{
"name": "Name of the product",
"category": "Category name",
"unitPrice": 123.45,
"quantityInStock": 10,
}PUT /products/{id}
Content-Type: application/json{
"name": "New Name",
"category": "New Category",
"unitPrice": 200,
"quantityInStock": 20,
}DELETE /products/{id}PUT /products/{id}/instock?quantity=10POST /products/{id}/outofstockGET /products/metricsReturns total stock, total value, average price, and category breakdowns.
src/main/java/com/example/inventory_backend/Product.java: Product ModelProductController.java: HTTP Endpoints (/products)
pom.xml: Maven configuration
- Uses Jakarta Bean Validation annotations (@NotNull, @Size, etc.)
- Global @ExceptionHandler returns structured field-level errors
To allow cross-origin request from the frontend (http://localhost:8080), we enabled a basico CORS filter in Spring Boot.
- JUnit 5 for unit tests (service layer)
- WebMvcTest for controller endpoint testing
- Uses Mockito and AssertJ for assertions and mocking
mvn test- Data is stored in memory (no database required)
- Designed for prototyping and local development
- Easily extendable with a real database using JPA
Raymundo Daniel Zamora Juárez
Encora SPARK Program · 2025