Skip to content

lauralesteves/java-springboot-exchanges

Repository files navigation

Java REST API Exchange


Description

A REST API built with Spring Boot 3 and Java 17 for managing currency/asset exchange accounts with age-based compliance rules and transaction limits.

The application allows users to register, create accounts on different exchanges, and manage balances; while enforcing that each exchange's minimum age requirement is met at account creation time.

Domain Model

  • User; registered individuals with username, date of birth, and document number (both unique).
  • Exchange; platforms that define a minimum age and a maximum transfer amount (e.g., "EurChange" requiring age 18 with a 5000 max transfer).
  • Account; links a user to an exchange with a balance. One account per user-exchange pair, created only if the user meets the exchange's age requirement.

API Endpoints

Method Endpoint Description
POST /api/users Create a new user
GET /api/users/{id} Retrieve user by ID
POST /api/exchanges Create a new exchange
GET /api/exchanges/{id} Retrieve exchange by ID
POST /api/accounts Create a new account
GET /api/accounts/{id} Retrieve account by ID
GET /api/accounts/user/{id} Retrieve all accounts for a user

Tech Stack

  • Spring Boot 3.2.5 with Spring Data JPA and Jakarta Validation
  • PostgreSQL 14 (Docker Compose) / H2 (tests)
  • MapStruct + Lombok for DTO mapping and boilerplate reduction
  • Springdoc OpenAPI for Swagger UI documentation
  • JUnit 5, Mockito, and TestRestTemplate for unit and integration tests
  • Gradle (Kotlin DSL) build system

Getting Started

Prerequisites

Before you begin, ensure you have met the following requirements:

  • Java 17
  • Docker (for database containerization)

Setup

  1. Clone the repository:
   git clone https://github.com/lauralesteves/java-springboot-exchanges.git
  1. Build the project:
   mvn clean install
  1. Execute Docker-compose:
   docker-compose up
  1. Just Run :
   mvn spring-boot:run

Configuration

The configuration for the project can be found in the application.properties file.


Mapper

The project includes an example mapper (ExampleMapper.java) that uses Mapstruct and Lombok for simplified mapping between entities and DTOs.


Docker

The Dockerfile (Dockerfile) is included for containerization. Build and run the Docker image to deploy the application in a containerized environment.


Unit Testing

Unfortunately, the test for this section did not pass ❌, but it is crucial for all projects. I'll do it later.


Monitoring

🚨 Monitoring is Essential!

While the monitoring setup is currently not in place (❌), I recognize its importance in ensuring the health and performance of the application. Rest assured, I'll be working on implementing a robust monitoring solution to keep track of key metrics, identify issues promptly, and ensure a smooth user experience.


CI/CD

🔄 Continuous Integration/Continuous Deployment (CI/CD) Coming Soon 🚨

I acknowledge the absence of CI/CD setup (❌) at the moment, but I want you to know that it's high on my priority list. Implementing CI/CD pipelines is crucial for automating the testing and deployment processes, ensuring code quality, and delivering updates seamlessly. Stay tuned for upcoming improvements in this area!


About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors