This project demonstrates a simple, modular microservices architecture built in Go, integrated via gRPC, and exposed through a GraphQL API. It consists of three core services:
- Account Service - Manages user accounts.
- Catalog Service - Handles product catalog data.
- Order Service - Processes orders and tracks ordered products.
The GraphQL layer aggregates these services to provide a unified API endpoint.
account/ # Account service (gRPC + DB)
catalog/ # Catalog service (gRPC)
graphql/ # GraphQL gateway and resolvers
order/ # Order service (gRPC + DB)
docker-compose.yaml # For running all services together
- Create and fetch accounts
- Manage products
- Create orders with multiple products
- GraphQL API for querying and mutation
- Pagination support
- Docker & Docker Compose
- Go 1.21+ (for local development if needed)
- Clone the repository:
git clone <repo-url>
cd go-learn- Start all services using Docker Compose:
docker-compose up --build- Access GraphQL Playground in your browser:
http://localhost:8080/playground
- Send queries and mutations as defined in
graphql/schema.graphql.
query {
accounts {
id
name
orders {
id
totalPrice
}
}
}mutation {
createAccount(account: { name: "John Doe" }) {
id
name
}
}- Defined Protobuf files for each service.
- Generated Go gRPC clients and servers.
- Implemented service logic (DB interaction and business logic).
- Built GraphQL layer with
gqlgento combine services. - Used Docker and Docker Compose to run services together.
- Each service runs independently on its own port.
- PostgreSQL databases are initialized via Docker volumes.
- GraphQL server communicates with services via gRPC clients.