All projects

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

  1. Product CRUD

    Five endpoints: list, read, create, update and delete, with appropriate HTTP responses through ResponseEntity.

  2. Products per user

    Two dedicated endpoints to list and create a user’s products, through a ManyToOne relation.

  3. JPA model

    Column constraints (not null, length), creation date set by @PrePersist, and the relation hidden from serialization to avoid JSON loops.

  4. 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.

API layers
  1. ClientHTTP · JSON
  2. Controller7 endpoints
  3. Service
  4. RepositorySpring Data JPA
  5. 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 proves

The 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