Giter VIP home page Giter VIP logo

bookservices-books's Introduction

Microservices App (gRPC + REST)

alt text

About The Project

The BookServices project is a set of microservices that enables users to manage books and user data. The project consists of three main services: bookservices-api-gateway, bookservices-books, and bookservices-users. In the BookServices project, Coreography pattern is used as part of the Saga Pattern. In the project, bookservices-api-gateway acts as the central communication and control point, forwarding external client requests and responses to internal microservices. Coreography pattern is used to ensure that each microservice can handle its own transactional part independently, while bookservices-api-gateway coordinates and orchestrates them to achieve the overall goal.

Internal communication between services is done through gRPC, using the ProtoBank contract from bookservices-protobank. The gRPC protocol implements tokens to ensure the security of services against unauthorized access. External communication is done via REST API, which is processed through bookservices-api-gateway, and then forwarded to microservices using gRPC. JWT is used to ensure the security of external communication.

Each service has its own database using PostgreSQL, and GORM is used to access these databases using Object Relational Mapping (ORM).

Getting Started

Prerequisites

  • PosgreSQL Database
  • Go 1.20 or newer
  • Go protobuf compiler (protoc)
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest

Installation

  1. Begin by cloning the repository to your local machine.
  2. Set up a PostgreSQL database and create the necessary tables.
  3. Create an environment file by duplicating the .env.example file and filling in the required values for each service according to your needs.
  4. Install the necessary dependencies.
go get all
  1. Migrate database.
go run main.go db:migrate
  1. Generate Go code from the proto file.
make run-proto
  1. To start the service with REST API.
go run main.go
  1. To start the service with gRPC.
run go run main.go grpc:start

Usage

To make it easier for you to try the endpoint service, please use the "Run in Postman" button which you can click to directly open Postman with the configured environment and collections.

Run in Postman

By using Postman, you can easily execute endpoint services and see the response results in a format that is easy to read and understand. You can also test the various types of requests supported by the endpoint service, such as GET, POST, PUT, DELETE, etc.

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "ENCHANCHEMENT". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Thank You

Many Thanks to Ach Jailani who let me use his grpc boilerplate for this project.

Contact

Adi Khoiron Hasan - [email protected]

Project Link

(back to top)

bookservices-books's People

Contributors

eronmanprivy avatar adikhoironhasan avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.