Skip to content

maestro-00/gigashop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

137 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

πŸ›’ GigaShop

A modern, cloud-native e-commerce platform built with microservices architecture, demonstrating best practices in distributed systems design.

License: MIT .NET React Docker

πŸ“‹ Table of Contents

🎯 Overview

GigaShop is a full-featured e-commerce platform built using microservices architecture. It demonstrates modern software development practices including:

  • Microservices Architecture: Independent, scalable services
  • Event-Driven Communication: Using RabbitMQ for async messaging
  • API Gateway Pattern: YARP-based gateway for unified API access
  • CQRS & Clean Architecture: Separation of concerns and maintainable code
  • Containerization: Docker-based deployment
  • Modern Frontend: React with TypeScript and shadcn/ui components

πŸ—οΈ Architecture

The application consists of the following microservices:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Web UI β”‚ (React + Vite + TypeScript) β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ YARP API Gateway β”‚ β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β–Όβ”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Catalog β”‚ β”‚ Basket β”‚ β”‚ Order β”‚ β”‚ Discount β”‚ β”‚ Service β”‚ β”‚ Serviceβ”‚ β”‚ Service β”‚ β”‚ Service β”‚ β”‚ (PostgreSQL)β”‚ β”‚(Redis) β”‚ β”‚(SQL Server) β”‚ β”‚ (gRPC) β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β” β”‚ RabbitMQ β”‚ β”‚(Message Bus)β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ 

Services

  • Catalog Service: Product catalog management with PostgreSQL
  • Basket Service: Shopping cart with Redis cache
  • Order Service: Order processing with SQL Server (CQRS pattern)
  • Discount Service: Discount calculations via gRPC
  • API Gateway: YARP reverse proxy for routing and aggregation
  • Web UI: React-based customer-facing application

✨ Features

  • πŸ›οΈ Product browsing and search
  • πŸ›’ Shopping cart management
  • πŸ’³ Order processing and tracking
  • 🎫 Discount and coupon system
  • πŸ”„ Real-time inventory updates
  • πŸ“± Responsive web interface
  • πŸ” Secure API gateway
  • πŸ“Š Event-driven architecture
  • 🐳 Containerized deployment

πŸ› οΈ Tech Stack

Backend

  • .NET 8: Latest LTS version of .NET
  • ASP.NET Core: Web API framework
  • Entity Framework Core: ORM for data access
  • MediatR: CQRS and mediator pattern
  • Carter: Minimal API endpoints
  • Mapster: Object mapping
  • FluentValidation: Input validation
  • YARP: Reverse proxy and API gateway
  • gRPC: High-performance RPC framework

Frontend

  • React 18: UI library
  • TypeScript: Type-safe JavaScript
  • Vite: Build tool and dev server
  • TailwindCSS: Utility-first CSS
  • shadcn/ui: Component library
  • React Router: Client-side routing
  • TanStack Query: Data fetching and caching
  • React Hook Form: Form management
  • Zod: Schema validation

Infrastructure

  • Docker & Docker Compose: Containerization
  • PostgreSQL: Catalog and Basket databases
  • SQL Server: Order database
  • Redis: Distributed cache
  • RabbitMQ: Message broker

πŸ“¦ Prerequisites

Before you begin, ensure you have the following installed:

Verify Installation

# Check Docker docker --version docker compose version # Check .NET dotnet --version # Check Node.js node --version npm --version

πŸš€ Getting Started

1. Clone the Repository

git clone https://github.com/Lukada-taiya/gigashop.git cd gigashop

2. Run with Docker Compose (Recommended)

The easiest way to run the entire application:

cd src docker compose up -d

This will start all services:

3. Verify Services are Running

# Check all containers are up docker compose ps # View logs docker compose logs -f # View specific service logs docker compose logs -f catalog.api

4. Stop the Application

# Stop all services docker compose down # Stop and remove volumes (clean slate) docker compose down -v

πŸ“ Project Structure

gigashop/ β”œβ”€β”€ src/ β”‚ β”œβ”€β”€ ApiGateways/ β”‚ β”‚ └── YarpApiGateway/ # API Gateway service β”‚ β”œβ”€β”€ BuildingBlocks/ β”‚ β”‚ β”œβ”€β”€ BuildingBlocks/ # Shared libraries β”‚ β”‚ └── BuildingBlocks.Messaging/ # Messaging abstractions β”‚ β”œβ”€β”€ Services/ β”‚ β”‚ β”œβ”€β”€ Basket/ β”‚ β”‚ β”‚ └── Basket.API/ # Basket microservice β”‚ β”‚ β”œβ”€β”€ Catalog/ β”‚ β”‚ β”‚ └── Catalog.API/ # Catalog microservice β”‚ β”‚ β”œβ”€β”€ Discount/ β”‚ β”‚ β”‚ └── Discount.Grpc/ # Discount gRPC service β”‚ β”‚ └── Order/ β”‚ β”‚ β”œβ”€β”€ Order.API/ # Order API β”‚ β”‚ β”œβ”€β”€ Order.Application/ # Business logic β”‚ β”‚ β”œβ”€β”€ Order.Domain/ # Domain models β”‚ β”‚ └── Order.Infrastructure/ # Data access β”‚ β”œβ”€β”€ Web/ # React frontend β”‚ β”œβ”€β”€ compose.yaml # Docker Compose base β”‚ β”œβ”€β”€ compose.override.yaml # Docker Compose overrides β”‚ └── gigashop.sln # Solution file β”œβ”€β”€ .github/ # GitHub templates β”œβ”€β”€ CONTRIBUTING.md # Contribution guidelines β”œβ”€β”€ CODE_OF_CONDUCT.md # Code of conduct β”œβ”€β”€ LICENSE # MIT License └── README.md # This file 

πŸ’» Development

Running Services Individually

Backend Services

cd src # Run Catalog API dotnet run --project Services/Catalog/Catalog.API # Run Basket API dotnet run --project Services/Basket/Basket.API # Run Order API dotnet run --project Services/Order/Order.API # Run Discount gRPC dotnet run --project Services/Discount/Discount.Grpc # Run API Gateway dotnet run --project ApiGateways/YarpApiGateway

Frontend

cd src/Web # Install dependencies npm install # Run development server npm run dev # Build for production npm run build # Preview production build npm run preview # Lint code npm run lint

Database Migrations

# Add a new migration (Order service example) cd src/Services/Order/Order.API dotnet ef migrations add MigrationName # Update database dotnet ef database update # Remove last migration dotnet ef migrations remove

Building Docker Images

cd src # Build all images docker compose build # Build specific service docker compose build catalog.api # Build without cache docker compose build --no-cache

Environment Variables

Create a .env file in the src/ directory for local configuration:

# Database Connection Strings POSTGRES_USER=postgres POSTGRES_PASSWORD=postgres POSTGRES_DB=CatalogDb # SQL Server SA_PASSWORD=YourStrong@Passw0rd # Redis REDIS_PASSWORD= # RabbitMQ RABBITMQ_DEFAULT_USER=guest RABBITMQ_DEFAULT_PASS=guest # API URLs VITE_CART_SERVICE_URL=http://localhost:6004/basket-service VITE_PRODUCT_SERVICE_URL=http://localhost:6004/catalog-service VITE_USER_SERVICE_URL=http://localhost:6004/order-service

πŸ“š API Documentation

Catalog Service

  • GET /products - Get all products
  • GET /products/{id} - Get product by ID
  • GET /products/category/{category} - Get products by category
  • POST /products - Create new product
  • PUT /products - Update product
  • DELETE /products/{id} - Delete product

Basket Service

  • GET /basket/{userName} - Get user's basket
  • POST /basket - Store/update basket
  • DELETE /basket/{userName} - Delete basket
  • POST /basket/checkout - Checkout basket

Order Service

  • GET /orders - Get all orders
  • GET /orders/{orderName} - Get orders by name
  • GET /orders/customer/{customerId} - Get customer orders
  • POST /orders - Create order
  • PUT /orders - Update order
  • DELETE /orders/{id} - Delete order

Discount Service (gRPC)

  • GetDiscount - Get discount for a product
  • CreateDiscount - Create new discount
  • UpdateDiscount - Update existing discount
  • DeleteDiscount - Delete discount

πŸ§ͺ Testing

# Run all tests dotnet test # Run tests with coverage dotnet test /p:CollectCoverage=true # Run specific test project dotnet test src/Services/Catalog/Catalog.Tests

πŸ› Troubleshooting

Common Issues

Port conflicts:

# Check what's using a port lsof -i :6000 # macOS/Linux netstat -ano | findstr :6000 # Windows # Change ports in compose.override.yaml

Database connection issues:

# Reset databases docker compose down -v docker compose up -d

Frontend build errors:

cd src/Web rm -rf node_modules package-lock.json npm install

🀝 Contributing

We welcome contributions! Please see our Contributing Guidelines for details on:

  • Code of Conduct
  • Development process
  • Submitting pull requests
  • Coding standards
  • Testing requirements

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ‘₯ Authors

πŸ™ Acknowledgments

  • Built with modern .NET and React ecosystems
  • Inspired by microservices best practices
  • Community-driven development

πŸ“ž Support


Star ⭐ this repository if you find it helpful!

About

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors