bank-server

command module
v0.0.0-...-10b8bc0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 25, 2022 License: MIT Imports: 5 Imported by: 0

README

Bank Server

Backend Server for a bank Infrastructure (Go and Postgres)

docker image

RoadMap + Learnings

  • Design Database Schema Table Schema
  • Create a postgres instance using docker and docker volume using docker-compose.yaml file
  • Connect to a Postgres instance
  • Create Tables In DB using sql file Future Improvements:
    • use SQLC to make queries
  • Make CRUD API for accounts table
  • Write Unit test for the API's
  • Dockerize (create a docker image) for the go app and db See Dockerfile here
  • Create CI using Github Actions on master branch
    • Push Docker Image to AWS ECR via actions
    • Run go build and test
    • Add Datree in CI for misconfig checking
  • Handle DB Transactions use the idea
BEGIN
if Succeed
    COMMIT
else
    ROLLBACK
  • Deploy on Kubernetes using AWS EKS and

    • Install Kubecost for cost management
    • install ArgoCD for GitOps
  • Setup Monitoring Using Prometheus steps

  • Write Unit Tests by using gomock to mock DB.

  • Create Docker Network to let the image connect with the db docker network create bank-network docker network connect bank-network postgres12

  • Make Auth API using PASETO ( also support extension for JWT )

  • Use UUID to store transaction data in DB.

TODO

  • Handle race condition in transaction.
  • Handle deadlock in DB due to multiple threads of transaction
  • Create UI form for login signup
  • Create a UI for the user to access the Transactions
  • Create Policy engine for Permission on a Account

How to Use ?

  • Makefile has necessary commands
Pre-requisite :
  • go1.16 or above installed
    • docker
    • make command
  1. Install essential go modules
  2. run make postgres for making a postgres db using DOCKER
  3. Connect to the DB using user: admin and password: password and db = default_db.
  4. run the bank-server.sql file to create db tables.
  5. run make server the server will be up and running on localhost:8080
  • POST /account for creating a new account
{
    "owner_email":"[email protected]",
    "currency":"USD"
}
  • GET /account?owner_email=[email protected] for gettiing account details using email
  • POST /transfer for transferring money to other bank account
{
    "from_account_id": 2,
    "to_account_id": 1,
    "amount": 15
}

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
api
sqlc
Package db is a generated GoMock package.
Package db is a generated GoMock package.
store
Package store is a generated GoMock package.
Package store is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL