How ahmadmdabit/e-store works
Project Type and Purpose
• This is a full-stack, multi-tier e-commerce solution (“e-store”) built on .NET Core.
• It consists of:
• A public Web UI (ASP.NET Core MVC/Razor)
• A RESTful API (ASP.NET Core)
• A Business Logic Layer (BLL)
• A Data Access Layer (DAL) using Entity Framework Core
• A shared Common library (COMN) for cross-cutting types and utilities
Architectural Overview
• Layered architecture with strict separation of concerns:
• UI Layer (WEB)
• API Layer (API)
• Service/Business Layer (BLL)
• Persistence Layer (DAL)
• Shared Utilities (COMN)
• MVC pattern in the Web project; Repository + Unit-of-Work patterns in the DAL; Dependency Injection and middleware in API and Web.
Main Components to Render
A. Client / Web UI (src/EStore/WEB)
• Controllers & Views (MVC)
• Static assets (wwwroot/css, js, lib)
• Middleware: JWT auth, error handling
• Rest-client services calling the API
B. API Gateway (src/EStore/API)
• Controllers grouped by domain (Login, Store)
• JWT and CORS middleware
• Exception handling middleware
• DI extensions for wiring up BLL and DAL
C. Business Logic Layer (src/EStore/BLL)
• Business services for Login and Store domains
• BaseBusiness class implementing common operations
D. Data Access Layer (src/EStore/DAL)
• DatabaseContext (EF Core) with Migrations
• Entity classes organized by domain
• Repository classes per entity/domain
• ApiResult, ErrorResult, common Db models
E. Shared Common Library (src/EStore/COMN)
• Attributes (Include/Exclude for mapping)
• Extensions (IEnumerable, Reflection, Object)
• HTTP constants
F. External Services & Infrastructure
• Relational Database (e.g., SQL Server)
• NLog for logging (nlog.config in API & WEB)
• JWT issuer/validation (in appsettings.json)
• CORS policy
Relationships & Data Flow
1. Browser → Web UI: HTTP(S) requests for pages, assets
2. Web UI → API: REST calls via injected RestClientService
3. API Controller → Business Layer: controllers delegate to BLL services
4. BLL → DAL: business operations call repositories
5. DAL → Database: EF Core executes CRUD via DbContext
6. Middleware intercepts requests/responses at Web & API boundaries for auth, errors, logging
Highlighted Patterns & Principles
• Layered (Onion) Architecture: Outer Web/UI, inner API, then BLL, then DAL, core COMN
• MVC in the Web layer (Models = ViewModels & DTOs, Views = Razor pages)
• REST API in the API layer (stateless endpoints, HTTP verbs)
• Repository pattern in DAL + EF Core migrations
• Dependency Injection in Program.cs of API & Web
• Cross-cutting via middleware (Exception, JWT, CORS)
• Shared cross-cutting concerns in COMN library
Technologies & Frameworks
• ASP.NET Core MVC & Razor Pages
• ASP.NET Core Web API
• Entity Framework Core with Code-First Migrations
• C# .NET 6+
• SQL Server (or compatible RDBMS)
• NLog for logging
• JWT Bearer authentication
• NuGet DI & middleware extensions