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.
- 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.
| 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 |
- 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
Before you begin, ensure you have met the following requirements:
- Java 17
- Docker (for database containerization)
- Clone the repository:
git clone https://github.com/lauralesteves/java-springboot-exchanges.git- Build the project:
mvn clean install- Execute Docker-compose:
docker-compose up- Just Run :
mvn spring-boot:runThe configuration for the project can be found in the application.properties file.
The project includes an example mapper (ExampleMapper.java) that uses Mapstruct and Lombok for simplified mapping between entities and DTOs.
The Dockerfile (Dockerfile) is included for containerization. Build and run the Docker image to deploy the application in a containerized environment.
Unfortunately, the test for this section did not pass ❌, but it is crucial for all projects. I'll do it later.
🚨 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.
🔄 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!