Backend & web applications
Product Management API · Spring Boot
A Spring Boot 4 REST API for product management, in controller, service, repository and model layers, with products linked to their users.
- Individual project
- REST endpoints
- 7
- related entities: product and user
- 2
- Spring Boot version
- 4.0
01Starting point
Context & mission
The problem
Before building more ambitious backends, you need to master the fundamentals: a clear REST contract, layers that do not mix, and a well-mapped JPA model.
The mission
Build a clean CRUD API on two related entities, products and users, with Spring Boot, Spring Data JPA and MySQL.
My role
Designed and built on my own.
02Execution
What I did
Product CRUD
Five endpoints: list, read, create, update and delete, with appropriate HTTP responses through ResponseEntity.
Products per user
Two dedicated endpoints to list and create a user’s products, through a ManyToOne relation.
JPA model
Column constraints (not null, length), creation date set by @PrePersist, and the relation hidden from serialization to avoid JSON loops.
Separate layers
Distinct controllers, services and Spring Data JPA repositories for products and users.
03Design
Architecture
Layered architecture: the REST controller receives JSON, the service holds the logic, the Spring Data JPA repository reaches MySQL through Hibernate.
- ClientHTTP · JSON
- Controller7 endpoints
- Service
- RepositorySpring Data JPA
- MySQLHibernate
04Impact
Results
- A complete product CRUD API, plus per-user routes.
- A constrained JPA model, with no serialization loops.
05Wrap-up
Takeaways
What this project provesThe basics I apply to every Java backend: clean layers, a readable REST contract, a rigorous JPA model.
06Technology
Full stack
- Java 17
- Spring Boot 4
- Spring Web MVC
- Spring Data JPA
- Hibernate
- MySQL
- Maven