Loading repository data…
Loading repository data…
Videh75 / repository
A secure, scalable, and modular E-commerce backend system using a microservices-based architecture. The system is developed in Go and leverages modern tools like gRPC, GraphQL, Docker, PostgreSQL, and ElasticSearch.
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
A secure, scalable, and modular E-commerce backend system using a microservices-based architecture. The system is developed in Go and leverages modern tools like gRPC, GraphQL, Docker, PostgreSQL, and ElasticSearch.
The application is divided into distinct services:
account: Manages user authentication and profilecatalog: Handles product listings and searchorder: Manages orders and transactionsEach service is containerized using Docker and communicates efficiently over gRPC. A centralized GraphQL gateway provides a unified API interface to clients, enabling flexible querying and streamlined frontend integration.
PostgreSQL for structured relational dataElasticsearch for product search in the catalogThe project consists of the following main components:
Each service has its own database:
Clone the repository:
git clone <repository-url>
cd <project-directory>
Start the services using Docker Compose:
docker compose up
Access the GraphQL playground at http://localhost:8000/playground
To generate Go code from your .proto files, run:
protoc --go_out=./pb --go-grpc_out=./pb account.proto
To install protoc:
brew install protoc
You need these plugins installed:
protoc-gen-goprotoc-gen-go-grpcRun these commands:
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
Make sure your Go binaries path is in your PATH environment variable. Add this line to your shell profile (~/.bashrc or ~/.zshrc):
export PATH="$PATH:$(go env GOPATH)/bin"
Reload your shell or run source ~/.bashrc (or your profile) after adding the line.
Now protoc can find the plugins and generate Go and gRPC code correctly.
The GraphQL API provides a unified interface to interact with all the microservices.
query {
accounts {
id
name
}
}
mutation {
createAccount(account: { name: "New Account" }) {
id
name
}
}
query {
products {
id
name
price
}
}
mutation {
createProduct(
product: { name: "New Product", description: "A new product", price: 19.99 }
) {
id
name
price
}
}
mutation {
createOrder(
order: {
accountId: "account_id"
products: [{ id: "product_id", quantity: 2 }]
}
) {
id
totalPrice
products {
name
quantity
}
}
}
query {
accounts(id: "account_id") {
name
orders {
id
createdAt
totalPrice
products {
name
quantity
price
}
}
}
}
query {
products(pagination: { skip: 0, take: 5 }, query: "search_term") {
id
name
description
price
}
}
query {
accounts(id: "account_id") {
name
orders {
totalPrice
}
}
}
After the app is up and running, ElasticSearch DB can be accessed at:
http://localhost:9200
To check all indices visit:
http://localhost:9200/_cat/indices?v
To check all documents in the catalog index:
http://localhost:9200/catalog/_search?pretty
PostgreSQL can be accessed and used via CLI (Command Line Interface) After the app is up and running, in the terminal follow the below commands:
docker exec -it <container_id_for_accountDB> psql -U <db_username> -d <db_name>
Once you are in the PostgreSQL CLI, use the following commands:
To view tables:
\dt
To view accounts information:
SELECT * FROM accounts;
PostgreSQL can be accessed and used via CLI (Command Line Interface) After the app is up and running, in the terminal follow the below commands:
docker exec -it <container_id_for_orderDB> psql -U <db_username> -d <db_name>
Once you are in the PostgreSQL CLI, use the following commands:
To view tables:
\dt
To view orders information:
SELECT * FROM order;