Skip to content

Clean & scalable Spring Boot API built as a hands-on learning project using Docker, PostgreSQL, JPA, and Swagger.

Notifications You must be signed in to change notification settings

Pablyco/MiniaturesApp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🌟 Miniatures Management API

A clean & scalable Spring Boot REST API for managing clients and sales

Spring boot 3.X Java 17 Build Maven JUNIT 5 Docker Ready Swagger PostgreSQL


Note

This project was developed as a hands-on learning experience focused on building clean, scalable backend services using Spring Boot, Docker, PostgreSQL, and modern development practices.


Features

Clients

  • Create, update, delete clients
  • List all clients
  • Get a client with all their sales
  • DTO-based request/response structure
  • Fully validated inputs

Sales

  • Create sales for any client

  • Filter sales by:

    • Date range
    • Price range
    • Client
  • DTO-based request/response structure

  • Service layer separation

Spring Security + JWT Authentication

  • Spring Security integration
  • JWT-based authentication 🚧 WIP 🚧
  • Endpoint protection and role-based access

Documentation

  • Full Swagger / OpenAPI auto-generated docs
  • Clear project structure
  • DTOs, entities, services fully separated

Tests

  • Mockito service tests
  • JUnit 5 unit tests
  • MockMvc controller tests

Docker & Deployment

This project is fully Dockerized and ready for deployment.

  • Uses eclipse-temurin:17-jdk as the base image
  • Includes a production-ready Dockerfile
  • Successfully tested on cloud platforms such as Render

Project Structure

src/main/java/com.example.miniatures
├── controller
├── dto
│   ├── miniatureClient
│   └── miniatureSale
├── exception
├── model
│   ├── enums
├── repository
├── security
├── service
└── MiniaturesApplication.java

API Overview

Client Endpoints

Method Endpoint Description
POST /clients Create new client
GET /clients List all clients
GET /clients/{id} Get client info
GET /clients/{id}/sales Get client sales
PUT /clients/{id} Update client
DELETE /clients/{id} Delete client

Sales Endpoints

Method Endpoint Description
POST /sales Create new sale
GET /sales List or filter sales
GET /sales/latest List latest 10 sales
GET /sales/{id} Get sale by ID
PUT /clients/{id} Update sale
DELETE /clients/{id} Delete sale

Sales Filtering Examples

Basic

GET /sales?clientId=1

Full filters

GET /sales?clientId=1&minPrice=20&maxPrice=200&startDate=2024-01-01&endDate=2024-12-31

Running Tests

mvn test

Launching the App

mvn spring-boot:run

Once running, open Swagger:

👉 http://localhost:8080/swagger-ui/index.html


Database Config (H2 Example)

spring.datasource.url=jdbc:h2:mem:miniatures
spring.jpa.hibernate.ddl-auto=update
spring.h2.console.enabled=true

H2 console:

http://localhost:8080/h2-console

Database Config (PostgreSQL Example)

spring.datasource.url=${DB_URL}
spring.datasource.username=${DB_USERNAME}
spring.datasource.password=${DB_PASSWORD}

spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
spring.jpa.properties.hibernate.format_sql=true

Example JSON

Create Client

{
  "name": "John Example",
  "email": "john@example.com",
  "phone": 5551234
}

Create Sale

{
  "name": "Space Marine",
  "price": 20,
  "saleDate": "2025-01-11",
  "scale": "MEDIUM_100MM",
  "type": "WARHAMMER",
  "clientId":1
}

Tech Stack

Layer Technology
Backend Spring Boot 3
Language Java 17
Docs Springdoc OpenAPI
Database PostgreSQL + H2 for tests
Build Maven
Tests JUnit 5 + Mockito
Deploy Docker

📄 License

MIT License — free to use, modify, and distribute.


Pablyco :)

About

Clean & scalable Spring Boot API built as a hands-on learning project using Docker, PostgreSQL, JPA, and Swagger.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published