-
A backend API to imitate how a bank transfer transaction takes place
-
Handled data inconsistency and potential deadlocks for concurrent transactions
-
Create and manage account
- Owner, balance and currency
-
Record all balance changes
- Create an account entry for each change
-
Money transfer transaction
- Perform money transaction between 2 accounts consistently within a transaction
- Start the services
make dc-up
- Stop the servcies
make dc-down
- Clone the repository
git clone https://github.com/skamranahmed/banking-system.git
- Create a
banking-system-network
in Docker
make create-bank-network
- Setup Postgres via Docker
make setup-postgres
- Create
bank
db andbank_test
db in Postgres
make create-db
- Download the project dependencies via the below command
make download
- Migrate the DB Schema using the SQL Script
For this I have used the
golang-migrate
library. You will first have to install this package.
For MacOS
brew install golang-migrate
For other OS or kernels, refer this: https://github.com/golang-migrate/migrate/tree/master/cmd/migrate
Once the installation is done, run the below commands:
- To migrate the database schema for the
bank
db:
make migrate-up
- To migrate the database schema for the
bank_test
db:
make migrate-up-test
- Configuring the environment variables
Make sure you are in the banking-system
root directory.
cp config/localConfigSample.yaml config/localConfig.yaml
- Run the server
- Non-dockerized:
make run
- Dockerized:
- Build the docker image for the backend service:
make build
- Run the docker image for the backend service:
make dockerized-server-run