A banking microservice based on hexagonal architecure.

1. Banking Microservice

Design Decisions

1. Hexagonal Architecture.
2. REST Api.
3. Dependency Injection.
4. Database Transactions.
5. Structured Error Library.
6. Concurrent Server with Graceful Shutdown.
7. Distributed Logging.

Tools Used

1. Go
2. Postgres
3. Docker

Libraries Used

1. Pgx (Postgres Driver)
2. Gorilla/Mux (Routing)
3. Validator (JSON Validatin Middleware)

Routes

1. GetAllCustomers:     GET     /customers?status=
2. GetCustomer:         GET     /customers/:id
3  NewAccount:          POST    /customers/:id/accounts
4. NewTransaction:      POST    /customers/:id/account/:account_id

Data Exchange Format

1. JSON (REST)
2. CSV (Database bulk insert)

Models

1. Customer:
    - id: bigserial
    - name: string
    - date_of_birth: date
    - city: string
    - zipcode: string
    - status: small int

2. Accounts:
    - id: int
    - customer_id: int
    - opening_date: timestamp
    - amount: decimal
    - account_type: string

4. Users:
    - id: bigserial
    - username: string
    - password: string
    - role: string

3. Transactions:
    - id: bigserial
    - account_id: int
    - type: string
    - amount: decimal
    - transacation_date: timestamp

Services

1. Customer:
    - Get All Customers By Status
    - Get Customer By Id

2. Account:
    - New Account
    - Get Account By account_id
    - Get all accounts by account_id and customer_id

3. Transaction:
    - New Transaction

2. Auth Microservice

Auth Policy

1. Role based access control.
2. JWT based authentication.
3. JWT based authorization.
4. JWT based token verification.
5. JWT based token refresh(TODO).

JWT Auth Process

1. (user -> auth-server) login request.
2. (auth-server -> user) token in response.
3. (user -> banking-server) request resource with token.
4. (banking server -> auth server) verify the token.
5. (auth-server -> banking-server) token verification response.
6. (bankng-server -> user) resource response.

Routes

1. GetAllCustomers:     GET     /customers
2. GetCustomer:         GET     /customers/:id
3  NewAccount:          POST    /customers/:id/accounts
4. NewTransaction:      POST    /customers/:id/account/:account_id

RBAC

1. Role: admin  -> All.
2. Role: user   -> GetCustomer & NewTransaction.

Verification Process

1. Validity of the token(include expiry time and signature).
2. Verify if the role has access to the resource.
3. vefify if the resource being accessd by same user.

Overall Project Status - Ongoing

Owner
Ashef Habib Tishad
Jack of all trades, master of One!
Ashef Habib Tishad
Similar Resources

A Microservice Toolkit from The New York Times

A Microservice Toolkit from The New York Times

Gizmo Microservice Toolkit This toolkit provides packages to put together server and pubsub daemons with the following features: Standardized configur

Jan 7, 2023

Go products microservice

Golang Kafka gRPC MongoDB microservice example 👋 👨‍💻 Full list what has been used: Kafka - Kafka library in Go gRPC - gRPC echo - Web framework vip

Dec 28, 2022

Kratos is a microservice-oriented governance framework implements by golang

Kratos is a microservice-oriented governance framework implements by golang

Kratos is a microservice-oriented governance framework implements by golang, which offers convenient capabilities to help you quickly build a bulletproof application from scratch.

Dec 27, 2022

Modern microservice web framework of golang

Modern microservice web framework of golang

gogo gogo is an open source, high performance RESTful api framework for the Golang programming language. It also support RPC api, which is similar to

May 23, 2022

a microservice framework for rapid development of micro services in Go with rich eco-system

a microservice framework for rapid development of micro services in Go with rich eco-system

中文版README Go-Chassis is a microservice framework for rapid development of microservices in Go. it focus on helping developer to deliver cloud native a

Dec 27, 2022

A Microservice Toolkit from The New York Times

A Microservice Toolkit from The New York Times

Gizmo Microservice Toolkit This toolkit provides packages to put together server and pubsub daemons with the following features: Standardized configur

May 31, 2021

Kratos is a microservice-oriented governance framework implements by golang,

Kratos is a microservice-oriented governance framework implements by golang,

Kratos is a microservice-oriented governance framework implements by golang, which offers convenient capabilities to help you quickly build a bulletproof application from scratch.

Dec 31, 2022

User management microservice written in Go with Postgres

user-registration-service-go Simple user registration microservice written in Go with Postgres database. Uses clean architecture to accept requests fr

Nov 24, 2022

Social previews generator as a microservice.

Social previews generator as a microservice.

ogimgd Social previews generator as a microservice. Can be used to generate images for og:image meta-tag. It runs as an HTTP server with a single endp

Sep 17, 2022
Go microservice tutorial project using Domain Driven Design and Hexagonal Architecture!

"ToDo API" Microservice Example Introduction Welcome! ?? This is an educational repository that includes a microservice written in Go. It is used as t

Jan 4, 2023
Authentication-microservice - Microservice for user authentication built with golang and gRPC

Authentication-microservice - Microservice for user authentication built with golang and gRPC

May 30, 2022
Microservice - A sample architecture of a microservice in go

#microservice Folder structure required. service certs config config.yaml loggin

Feb 3, 2022
Microservice - Microservice golang & nodejs
Microservice - Microservice golang & nodejs

Microservice Gabungan service dari bahasa pemograman go, nodejs Demo API ms-auth

May 21, 2022
Customer-microservice - Microservice of customer built with golang and gRPC

?? Building microservices to manage customer data using Go and gRPC Command to g

Sep 8, 2022
Hexagonal Architecture implemented in GO

MSGO - Microservices in Go Hexagonal Architecture (Ports & Adapter) Wiki: Hexagonal Architecture Architecture benefits: loosely coupled interchangeabl

Aug 14, 2022
🚀 link shortener which is using hexagonal architecture in Go

?? go-link-shortener-hexagonal Link Shortener which is using Hexagonal Architecture that compliant with clean code guidelines in Go. ├── README.md ├──

Feb 26, 2022
Hexagonal architecture bank account example

Hexagonal architecture bank account example Esse repositório contém um pouco dos meus estudos sobre arquitetura hexagonal. Go Lang é a linguagem utili

Jan 8, 2022
A microservice gateway developed based on golang.With a variety of plug-ins which can be expanded by itself, plug and play. what's more,it can quickly help enterprises manage API services and improve the stability and security of API services.
A microservice gateway developed based on golang.With a variety of plug-ins which can be expanded by itself, plug and play. what's more,it can quickly help enterprises manage API services and improve the stability and security of API services.

Goku API gateway is a microservice gateway developed based on golang. It can achieve the purposes of high-performance HTTP API forwarding, multi tenant management, API access control, etc. it has a powerful custom plug-in system, which can be expanded by itself, and can quickly help enterprises manage API services and improve the stability and security of API services.

Dec 29, 2022
Go gRPC RabbitMQ email microservice

Go, RabbitMQ and gRPC Clean Architecture microservice ?? ??‍?? Full list what has been used: GRPC - gRPC RabbitMQ - RabbitMQ sqlx - Extensions to data

Dec 29, 2022