backend

module
v0.0.0-...-5e1236a Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2023 License: MIT

README

Go-Marketplace backend

Quickstart

To run app via docker containers, use the command:

docker compose up

If you want to use nightly images, you can pull and run all images from dockerhub:

To run unit tests:

make test

Architecture

The backend features an intricate microservices architecture, with each service having its own database and seamless interaction through APIs. For detailed APIs, check the /proto folder

The server component uses the grpc protocol, enabling exclusive communication among microservices through grpc. Users can choose between grpc and the Restful API via the grpc-gateway mechanism

  • The user service is vital for storing and modifying user information

  • The cart service manages cart details and items, addressing prolonged product storage with a worker. The worker, accessing Redis, cleans up the cart and returns products periodically

  • The product service is key for managing product information, ensuring product deletions reflect in associated cart items. Also the service stores information about the discount in Redis with a user-defined life time

  • The order service oversees order data, allowing status changes and user order cancellations within 24 hours. Upon order or part deletion, all products are returned

  • The gateway service acts as a user facade and authorizes requests, directing them to the necessary microservices for streamlined system functionality

Docs

All project documentation is in the /docs folder, e.g. swagger documentation, ER diagrams and so on

Also, when you run the application under the path /api/v1/swagger, you can see the swagger ui and play around with the application api

Dependencies

gprc protocol was used for server and client side, also from grpc ecosystem I used grpc-gateway and protoc

For unit tests:

To work with the databases:

For working with configuration files: cleanenv

Logger: zerolog

Linters:

Swagger: swaggerui

RBAC: gorbac

Validation: validator

JWT: jwt-go

License

Directories

Path Synopsis
cart
cmd
internal/mocks/repo
Package mock_interfaces is a generated GoMock package.
Package mock_interfaces is a generated GoMock package.
internal/mocks/usecase
Package mock_usecase is a generated GoMock package.
Package mock_usecase is a generated GoMock package.
gateway
cmd
order
cmd
internal/mocks/repo
Package mock_interfaces is a generated GoMock package.
Package mock_interfaces is a generated GoMock package.
internal/mocks/usecase
Package mock_usecase is a generated GoMock package.
Package mock_usecase is a generated GoMock package.
pkg
grpcserver
Package grpcserver implements GRPC server.
Package grpcserver implements GRPC server.
httpserver
Package httpserver implements HTTP server.
Package httpserver implements HTTP server.
product
cmd
internal/mocks/repo
Package mock_interfaces is a generated GoMock package.
Package mock_interfaces is a generated GoMock package.
internal/mocks/usecase
Package mock_usecase is a generated GoMock package.
Package mock_usecase is a generated GoMock package.
proto
gen/gateway
Package gateway is a reverse proxy.
Package gateway is a reverse proxy.
user
cmd
internal/mocks/repo
Package mock_interfaces is a generated GoMock package.
Package mock_interfaces is a generated GoMock package.
internal/mocks/usecase
Package mock_usecase is a generated GoMock package.
Package mock_usecase is a generated GoMock package.

Jump to

Keyboard shortcuts

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