The advanced version of this project is available at E-CommerceClient-AngularProject, which is the Angular-based frontend client that consumes this API.
This project provides a RESTful API to support an e-commerce system. The API is built using ASP.NET Core and follows the Onion Architecture pattern to ensure clean separation of concerns, scalability, and maintainability.
The system includes features like product management, order processing, user authentication, and more. This API can be consumed by a frontend client, such as an Angular-based frontend, or any other client that can communicate with RESTful services.
- ASP.NET Core
- CQRS and Mediator Design Utilization
- Onion Architecture Implementation
- Swagger
- PostgreSQL
- Docker (optional, if used)
- JWT Authentication (optional, if used)
- Authentication with JWT Token and Rerfresh Token
- Login with Google and Facebook
- Files are uploaded to Microsoft Azure storage
This project [provide a more detailed description of the project's goals and scope].
The project follows the principles of Onion Architecture, with the following folder structure:
- Application: Application services and CQRS commands/handlers.
- Domain: Domain models and business logic.
- Infrastructure: Database connections, external services, and data persistence layer.
- Presentation: API controllers and Swagger configuration.
The persistence layer includes database interactions and concrete service implementations:
- ProductRepository: Handles database operations related to products.
- OrderRepository: Manages database operations for orders.
- UserRepository: Implements database operations for user-related data.
Create Product: Endpoint to create a new product.
Update Product: Endpoint to update an existing product.
Search Product: Endpoint to search for products based on a search term.
Create Product Image: Endpoint to upload and associate images with a product.
Delete Product Image: Endpoint to delete an image associated with a product.
Get Product by Id: Endpoint to retrieve details of a product by its unique identifier.
Change Showcase Image for Product: Endpoint to set a specific image as the showcase image for a product.
Add Product to User Basket: Endpoint to add a product to a user's basket.
Update Product in User Basket: Endpoint to update a product quantity in the user's basket.
Complete User Basket: Endpoint to finalize the selection and prepare for order.
User Order: Endpoint for a user to place an order.
Admin Complete Order: Endpoint for an admin to mark an order as completed.
Admin Delete Order: Endpoint for an admin to delete an order.
User Login: Endpoint for users to log in using credentials.
Google Login: Endpoint for users to log in using Google authentication.
Facbook Login: Endpoint for users to log in using Facbook authentication.
Reset Password via Email: Endpoint to initiate a password reset process via email.
Reset JWT Token: Endpoint to regenerate a new JWT token after expiration.
User Register: Endpoint for user registration. Google Register: Endpoint for user registration using Google authentication. FabebookLogin : Endpoint for user registration using Facebook authentication.
Validation filters are implemented using FluentValidation for robust input validation:
- CreateProductValidator: Validates
CreateProductCommandRequest
before processing, enforcing rules for product name, description, stock, and price.
Action filters, such as ValidationFilter
, intercept requests before execution to ensure data validity:
- ValidationFilter: Checks
ModelState.IsValid
before action execution. If invalid, it returns aBadRequestObjectResult
with detailed validation errors.
To get started with the project locally or on a server, follow these steps:
- [Instructions on setting up prerequisites, dependencies, and environment variables].
- [How to run the project locally or deploy it on a server].
- [Additional configuration steps, if any].
Explore the project's API endpoints using Swagger UI at [URL]. Here you can test and interact with various endpoints.
- Introduction
- Project Structure
- Onion Architecture Overview
- Implementation of Onion Architecture with .NET Framework
- Layers and Responsibilities
- Application Layer
- Domain Layer
- Infrastructure Layer
- Infrastructure
- Persistence
- Presentation Layer (API)
- CQRS Design Overview
- Mediator Design Implementation
- Advantages of the Project
- Example Usage Scenarios
- Product Addition or Update
- Viewing Product List
- Creating an Order
- Technical Details
- .NET Framework
- Onion Architecture Implementation
- CQRS and Mediator Design Utilization
- Authentication with JWT Token and Rerfresh Token
- Login with Google and Facebook
- Files are uploaded to Microsoft Azure storage
- Example Code Snippets
- Command or Query Processing
- Managing Commands and Queries using Mediator
- Conclusions and Recommendations
- Project Challenges and Solutions
- Lessons Learned
- Recommendations and Future Improvements
- Sources
- Sources of the technologies and designs used
- Azure Blob Storage Service
- Google Apis Auth