Skip to content

Latest commit

 

History

History
82 lines (61 loc) · 1.95 KB

File metadata and controls

82 lines (61 loc) · 1.95 KB

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