Simplest banking service I could think of using some good practices.
- Clone this project
- Install dependencies using
yarnornpm install
git clone git@github.com
cd simplest-banking
yarnThis application is still under development, some details are still missing
Use this route to reset the service state
Request
POST /resetResponse
Status: 200 OKReturns the balance from account
Request
GET /balance?account_id=1234| Parameter | Type | Description |
|---|---|---|
account_id |
string |
Required. Id of item to fetch |
Response - existing account
Status: 200 OK
20Response - non-existing account
Status: 404 Not Found
0Make an account transaction
Request
POST /event| Event | Description |
|---|---|
deposit |
deposit fund to account |
transfer |
transfer from origin account to destination account |
withdraw |
withdraw fund from account |
Response - Create account with initial balance
Status: 201 Created
{"destination": {"id":"100", "balance":10}}Response - Deposit into existing account
Status: 201 Created
{"destination": {"id":"100", "balance":20}}Response - Withdraw from non-existing account
Status: 404 Not found
0Response - Withdraw from existing account
Status: 201 Created
{"origin": {"id":"100", "balance":15}}Response - Transfer from existing account
Status: 201 Created
{"origin": {"id":"100", "balance":0}, "destination": {"id":"300", "balance":15}}Response - Transfer from non-existing account
Status: 404 Not found
0| Parameter | Type | Description | Required |
|---|---|---|---|
type |
string |
deposit | yes |
destination |
number |
account id where it will be deposited | yes |
amount |
number |
amount to be to be transacted | yes |
Sample
{"type":"deposit", "destination":"100", "amount":10}
| Parameter | Type | Description | Required |
|---|---|---|---|
type |
string |
withdraw | yes |
origin |
number |
account id where it will be withdrawn | yes |
amount |
number |
amount to be to be transacted | yes |
Sample
{"type":"withdraw", "origin":"100", "amount":5}
| Parameter | Type | Description | Required |
|---|---|---|---|
type |
string |
transfer | yes |
origin |
number |
account id where it will be withdrawn | yes |
destination |
number |
account id where it will be deposited | yes |
amount |
number |
amount to be to be transacted | yes |
Sample
{"type":"transfer", "origin":"200", "amount":15, "destination":"300"}
The service uses typescript, so it is necessary to build
yarn build
yarn startTo run tests, run the following command
yarn testmodules/account domain entities events exceptions
application commands queries exceptions event-handlers
infrastructure database
