This project was created as some use cases (CRUD and Transfer Money) sample for hexagonal architecture.
Here, you can reach my Medium article about Hexagonal (Ports & Adapter) Architecture.
This project provides endpoints for account domain CRUD actions and to transfer money from one account to another.
The Account service provides data like below:
Account:
- id
- Account id
- Account Name
- Account Owner
- Account Balance
- Creation Time
Transfer:
- Sender Account Id
- Receiver Account Id
- Amount
- Result
- Timestamp
If you like the solution, please don't forget to give a star ⭐ and follow me.
Thank you! ❤️
The service provides CRUD actions and money transfer endpoints
Create a new account
{
"accountId": "123456789",
"name": "Main Account",
"owner": "John Doe",
"balance": 650
}
{
"id": 1,
"accountId": "123456789",
"name": "Main Account",
"owner": "John Doe",
"balance": 650,
"createdAt": "2020-10-11T20:56:59.606932Z"
}
Retrieve a list of all accounts
{
"accounts":[
{
"id":1,
"accountId":"123456789",
"name":"Main Account",
"owner":"John Doe",
"balance":650,
"createdAt":"2020-10-11T20:56:59.606932Z"
},
{
"id":2,
"accountId":"123456788",
"name":"Saving Account",
"owner":"Jane Doe",
"balance":750,
"createdAt":"2020-10-03T20:41:16.517256Z"
}
]
}
Retrieve account by id
{
"id":1,
"accountId":"123456789",
"name":"Main Account",
"owner":"John Doe",
"balance":650,
"createdAt":"2020-10-11T20:56:59.606932Z"
}
Deletes account by id
Transfers money from one account to another
{
"senderAccountId":"123456788",
"receiverAccountId":"123456789",
"amount":25
}
{
"id": 1,
"senderAccountId": "123456788",
"receiverAccountId": "123456789",
"amount": 25,
"result": "SUCCESSFUL",
"timeStamp": "2020-10-03T20:41:16.799826Z"
}
- Java 11
- Maven 3.6
- Spring Boot 2
- Lombok
- Flyway
- H2 Database
- Docker
- SwaggerUI
- RestAssured
- Junit 5
Always use the Maven wrapper to build the project from command line.
App runs default 8080
port. http://localhost:8080/
Fully clean and install dependencies
Runs tests
Compiles application
Creates package of application
After you create package of the application, in the path of the application on terminal, write the command which is below to run application.
Starts application
-
This is a simple sample application.
-
When the application runs 2 dummy accounts inserting DB:
- 123456788
- 123456789
-
Some account service endpoints are created as example.
-
Only functional tests added.