# README
Bank Service
Bank is a backend service that provides gRPC APIs to the frontend, facilitating the following functionalities:
- Create and Manage Bank Accounts: Users can create bank accounts with details including owner’s name, balance, and currency.
- Record Balance Changes: The service records every transaction that results in a balance change, creating an account entry record for each such instance.
- Money Transfer: Enables users to perform money transfers between two accounts within a transaction, ensuring that either both accounts’ balances are updated successfully, or none of them are.
- User Authentication: Authenticates users and ensures that they can only access and manage their own accounts.
- Role-based Functionality: The service includes role-based access control, with specific roles such as "banker" and "depositor". There are several ways to create a banker user. You can create the first banker user either via a DB migration, or a script that runs on the production server. Once the first banker user is created, they can access an API that allows them to create other banker users.
Used Technologies
The project utilizes the following technologies:
- Golang
- gRPC
- PostgreSQL
- Redis
- SQLC
- Asynq
Setup Local Development
Install Tools
- Docker Desktop: Installation Guide
- TablePlus: Installation Guide
- Golang: Installation Guide
- Migrate:
sudo install golang-migrate
- DB Docs:
npm install -g dbdocs dbdocs login
- DBML CLI:
npm install -g @dbml/cli dbml2sql --version
- Sqlc:
brew install sqlc
- Gomock:
go install github.com/golang/mock/[email protected]
Setup Infrastructure
- Create Bank Network:
make network
- Start Postgres Container:
make postgres
- Create Bank Database:
make createdb
- Run Database Migrations:
make migrateup make migratedown
Documentation
- Generate DB documentation:
make db_docs
- Access the DB documentation at Swagger Hub or at
localhost:8080/swagger
when you run the app locally.
Code Generation
- Generate Schema SQL File with DBML:
make db_schema
- Generate SQL CRUD with Sqlc:
make sqlc
- Generate DB Mock with Gomock:
make mock
- Create a New DB Migration:
make new_migration name=<migration_name>
How to Run
- Run Server:
make server
Alternatively, if you have Docker installed on your local machine, you can simply run:
docker compose up
- Run Tests:
make test
# Packages
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Package pb is a reverse proxy.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author