This repository contains a fully functioning e-commerce platform built using .NET 8 and microservices architecture. The project is designed to demonstrate how to implement various microservices with proper separation of concerns, asynchronous communication, secure authentication, and cloud-native deployment using Azure.
This project implements an e-commerce platform using seven microservices, each responsible for a specific functionality, ensuring the system is modular, scalable, and easy to maintain. Below are the services included and their responsibilities:
-
Product Catalog Microservice:
- Handles product information, CRUD operations, and product listing.
-
Shopping Cart (Basket) Microservice:
- Manages shopping cart operations.
-
Order Microservice:
- Processes customer orders, including validation and order management.
-
Coupon/Discount Microservice:
- Provides discount calculation functionality.
-
Email Notification Microservice:
- Sends confirmation emails upon order placement using event-driven communication (sendgrid for SMTP server).
-
Payment Microservice:
- Integrates payment processing and handles communication with external payment gateways (stripe payment gateway).
-
Identity Microservice:
- Implements secure authentication and authorization using .NET Identity, with role-based access control.
- .NET 8: For building backend APIs and services.
- ASP.NET Core MVC: For the web framework and controllers.
- Ocelot API Gateway: To manage routing between different microservices.
- Entity Framework Core: For database management with SQL Server.
- Azure Service Bus: For asynchronous communication between microservices.
- Swagger: For API documentation and testing.
- User Browses Products: The user views products provided by the Product Catalog Microservice.
- Shopping Cart: The user adds items to the cart, which is handled by the Shopping Cart Microservice.
- Applying Discounts: The Coupon Microservice calculates discounts and applies them at checkout.
- Order Placement: The Order Microservice processes the order and communicates with the Payment Microservice for secure payment using stripe payment gateway.
- Email Notifications: After payment, the Email Microservice sends a confirmation email using .
- Authentication: The Identity Microservice ensures secure login and role-based access throughout the platform.
Follow these steps to set up and run the project locally:
- .NET 8 SDK
- Docker
- SQL Server (local or cloud-hosted)
- Visual Studio 2022 or higher
-
Clone the repository:
git clone https://github.com/MartinAyush/Insta-Basket.git cd dotnet-microservices-ecommerce
-
Set up your environment variables:
- Update the
appsettings.json
files for each microservice with your SQL Server configurations.`
- Update the
-
The Front-End should be up and running. You can access the microservices via the Ocelot API Gateway at:
https://localhost:7282
-
Swagger UI is enabled for each microservice, allowing you to test the APIs:
http://localhost:XXXX/swagger/index.html
Once the services are up and running:
- Access the e-commerce application via the web interface.
- Test various functionalities such as:
- Browsing products.
- Adding items to the shopping cart.
- Applying discount coupons.
- Placing an order.
- Making a payment.
- Receiving an email confirmation.
The solution includes unit tests for each microservice. You can run the tests via the Test Explorer in Visual Studio or using the .NET CLI:
dotnet test
You can check the deployed version of the application here: Live Demo Link
This project demonstrates how to structure, implement, and deploy a modern, cloud-native e-commerce platform using microservices architecture with .NET 8. The solution incorporates clean architecture principles, event-driven communication, and cloud-ready deployments, making it scalable and maintainable for real-world applications.