120241027100118
120241027100118
Description
The eCommerce industry is booming. In 2018, the global eCommerce market was valued at $2.8 trillion and is
expected to grow to $4.9 trillion by 2025. With such rapid growth, there is ample opportunity for new entrants
to build world-class eCommerce platforms.
Develop an eCommerce platform that adapts to changing consumer preferences. The retail industry constantly
needs to introduce new solutions and services that will enhance customer experience and provide a great online
shopping experience.
We are looking for a website that enables customers to enjoy a simple, seamless, and effective shopping
experience across all stages of their purchasing journey!
Some of the stages of user shopping that you can innovate under include but are not limited to:
1. Public Pages
• Home Page
• About Us Page
• Contact Us Page
2. Account
• Login Page
• SignUp Page
• Forgot Password Page
• SignOut Page
3. Catalogue
• Catalogue Listing Page
• Catalogue Details Page with AddToCart Option
4. Cart and Payment
• Cart Page
• Checkout Page
• Payment Page with payment gateway integration
• Payment Confirmation Page
5. User Module
• Dashboard Page
• Purchased Items Page
• My Order Page
The stages mentioned above are for reference only. While these are some broad highlights, you are
encouraged to think out of the box and develop innovative solutions.
Technologies to Be Used
• ASP.NET Core 8: MVC & Web API
• EF Core 8
• Frontend: Bootstrap, jQuery
• Message Broker: Azure Service Bus/RabbitMQ
• API Gateway: APIM/Ocelot
• Docker
• Kubernetes/AKS
• Azure DevOps
• Git
Intended Audience
• .Net Developers
• Senior .NET Developers
• .NET Tech Leads/Project Leads
• .NET Solution Architects
Version History
• Initial Release: 1.0 - 10th Oct 2024
• Core Subdomains: These are critical features that define the business’s unique value proposition. In an
e-commerce platform, the core subdomains include product management, order management, and
payment processing.
• Support Subdomains: These subdomains assist the core operations and include inventory
management, customer service, and marketing features like promotions and offers.
• Generic Subdomains: These are non-business-specific functionalities that enhance the platform's
usability, such as authentication, notifications, and analytics.
Ecosystem
The key actors in our e-commerce ecosystem include:
• Customers (Users): Individuals or businesses that browse the platform, make purchases, and track orders.
• Admin (Platform Owners): Manage product listings, orders, inventory, and overall system health.
• Vendors/Sellers: Suppliers who list their products on the platform and manage their orders.
• Delivery Partners: Handle the shipping and delivery of products to customers.
• High Availability and Low Latency: Utilize Azure Availability Zones to ensure uptime and minimize
latency. Employ Azure Front Door for fast and reliable global access, balancing traffic across regions.
Implement caching strategies (e.g., using Azure Cache for Redis) to reduce latency.
• Scalability: Leverage Azure Kubernetes Service (AKS) for automatic scaling of microservices. Use Azure
Service Bus or Azure Event Grid for handling asynchronous communication between microservices,
ensuring the system can scale without performance degradation.
• Data Consistency and Integrity: Implement Azure Cosmos DB or Azure SQL Database with strong
consistency models for critical data. Use distributed transactions where necessary (e.g., using the Saga
pattern) to maintain data integrity across microservices.
• Redundancy and Failover: Design microservices to be stateless and leverage Azure Load Balancer for
redundancy. Enable Azure Traffic Manager to route traffic during failovers and distribute traffic among
regions in case of service failure.
• Security: Implement Azure Active Directory (Azure AD) for secure authentication and authorization. Use
Azure Key Vault for managing secrets, certificates, and encryption keys. Apply API gateway (like Azure
API Management) to centralize security and enforce policies such as rate-limiting and token validation.
• Content Delivery Network (CDN): Integrate Azure CDN for faster content delivery, especially for static
assets like product images, reducing load on backend services.
• Efficient Storage: Use Azure Blob Storage for managing large product catalogs and user data. Leverage
Azure SQL Database or Cosmos DB for structured data storage based on scalability and performance
needs.
• System Monitoring: Implement Azure Monitor and Azure Application Insights to track system
performance, diagnose issues, and monitor security. Use Azure Log Analytics for centralized logging and
to provide insights into infrastructure and service health.
• CI/CD with Azure DevOps: Use Azure DevOps Pipelines for automated build, test, and deployment of
microservices, ensuring a smooth and efficient release cycle. Set up Infrastructure as Code (IaC) with
Azure Resource Manager (ARM) templates or terraform for consistent and reliable infrastructure
deployment.
Project Architecture
A well-designed project architecture is essential for any database-driven application. The architecture defines
the overall structure of the project components and how they will communicate with each other. It is the heart
of an application and decides the UI and database workflows in the system.
Frontend Services
1. Shopping Website:
• Interface for end users to browse and purchase products.
• Accessible via web browsers and mobile devices.
2. Internal Support Website:
• Platform for the support team to assist users and manage inquiries.
• Facilitates internal processes and customer support tasks.
Backend Services
1. API Gateway:
• Acts as a single-entry point for all client requests.
• Routes requests to the appropriate backend services.
2. Microservices:
• Auth Service: Manages user authentication and authorization.
• Catalog Service: Handles product listings and details.
• Cart Service: Manages user shopping carts and items.
• Order Service: Processes orders and manages order history.
• Payment Service: Handles payment processing and transactions.
• Stock Service: Manages inventory levels and stock updates.
Infrastructure
• AKS Cluster: Hosts the backend services, ensuring scalability and management of containerized
applications.
• WebApp/Virtual Machine: Provides a robust and flexible hosting solution that enables the deployment,
scaling, and management of applications in a dynamic and efficient manner.
Data Flow
• Presentation Layer → Application Layer → Domain Layer
• Application Layer → Infrastructure Layer → DB/Extremal Dependencies
• Infrastructure Layer Implements → Domain Layer Interfaces
The detailed folder structure for the backend services is given below:
eShopFlix.Web
Frontend
UIs/Service
eShopFlix.Support
EndUser: eShopFlix.Web
Home
Login
Public SignUp
Cart
eShopFlix.Web Payment
Dashboard
User Profile
My Order
Account Login
Dashboard
eShopFlix.Support
Profile
Admin Catalog
Category
Users
AuthService
CartService
Backend Services
CatalogService
OrderService
PaymentService
StockService
Coding Workflows
Login Workflow
Payment Workflow
Security in Microservices
In microservices architecture, ASP.NET Core provides robust security through JWT authentication, enabling
services to validate tokens independently without relying on a central server, ensuring scalability. It also
integrates with third-party providers like Okta and Auth0 for simplified identity management and single sign-on
(SSO). Additionally, ASP.NET Core allows customization of authentication, supporting varied security needs
across different services, making it ideal for securing microservices.
Authentication
Okta Auth0
JWT can be used with any type of application, but it is most commonly used with Single Page Applications (SPAs).
SPAs are web applications that run in the browser and do not require a full-page refresh when the user navigates
to different parts of the app. JWT is also used with APIs to authenticate users. When a user authenticates with
a JWT-protected API, they will receive a token that they can use to access resources that are protected by JWT.
JWT is a convenient and secure way to authenticate users, and it can be used with any type of application.
Creating JWT Token|
Microservices Patterns
Decomposition Patterns:
The decomposition pattern followed by the eShopFlix folder structure is based on the service-oriented
decomposition pattern, typical in a microservices-based architecture. The structure highlights the principle of
vertical slice decomposition, where each business capability is isolated into its own service, maintaining a clear
boundary between the various components of the application. Below is a detailed description:
• API: The API layer in each service (e.g., Auth.API, CartService.API) is responsible for exposing
endpoints and handling HTTP requests, making each service interactable with external systems or
other services.
• Domain: The Domain layer includes the core domain models, business entities, and interfaces,
following domain-driven design (DDD) principles. This layer represents the business logic and data
that are central to the service.
• Infrastructure: The infrastructure layer deals with external resources such as databases, messaging
systems, or third-party services (e.g., Auth.Infrastructure, CartService.Infrastructure). This
separation ensures that the infrastructure concerns are decoupled from the business logic.
3. API Gateway Pattern: The inclusion of ApiGatewayOcelot highlights the usage of the API Gateway
pattern, which aggregates requests from different clients and forwards them to the respective backend
services. This acts as a single-entry point for frontend applications, handling concerns like routing, load
balancing, and security.
4. Shared Module: The Shared module contains common infrastructure or functionality that is reusable
across different services. While having a shared module helps avoid code duplication, it is essential to
ensure that it doesn’t lead to tight coupling between services, which is often avoided in microservices to
maintain service independence.
5. Frontend and Backend Separation: The folder structure divides the project into BackendServices and
FrontendServices. FrontendServices (e.g., WebApp) handles the UI and interaction layer, while
BackendServices (e.g., AuthService, CartService) handle specific domain logic. This separation promotes
better maintainability and scalability as the UI can evolve independently from the backend services.
6. Vertical Slice Decomposition: Each service is an independent vertical slice of the system, encapsulating
everything from the database and domain models to business logic and API, making each service self-
sufficient. This pattern allows services to evolve independently of one another.
CartService
Backend Service
CatalogService
OrderService
PaymentService
StockService
eShopFlix.Web
Frontend Services
eShopFlix.Support
Integration Patterns
An integration pattern in microservices refers to the approach or design used to facilitate communication,
coordination, and data sharing between multiple microservices. Since microservices are typically small,
• It handles cross-cutting concerns like authentication, logging, rate-limiting, and load balancing, abstracting the
complexities of interacting with multiple services from the client.
• The API Gateway ensures that the frontend (WebApp) does not need to interact directly with individual services
but instead communicates through a unified gateway, which forwards requests to the relevant services based
on routing rules.
Catalog
Microservice
API
Gateway Routing Authentication
Microservice
(Authentication,
response caching)
Order
Microservice
Communication Patterns
In microservices architecture, communication patterns define how microservices interact with each other and
external systems. Since microservices are designed to be loosely coupled and independently deployable,
choosing the right communication pattern is crucial for ensuring scalability, reliability, and performance.
The key communication patterns implemented in this structure are described below.
Advantages:
• Loose Coupling: Services are not dependent on the availability of other services.
• Scalability: Easier to scale and handle a high volume of events across multiple services.
• Fault Tolerance: Since services are decoupled, failures in one service don't immediately affect others.
Database Patterns
In microservices architecture, each service typically has its own database to maintain loose coupling and ensure
independent scalability. Database patterns help manage data across services while addressing concerns like data
consistency, scalability, and fault tolerance.
• Loose Coupling: Services can operate independently, reducing the risk of cascading failures.
• Scalability: Each service can be scaled individually depending on its database load.
• Technology Flexibility: Different services can use different types of databases, such as SQL, NoSQL, or in-
memory databases, depending on their specific needs.
Advantages:
• Easier Transaction Management: Cross-service transactions are simpler since services access the same
database.
• Reduced Overhead: Shared databases reduce the complexity of managing multiple databases.
Advantages:
Advantages:
Example: Tools like Consul, Eureka, or Kubernetes DNS provide service discovery mechanisms where services register
themselves and other services can discover them when needed.
Advantages:
• If PaymentService is down, the circuit breaker prevents further requests from reaching it and may trigger a
fallback response in OrderService.
Advantages:
• OrderService may have a rate limit that restricts each user to 100 order requests per hour to prevent abuse.
Advantages:
• Prevents Overload: Protects services from being overwhelmed by too many requests, ensuring stable operation.
• Improved Security: Helps defend against DDoS (Distributed Denial of Service) attacks by limiting traffic.
• Cost Control: Reduces the risk of overconsumption of resources, which can lead to higher operational costs.
Observability Patterns
Observability in microservices architecture is essential for monitoring, troubleshooting, and improving the system’s
health and performance. Since microservices are distributed across multiple services, achieving full observability ensures
that system failures and performance bottlenecks can be detected and resolved quickly.
• Services like OrderService and PaymentService send their logs to a centralized logging system like ELK Stack
(Elasticsearch, Logstash, and Kibana).
• Easier Debugging: Logs from different services are available in one place, making it easier to trace errors across
services.
• Searchable Logs: Centralized systems provide powerful querying and filtering to search logs quickly.
• Improved Monitoring: Helps track service-level issues and failures in real time.
• InventoryService might expose a /health endpoint to check the status of its connection to the database and
messaging system.
Advantages:
• UserService might send metrics related to login failures, API response times, and throughput to a monitoring
system.
Advantages:
• Performance Monitoring: Metrics help assess the overall performance of the system and individual services.
• Anomaly Detection: Alerts can be set based on thresholds for various metrics, such as CPU utilization exceeding
80%.
• Capacity Planning: Helps identify resource usage trends for scaling decisions.
Deployment Patterns
Deployment patterns in microservices architecture determine how services are packaged, deployed, and managed
across various environments. These patterns help achieve scalability, isolation, and flexibility in managing microservices.
• PaymentService and NotificationService may run on the same server due to their low resource requirements.
Advantages:
• Resource Efficiency: Reduces infrastructure costs by utilizing server resources more effectively.
• Simplified Management: Fewer servers or virtual machines to manage.
Advantages:
• Portability: Containers can run consistently across development, testing, and production environments.
• OrderProcessingService is deployed as an Azure function that executes only when triggered by an event.
Advantages:
• Reduced Infrastructure Management: No need to manage servers, as the platform handles it automatically.
• Cost Efficiency: Pay only for the compute time used.
• Automatic Scaling: Services are automatically scaled based on demand.
Contact Us
You can always reach out to us if you need help with this project. For getting help email us at
[email protected] or connect to our Discord’s #support channel.