Skip to content

Navigation Menu

Sign in
Sign up

Latest commit

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date

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

Layer Technology
Framework Spring Boot 3
Language Java 17
Database H2 (in-memory) / PostgreSQL-ready
ORM Spring Data JPA / Hibernate
Docs SpringDoc OpenAPI (Swagger UI)
Build Maven

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

Method Path Description
GET /api/items List all items
GET /api/items/{id} Get item by ID
POST /api/items Create 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

AltStyle によって変換されたページ (->オリジナル) /