Skip to content

This E-Commerce API is designed to provide a complete solution for building and managing an online shopping platform. It allows developers to create robust e-commerce applications with features like user authentication, product management, order processing, and payment integration.

Notifications You must be signed in to change notification settings

Adelmuhammad-23/ECommerceAPI

Repository files navigation

E-Commerce API

Overview

The E-Commerce API is a backend solution for managing e-commerce operations like product management, category organization, and secure user authentication.
It is structured as a 3-Layered Architecture, inspired by Clean Architecture and Onion Architecture, ensuring high scalability, maintainability, and code reusability.


Features

Core Architecture

  1. Layered Design:
    • API Layer: Handles HTTP requests and responses (Presentation Layer).
    • Core Layer: Contains business logic, domain entities, and service interfaces.
    • Infrastructure Layer: Manages data access, repositories, and external services.
  2. CQRS Pattern: Command-query separation for better readability and performance.
  3. Generic Repository: Reusable design for database operations.

API Enhancements

  1. Pagination & Filtering: Efficient data retrieval with optional filters for name and price.
  2. Validation: Ensures input integrity with FluentValidation.
  3. API Documentation: Integrated with Swagger (JWT support included).

Security

  1. JWT Authentication: Secures API endpoints.
  2. Role-Based Access Control: Restricts permissions based on roles.
  3. CORS Policy: Controlled cross-origin access.

File Management

  1. Image Handling: Supports image upload and management for products.

Utilities

  1. Logging: Tracks application activity using Serilog (or any configured logger).
  2. Unit Testing: Reliable endpoint testing with XUnit.

Technologies Used

  • ASP.NET Core Web API
  • Entity Framework Core
  • JWT Authentication
  • FluentValidation
  • Swagger UI
  • XUnit
  • Serilog (or your preferred logging tool)

Setup Instructions

  1. Clone the repository:
    git clone https://github.com/AdelMuhammad-23/ECommerceAPI.git
    cd ECommerceAPI
  2. Configure database connection in appsettings.json.
  3. Apply database migrations:
    dotnet ef database update
  4. Run the application:
    dotnet run

Project Structure

- ECommerceAPI
  - API (Presentation Layer: Controllers & Middleware)
  - Core (Business Logic: Entities, DTOs, Interfaces)
  - Infrastructure (Data Access: Repositories, Migrations)

Endpoints

Categories

  • GET /api/Categories/CategoryList
    Retrieves paginated category list with optional filters.
  • GET /api/Categories/Get-Category-By{id}
    Fetches a specific category by ID.
  • POST /api/Categories/Add-Category
    Adds a new category.
  • PUT /api/Categories/Update-Category
    Updates an existing category.
  • DELETE /api/Categories/Delete-Category-By{id}
    Deletes a category by ID.

Products

  • GET /api/Products/ProductList
    Retrieves paginated product list with filters (name, price).
    Example filter usage:
    {
      "nameFilter": "phone",
      "priceFilter": 500
    }
  • GET /api/Products/Get-Product-By{id}
    Retrieves product details by ID.
  • POST /api/Products/AddProduct
    Adds a new product with image upload.
  • PUT /api/Products/Update-Product
    Updates product details.
  • DELETE /api/Products/Delete-Product-{id}
    Deletes a product by ID.

Future Enhancements

  • Integration with a payment gateway for secure transactions.
  • Adding user-friendly dashboards for admin analytics.
  • Real-time notifications for order updates.

About

This E-Commerce API is designed to provide a complete solution for building and managing an online shopping platform. It allows developers to create robust e-commerce applications with features like user authentication, product management, order processing, and payment integration.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages