Prerequisites
Before you begin, ensure you have the following tools installed:- Visual Studio 2022 (or any IDE that supports .NET)
- .NET 8 SDK or later - Download here
- Docker Desktop - Download here
Docker Configuration
For optimal performance, configure Docker Desktop with the following minimum resources:- Open Docker Desktop settings (click the Docker icon in system tray)
- Navigate to Settings > Resources
- Set the following minimum values:
- Memory: 4 GB
- CPU: 2 cores
These are minimum requirements. If you have more resources available, allocating additional memory and CPU cores will improve performance.
Step-by-Step Setup
1. Clone the Repository
2. Navigate to Source Directory
3. Start All Services
Run the following command to start all microservices and their dependencies:- Pull all required Docker images
- Build microservice containers
- Start all databases (PostgreSQL, SQL Server, Redis)
- Start RabbitMQ message broker
- Launch all microservices
- Start the API Gateway and Web UI
The first run will take several minutes as Docker needs to download base images and build containers.
4. Wait for Services to Initialize
You can monitor the startup process by viewing logs:Ctrl+C to stop viewing logs (containers will continue running).
5. Verify Services are Running
Check that all containers are up and healthy:Up status.
Accessing the Application
Web UI (Shopping Application)
The main shopping web interface is available at: https://localhost:6065 This is the primary interface where you can:- Browse products from the Catalog
- Add items to the Basket
- Complete checkout (which triggers RabbitMQ messaging)
- View orders
Individual Microservices
Each microservice exposes HTTP endpoints on the following ports:| Service | HTTP Port | HTTPS Port | Purpose |
|---|---|---|---|
| Catalog API | 6000 | 6060 | Product catalog management |
| Basket API | 6001 | 6061 | Shopping basket operations |
| Discount gRPC | 6002 | 6062 | Discount calculation service |
| Ordering API | 6003 | 6063 | Order processing |
| API Gateway | 6004 | 6064 | YARP reverse proxy |
| Shopping Web | 6005 | 6065 | Web UI |
API Endpoints
The microservices use Carter for minimal API endpoints. Example endpoints:Catalog API Endpoints
Basket API Endpoints
Ordering API Endpoints
Via API Gateway
You can also access microservices through the YARP API Gateway:The Ordering service has rate limiting enabled through the API Gateway using a fixed window limiter.
Infrastructure Services
RabbitMQ Management Console
Access the RabbitMQ dashboard to monitor message queues:- URL: http://localhost:15672
- Username:
guest - Password:
guest
- View active queues and exchanges
- Monitor BasketCheckout events
- Track message flow between Basket and Ordering services
Database Access
Connect to databases using your preferred database client: PostgreSQL (Catalog Database)- Host:
localhost - Port:
5432 - Database:
CatalogDb - Username:
postgres - Password:
postgres
- Host:
localhost - Port:
5433 - Database:
BasketDb - Username:
postgres - Password:
postgres
- Host:
localhost - Port:
1433 - Database:
OrderDb - Username:
sa - Password:
SwN12345678
- Host:
localhost - Port:
6379
Testing the Complete Flow
- Browse Products: Open https://localhost:6065 and view the product catalog
- Add to Basket: Click on products to add them to your shopping basket
- Checkout: Complete the checkout process
- Verify Messaging: Open RabbitMQ console (http://localhost:15672) and observe the
BasketCheckoutqueue activity - Check Orders: The Ordering microservice consumes the message and creates an order
Stopping the Application
To stop all running containers:Running Individual Services
If you want to debug a specific microservice in your IDE while keeping infrastructure services running:1. Start only infrastructure services:
2. Run the microservice from your IDE:
- Open the solution in Visual Studio
- Set the desired microservice project as startup project
- Press F5 to run with debugging
Make sure to use the
appsettings.Development.json configuration which points to localhost for database connections.Next Steps
- Troubleshooting - Common issues and solutions
- Monitoring - Health checks and monitoring setup
- Configuration - Environment variables and settings
