This project provides APIs for a banking system backend with the following functionalities:
-
Bank Account Management
- Create and manage bank accounts.
- Bank accounts consist of:
- Owner’s Name
- Balance
- Currency
-
Transaction Records
- Record every balance change for each account.
- Create an account entry record for every deposit, withdrawal, or transfer.
-
Money Transfers
- Perform money transfers between two accounts.
- Ensure transactional integrity: updates to both accounts occur together, or none of the updates are applied.
-
Docker
For running postgres image. -
TablePlus
A GUI tool for interacting with the database. -
Golang
The programming language used for backend development.
-
Migrate
Used for database schema migrations.Installation:
curl -L https://packagecloud.io/golang-migrate/migrate/gpgkey | apt-key add - echo "deb https://packagecloud.io/golang-migrate/migrate/ubuntu/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/migrate.list apt-get update apt-get install -y migrate
-
Sqlc
Used to generate type-safe Go code from SQL queries.Installation:
sudo snap install sqlc
-
Gomock
Used for generating mock objects for unit testing.Installation:
go install github.com/golang/mock/mockgen
-
Install Dependencies
Ensure all tools mentioned above are installed on your system. -
Run Migrations
Usemigrate
to apply database migrations. For example:migrate -path db/migrations -database "postgres://user:password@localhost:5432/dbname?sslmode=disable" up
-
Run Tests
To run tests:make test
-
Build and Run the Application
To run the application and start the server:make server
- Follow the Git workflow for feature development.
- Ensure your code is covered by unit tests.
- Run all tests before submitting a pull request.
This README serves as a guide for setting up and understanding the Banking System project.