Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rapter1990/foreignexchangeexample
Case Study - Openpayd Foreign Exchange Example (Spring Boot, Java 21, Docker, Maven, JUnit Test, Integration Test, In-Memory Database (H2 Database), Github Actions, Spring Open Api, Mapstruct, Spring Cache, Resillience4j (Rate Limiter))
https://github.com/rapter1990/foreignexchangeexample
docker docker-compose dockerfile github-actions h2-database in-memory-database integration-test java21 junit mapstruct maven mockito monolith openapi rate-limiter resilience4j resttemplate spring-boot spring-cache
Last synced: 3 months ago
JSON representation
Case Study - Openpayd Foreign Exchange Example (Spring Boot, Java 21, Docker, Maven, JUnit Test, Integration Test, In-Memory Database (H2 Database), Github Actions, Spring Open Api, Mapstruct, Spring Cache, Resillience4j (Rate Limiter))
- Host: GitHub
- URL: https://github.com/rapter1990/foreignexchangeexample
- Owner: Rapter1990
- Created: 2024-08-09T15:26:31.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-08-11T11:45:24.000Z (5 months ago)
- Last Synced: 2024-11-07T08:03:27.947Z (3 months ago)
- Topics: docker, docker-compose, dockerfile, github-actions, h2-database, in-memory-database, integration-test, java21, junit, mapstruct, maven, mockito, monolith, openapi, rate-limiter, resilience4j, resttemplate, spring-boot, spring-cache
- Language: Java
- Homepage:
- Size: 3.19 MB
- Stars: 6
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Case Study - Foreign Exchange Example
### 📖 Information
- This project demonstrates a Spring Boot application for managing foreign exchange operations. It allows users to convert currencies, retrieve current exchange rates, and view conversion history.
- The application integrates with an external service provider for fetching exchange rates and performing currency conversion calculations.
- The application includes three main endpoints:
- Exchange Rate Endpoint: Fetches the current exchange rate between two currencies.
- Currency Conversion Endpoint: Converts a given amount from one currency to another and returns a unique transaction identifier.
- Conversion History Endpoint: Retrieves the history of currency conversions based on transaction identifiers or dates.
### Explore Rest APIs
Endpoints Summary
Method
Url
Description
Request Body
Path Variable
Response
POST
/api/v1/exchange-rate
Fetches the current exchange rate between two currencies.
ExchangeRateRequest
None
ExchangeRateResponse
POST
/api/v1/convert
Converts currency based on the provided ConvertRequest.
ConvertRequest
None
ConvertResponse
POST
/api/v1/history
Retrieves the conversion history based on the provided ConversionHistoryFilterRequest.
ConversionHistoryFilterRequest
None
CustomPage<ConvertHistoryResponse>
### Technologies
---
- Java 21
- Spring Boot 3.0
- Restful API
- Mapstruct
- Open Api (Swagger)
- Maven
- Junit5
- Mockito
- Integration Tests
- Docker
- Docker Compose
- CI/CD (Github Actions)
- Postman
- H2 Database (In-Memory)
- Spring Boot Actuator
- Spring Cache
- Resilience4j (Rate Limiter)
### Postman
```
Import postman collection under postman_collection folder
```
### Prerequisites
#### Define Variable in .env file for http://api.currencylayer.com/
```
EXCHANGE_API_API_KEY={EXCHANGE_API_API_KEY}
```
### Open Api (Swagger)
```
http://localhost:1331/swagger-ui/index.html
```
---
- Maven or Docker
---
### Docker Run
The application can be built and run by the `Docker` engine. The `Dockerfile` has multistage build, so you do not need to build and run separately.
Please follow directions shown below in order to build and run the application with Docker Compose file;
```sh
$ cd foreignexchangeexample
$ docker-compose up -d
```
If you change anything in the project and run it on Docker, you can also use this command shown below
```sh
$ cd foreignexchangeexample
$ docker-compose up --build
```
---
### Maven Run
To build and run the application with `Maven`, please follow the directions shown below;
```sh
$ cd foreignexchangeexample
$ mvn clean install
$ mvn spring-boot:run
```
---
### Docker Image Location
```
https://hub.docker.com/repository/docker/noyandocker/foreignexchangeexample/general
```
### Screenshots
Click here to show the screenshots of project
Figure 1
Figure 2
Figure 3
Figure 4
Figure 5
Figure 6
Figure 7
Figure 8
### Contributors
- [Sercan Noyan GermiyanoÄŸlu](https://github.com/Rapter1990)