Skip to content

Bank transactions RESTful API with microservices architecture following the Test-driven development methodology

License

Notifications You must be signed in to change notification settings

aaabdyrahmanov/bank-transactions-api

Repository files navigation

Bank-transactions RESTful API

Local Bank service asynchronously synchronizes the Third-Party Provider to retrieve the user transactions. To get the data in an asynchronous manner, both services use notification service as their communication channel. API Gateway is a mechanism for providing an entry point on both Local Bank and TPP Transaction services. Bank Transactions API built following the Test-Driven Approach.

The Key Project Concepts

We have included the following concepts/guidelines on the multiple service based Bank Transactions API:

  • Asynchronous communcation: services communicate in an asynchronous manner using AMQP protocol to exchange messages via a message broker (RabbitMQ).
  • API gateway: a mechanism for providing an entry point for clients.
  • DevOps: a mechanism for handling continuous integration (CI)
  • Loose coupling: services are independent of each other, one can update and deploy each service without affecting the others.
  • Single responsibility: each service does only one thing.
  • Standard/Synchronous communication: services communicate with each other through rest APIs

Getting Started

Following instructions will get you a copy of the project up and running on your local machine for the development and testing purposes.

Requirements

There are two ways of running the project in your local machine.

  1. Using yarn as a package manager:
  • Install local Node.js environment
  • Install Package manager to manage packages yarn
  • Install local db MongoDB
  1. Using docker-compose for running a multi-container Docker apps:

Setup environment variables

.env file in the root of the project need to be created and variables should be inserted as a key/value pairs in the following format of KEY=VALUE:

# move into the root project folder
cd bank-transactions-api

# rename the .env.sample
mv .env.example .env

Running the project

Project can be executed in the following two ways:

1. Using yarn

Scripts for Installation, development and testing purposes

# move into the root project folder and go for the specific service
cd bank-transactions-api/services/local-bank

# Install the necessary packages for the specific service
yarn install

# Run the service in development mode
yarn run dev

# Run the service in production mode
yarn run start

# Run test cases
yarn run test

# Collect test coverage
yarn run coverage

2. Using docker and docker-compose

Commands for running and getting the details of the services.

# Build and run the services
docker-compose up -d --build
# List containers
docker ps
# Get logs
docker-compose logs

Running Tests

There are two ways of running the tests on your local machine.

  1. To run each microservice tests one by one, go to the respective service directory where the package.json is located and run tests.

For example: to run the tests for the banking-service

cd banking-service
yarn test
  1. To run all tests for the entire microservices, execute a file 'run_all_tests' which is included test running scripts that has been created in the root directory.
# run the test cases
./run_all_tests

NOTE: If there is sudo: ./run_all_tests: command not found notification then make sure that you have set necessary executable permission of a file on your local machine. To do that:

# set file execute permission
chmod +x run_all_tests 

# run the test cases
./run_all_tests

Testing Environment

Available endpoints for services and their functions included in the Documentation folder. They can be tested using their belonging Postman Collections. Postman Collection - Local bank OR Postman Collection - TPP Transaction

Built With

License

Distributed under the MIT License. See LICENSE for more information.

About

Bank transactions RESTful API with microservices architecture following the Test-driven development methodology

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published