Skip to content

majidmohsenifar/heli-tech

Repository files navigation

Heli-Tech test project

this project is a simple transaction manager system developed in micro-services.

Services

  • Gateway-Service
  • User-Service
  • Transaction-Service
  • Notification-Service

Gateway-Service

  • Gateway-Service is a service that acts as a gateway for all the services. it exposes a rest API and calls other services using GRPC.
  • the rest API is developed using golang gin router.
  • this service also serves the swagger.

User-Service (or Auth-Service)

  • this is a service that manages user related APIs.
  • it serves requests using grpc.
  • it also handle the auth using JWT.

Transaction-Service

  • this is a service that manages deposits and withdraws.
  • it serves requests using grpc.
  • it also sends events to kafka after each deposit or withdraw.

Notification-Service

  • this is a service that manages sending notifications to users.
  • it is a consumer of kafka messages.
  • messages related to deposits and withdraws.

Data-contracts

this directory contains all the proto files related to grpc and also message broker types.

How to run the project

you need to have docker and docker-compose installed on your machine.

how to check the flow using swagger

  • you need to register first
  • then login
  • then authorize in swagger
  • then you can call the transaction routes like deposit, withdraw, and transactions-list

tests

User-Service, Transaction-Service and Notification-Service has unit and integrations tests

  • unit tests are located in each package in service layer
  • integration tests are located in tests directory in each service

locking mechanism

as the deposits and withdraws can be called in parallel, the Transaction-Service uses a locking mechanism. the locking mechanism is provided by redis.

Other considerations

  • if you have new macbook with arm chip, you may change the kafka image in docker-compose.yml line 95.
  • each services directory structure consists 3 main layers, handler, service and repository.
  • handler layer is responsible for the requests and response and also consuming from message brokers.
  • service layer is responsible for the bussiness logic and can be called by handler layer.
  • repositry layer is responsible for data access and read and write to database, the repo methods are called by service layer.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages