Categorygithub.com/GiorgiMakharadze/bank-API-golang
modulepackage
0.0.0-20231030235526-e81f0ddf291f
Repository: https://github.com/giorgimakharadze/bank-api-golang.git
Documentation: pkg.go.dev

# README

Bank Service

License: MIT

Bank is a backend service that provides gRPC APIs to the frontend, facilitating the following functionalities:

  1. Create and Manage Bank Accounts: Users can create bank accounts with details including owner’s name, balance, and currency.
  2. Record Balance Changes: The service records every transaction that results in a balance change, creating an account entry record for each such instance.
  3. 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.
  4. User Authentication: Authenticates users and ensures that they can only access and manage their own accounts.
  5. 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

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