A scalable and modular microservice-based application built with Go, gRPC, and GraphQL. This project demonstrates how to integrate multiple services using gRPC while exposing a unified GraphQL API Gateway for easy querying.
This project consists of three independent microservices:
- Account Service - Manages user accounts.
- Catalog Service - Handles product listings (uses Elasticsearch for storage).
- Order Service - Processes orders (linked to PostgreSQL).
- GraphQL API Gateway - Provides a single access point to interact with all services.
✔️ Microservices architecture with gRPC communication
✔️ GraphQL API for querying and mutations
✔️ PostgreSQL and Elasticsearch for data storage
✔️ Docker Compose setup for easy deployment
✔️ Modular and scalable design
git clone https://github.com/Devisrisamidurai/Go-grpc-graphql-microservice.git
cd Go-grpc-graphql-microservice
Ensure you have Docker and Docker Compose installed, then start the services:
docker-compose up -d --build
Once the services are up, visit:
➡ http://localhost:8000/playground
query {
accounts {
id
name
}
}
mutation {
createAccount(account: {name: "John Doe"}) {
id
name
}
}
query {
products(pagination: {skip: 0, take: 10}, filter: "laptop") {
id
name
price
}
}
mutation {
createOrder(order: {accountId: "123", products: [{id: "456", quantity: 2}]}) {
id
totalPrice
products {
name
quantity
}
}
}
query {
account(id: "123") {
name
orders {
id
totalPrice
products {
name
quantity
price
}
}
}
}
- Go - Core backend language
- gRPC - Service-to-service communication
- GraphQL - API Gateway for data querying
- PostgreSQL - Relational database for accounts and orders
- Elasticsearch - Search engine for products
- Docker & Docker Compose - Containerized deployment
- Frontend/Client makes a GraphQL query.
- GraphQL API Gateway routes the request to the appropriate gRPC service.
- gRPC Services process the request and interact with their respective databases.
- Response is returned to the client via the GraphQL Gateway.
Contributions are welcome! Feel free to fork the repository and submit a pull request.
This project is open-source and available under the MIT License.