Welcome to the Multi-Layered Online Shopping Platform built using ASP.NET Core Web API! This project demonstrates a clean architecture approach with multiple layers for scalability, maintainability, and reusability. 🚀
- Multi-Layered Architecture: Clear separation of concerns with
API,Business,Data Access,Domain, andTestslayers. - Entity Framework Core: Code First approach for database interactions.
- Authentication & Authorization:
- ASP.NET Core Identity for user management.
- JWT for secure token-based authorization.
- Middleware:
- Custom middleware for logging incoming requests.
- Maintenance middleware for service downtime management.
- Validation: Robust validation using data annotations.
- Dependency Injection: Built-in DI for managing services.
- Global Exception Handling: Centralized error management.
- ASP.NET Core 6+
- Microsoft SQL Server
- Entity Framework Core
- JWT Authentication
- xUnit
- AutoMapper
- Serilog
The project is designed with a multi-layered architecture to separate responsibilities:
- API Layer (Presentation): Contains Controllers for handling HTTP requests and responses.
- Business Layer: Implements business logic and validation.
- Data Access Layer: Manages database operations using repositories and Unit of Work.
- Domain Layer: Contains entities and shared models.
- Tests Layer: Unit tests for ensuring code quality and reliability.
📁 MultiLayeredShoppingPlatform
├── 📂 API
│ ├── Controllers
│ └── Program.cs
├── 📂 Business
│ ├── Interfaces
│ ├── Services
│ └── DTOs
├── 📂 Data Access
│ ├── Repositories
│ ├── UnitOfWork
│ └── DbContext
├── 📂 Domain
│ ├── Entities
│ ├── Enums
├── 📂 Tests
│ ├── UnitTests
└── README.md
-
User:
- Properties:
Id,FirstName,LastName,Email,PhoneNumber,Password,Role. - Passwords are encrypted using Data Protection.
- Properties:
-
Product:
- Properties:
Id,ProductName,Price,StockQuantity.
- Properties:
-
Order:
- Properties:
Id,OrderDate,TotalAmount,CustomerId. - Relationships: One-to-Many with
User.
- Properties:
-
OrderProduct:
- Properties:
OrderId,ProductId,Quantity. - Relationships: Many-to-Many between
OrderandProduct.
- Properties:
- Logging Middleware: Logs each request's URL, timestamp, user ID and user IP.
- Maintenance Middleware: Restricts access during maintenance periods.
- Implements business rules and communicates with the Data Access layer.
- Uses AutoMapper for mapping between entities and DTOs.
- Data Annotations: Validates models (e.g., required fields, email format).
- FluentValidation: Optional for complex validations.
- A global exception handler captures all errors and provides meaningful responses.
-
Clone the repository:
git clone https://github.com/nazifkaraca/E-Commerce.git
-
Navigate to the project folder:
cd E-Commerce -
Restore dependencies:
dotnet restore
-
Update the database:
dotnet ef database update
-
Run the application:
dotnet run --project API
-
Open Swagger to explore the API:
https://localhost:5001/swagger
Run unit and integration tests:
dotnet test- Implement a payment gateway (e.g., Iyzico).
- Add more complex caching mechanisms.
- Build a frontend client.
This project is licensed under the MIT License.
For any queries, reach out to nazif808@gmail.com.