A microservices-based e-commerce platform built with Go, gRPC, GraphQL, PostgreSQL, and Elasticsearch.
- GraphQL Gateway: Single entry point for all API requests
- Account Service: Manages user accounts (PostgreSQL)
- Product Service: Manages product catalog (Elasticsearch)
- Order Service: Manages orders and order history (PostgreSQL)
- Go 1.24+
- Docker & Docker Compose
- Protocol Buffers compiler (
protoc) - Go protobuf plugins
# macOS
brew install protobuf
# Ubuntu/Debian
sudo apt-get install protobuf-compiler
# Windows
# Download from https://github.com/protocolbuffers/protobuf/releasesgo install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latestgo install github.com/99designs/gqlgen@latestgit clone https://github.com/sdshah09/GoCore.git
cd GoCore# Generate account service protobuf
cd account
protoc --go_out=pb --go_opt=paths=source_relative \
--go-grpc_out=pb --go-grpc_opt=paths=source_relative \
account.proto
# Generate product service protobuf
cd ../product
protoc --go_out=pb --go_opt=paths=source_relative \
--go-grpc_out=pb --go-grpc_opt=paths=source_relative \
product.proto
# Generate order service protobuf
cd ../order
protoc --go_out=pb --go_opt=paths=source_relative \
--go-grpc_out=pb --go-grpc_opt=paths=source_relative \
order.protocd ../graphql
go run github.com/99designs/gqlgen generatecd ..
docker-compose up -d# Start all services and databases
docker-compose up -d
# Check service status
docker-compose psdocker-compose down# View all logs
docker-compose logs
# View specific service logs
docker-compose logs graphql
docker-compose logs account
docker-compose logs product
docker-compose logs order- GraphQL Playground: http://localhost:8080/playground
- GraphQL Endpoint: http://localhost:8080/graphql
mutation CreateAccount {
createAccount(account: {
name: "John Doe"
}) {
id
name
}
}mutation CreateProduct {
createProduct(product: {
name: "iPhone 15 Pro"
description: "Latest iPhone with advanced camera system"
price: 999.99
}) {
id
name
description
price
}
}mutation CreateOrder {
createOrder(order: {
accountId: "account-123"
products: [
{
id: "product-456"
quantity: 2
},
{
id: "product-789"
quantity: 1
}
]
}) {
id
createdAt
totalPrice
products {
id
name
description
price
quantity
}
}
}query GetAllAccounts {
accounts {
id
name
orders {
id
createdAt
totalPrice
}
}
}query GetAccountsWithPagination {
accounts(pagination: {
skip: 0
take: 10
}) {
id
name
}
}query GetAccountById {
accounts(id: "account-123") {
id
name
orders {
id
createdAt
totalPrice
products {
id
name
price
quantity
}
}
}
}query GetAllProducts {
products {
id
name
description
price
}
}query SearchProducts {
products(query: "iPhone") {
id
name
description
price
}
}query GetProductsWithPagination {
products(pagination: {
skip: 0
take: 5
}) {
id
name
description
price
}
}query GetProductById {
products(id: "product-456") {
id
name
description
price
}
}query GetOrdersForAccount {
ordersForAccount(accountId: "account-123") {
id
createdAt
totalPrice
products {
id
name
description
price
quantity
}
}
}CREATE TABLE accounts (
id CHAR(27) PRIMARY KEY,
name VARCHAR(255) NOT NULL
);CREATE TABLE orders (
id CHAR(27) PRIMARY KEY,
created_at TIMESTAMP WITH TIME ZONE NOT NULL,
account_id CHAR(27) NOT NULL,
total_price MONEY NOT NULL
);CREATE TABLE order_products (
order_id CHAR(27) REFERENCES orders (id) ON DELETE CASCADE,
product_id CHAR(27),
quantity INT NOT NULL,
PRIMARY KEY (product_id, order_id)
);Products are stored in Elasticsearch with the following structure:
{
"id": "product-123",
"name": "iPhone 15 Pro",
"description": "Latest iPhone with advanced camera system",
"price": 999.99
}GoCore/
├── account/ # Account service
│ ├── cmd/
│ ├── pb/ # Generated protobuf files
│ ├── repository.go
│ ├── service.go
│ ├── server.go
│ └── account.proto
├── product/ # Product service
│ ├── cmd/
│ ├── pb/
│ ├── repository.go
│ ├── service.go
│ ├── server.go
│ └── product.proto
├── order/ # Order service
│ ├── cmd/
│ ├── pb/
│ ├── repository.go
│ ├── service.go
│ ├── server.go
│ └── order.proto
├── graphql/ # GraphQL gateway
│ ├── schema.graphql
│ ├── mutation_resolver.go
│ ├── query_resolver.go
│ └── main.go
├── docker-compose.yml
├── go.mod
└── README.md
- Create service directory with
cmd/,pb/,repository.go,service.go,server.go - Define protobuf schema in
.protofile - Generate protobuf code
- Add service to
docker-compose.yml - Update GraphQL schema if needed
# Test individual services
cd account && go test ./...
cd ../product && go test ./...
cd ../order && go test ./...
# Test GraphQL queries
# Use the GraphQL Playground at http://localhost:8080/playground- Port conflicts: Stop local PostgreSQL/Elasticsearch instances
- Protobuf generation errors: Ensure
protocand plugins are installed - GraphQL generation errors: Run
go mod tidyand ensure gqlgen is installed - Docker build failures: Check Dockerfile paths and dependencies
# Check service logs
docker-compose logs [service-name]
# Access service containers
docker-compose exec [service-name] sh
# Check database connections
docker-compose exec account_db psql -U akhil -d akhil
docker-compose exec order_db psql -U akhil -d akhil
# Check Elasticsearch
curl http://localhost:9200/_cluster/healthGoCore supports multiple deployment paths from local development to production Kubernetes.
| Environment | Tool | Use Case |
|---|---|---|
| Local | Docker Compose | Development, quick testing |
| Kubernetes | Helm | Manual K8s deployment, CI/CD pipelines |
| Kubernetes | Argo CD + Helm | GitOps, production, self-healing |
Fastest way to run the full stack:
docker-compose up -dThis starts:
- 4 microservices: account, product, order, graphql
- 3 databases: PostgreSQL (account, order), Elasticsearch (product)
- GraphQL Playground: http://localhost:8000/playground
Deploy the entire platform to any Kubernetes cluster with a single Helm command.
- Kubernetes cluster (minikube, kind, EKS, GKE, AKS, etc.)
kubectlconfigured- Helm 3+
# Create values-secret.yaml (gitignored) for secrets, or use --set
# Example: cp gocore/values-secret.yaml.example gocore/values-secret.yaml
# Install the chart
helm install gocore ./gocore -f gocore/values.yaml -f gocore/values-secret.yaml
# Or upgrade if already installed
helm upgrade --install gocore ./gocore -f gocore/values.yaml -f gocore/values-secret.yaml| Resource | Description |
|---|---|
| Deployments | account, order, product, graphql + account-db, order-db, product-db |
| Services | ClusterIP services for all components |
| PVCs | Persistent volumes for PostgreSQL and Elasticsearch data |
| Secret | DB credentials (from values-secret.yaml) |
| Ingress | Optional ingress for external access |
Edit gocore/values.yaml to change:
- Replicas per service
- Image tags and repositories
- Resources (CPU/memory limits)
- Ingress rules and hostnames
# Override values at install time
helm install gocore ./gocore -f gocore/values.yaml \
--set services.account.replicas=3 \
--set ingress.enabled=trueUse Argo CD for declarative, Git-driven deployments with automatic sync and self-healing.
- Kubernetes cluster with Argo CD installed
- GoCore repo accessible (GitHub, GitLab, etc.)
| Field | Value |
|---|---|
| Application Name | gocore (must be lowercase) |
| Repository URL | https://github.com/sdshah09/GoCore |
| Path | gocore |
| Revision | main (or your branch) |
| Source Type | Helm |
| Destination Namespace | default (or your namespace) |
| Sync Policy | Automatic (optional: Self Heal, Prune) |
- Edit
gocore/values.yamlor chart templates - Commit and push to the watched branch
- Argo CD detects changes and syncs automatically
- Cluster state matches Git — manual
kubectlchanges are reverted if Self Heal is on
Do not commit secrets to Git. Use Argo CD Parameters or a values file from a secret store to pass secrets.dbCredentials.stringData.* at sync time.
┌─────────────────────────────────────────────────────────────────────────┐
│ Developer │
│ └── Edit code, values.yaml, Helm templates │
│ └── Commit & push to Git │
└─────────────────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────────────┐
│ Git (Source of Truth) │
│ └── gocore/ Chart + values.yaml │
└─────────────────────────────────────────────────────────────────────────┘
│
┌─────────────────────┼─────────────────────┐
▼ ▼ ▼
┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐
│ Docker Compose │ │ Helm │ │ Argo CD │
│ (Local dev) │ │ (Manual K8s) │ │ (GitOps K8s) │
│ │ │ │ │ │
│ docker-compose │ │ helm install │ │ Watches Git │
│ up -d │ │ gocore ./gocore │ │ helm template │
│ │ │ │ │ + apply │
└──────────────────┘ └──────────────────┘ └──────────────────┘
│ │ │
└─────────────────────┼─────────────────────┘
▼
┌─────────────────────────────────────────────────────────────────────────┐
│ Running GoCore Platform │
│ • GraphQL Gateway • Account Service • Product Service • Order Service │
│ • PostgreSQL (x2) • Elasticsearch │
└─────────────────────────────────────────────────────────────────────────┘
| Feature | Docker Compose | Helm | Argo CD |
|---|---|---|---|
| One-command deploy | ✅ | ✅ | ✅ (after initial setup) |
| Parameterized config | ❌ | ✅ values.yaml | ✅ values + Parameters |
| Secrets management | Env vars | values-secret.yaml | Parameters / external secrets |
| Rollback | docker-compose down |
helm rollback |
Git revert + sync |
| Self-healing | ❌ | ❌ | ✅ |
| Multi-environment | ❌ | ✅ (values per env) | ✅ (apps per env) |
| Audit trail | ❌ | ❌ | ✅ (Git history) |
- Helm in this project:
docs/HELM_IN_THIS_PROJECT.md - Argo CD setup:
docs/ARGOCD_NOTES.md - Helm chart reference:
docs/HELM_CHART_NOTES.md
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
