Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

4 Commits

Repository files navigation

Spring Boot REST API

A layered REST API built with Spring Boot 3, demonstrating clean architecture with proper separation between Controller, Service, and Repository layers.


Stack

LayerTechnology
FrameworkSpring Boot 3
LanguageJava 17
DatabaseH2 (in-memory) / PostgreSQL-ready
ORMSpring Data JPA / Hibernate
DocsSpringDoc OpenAPI (Swagger UI)
BuildMaven

Architecture

HTTP Request
│
▼
┌─────────────┐
│ Controller │ → Handles HTTP, delegates to service
└──────┬──────┘
│
▼
┌─────────────┐
│ Service │ → Business logic, validation
└──────┬──────┘
│
▼
┌─────────────┐
│ Repository │ → Data access via Spring Data JPA
└──────┬──────┘
│
▼
Database

Running Locally

Requirements: Java 17+, Maven 3.8+

git clone https://github.com/cherohn/Spring-Basic-REST-API.git
cd Spring-Basic-REST-API
mvn spring-boot:run

Access Swagger UI at: http://localhost:8080/swagger-ui.html


Endpoints

MethodPathDescription
GET/api/itemsList all items
GET/api/items/{id}Get item by ID
POST/api/itemsCreate new item
PUT/api/items/{id}Update item
DELETE/api/items/{id}Delete item

What I Learned

  • How Spring's dependency injection connects the layers without tight coupling
  • How JPA maps Java objects to database tables and handles queries automatically
  • How to document APIs with OpenAPI so they're immediately usable by other developers

Author

Matheus Garcezgithub.com/cherohn · linkedin.com/in/matheus-garcez-172377249

About

Layered REST API with Spring Boot 3, JPA, PostgreSQL and OpenAPI docs

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages