Skip to content

Repository files navigation

ECommerce API - Backend 🖥️

This is the REST API for the Maxi Market project, built on ASP.NET Core 10 Web API and using Entity Framework Core to interact with SQL Server.


🏛️ Architecture & Design Principles

The backend is developed following SOLID principles and a clean, layered architecture:

  1. Controllers (Controllers/): HTTP entry points that handle REST requests and return structured responses. All controllers delegate logic to the service layer.
  2. Services (Services/): Business logic layer divided into interfaces and implementation classes (Interfaces/ and Implementation/). It promotes decoupling through dependency injection.
  3. Data Transfer Objects (DTOs/): Classes representing the data contract exposed to the outside. They are divided into ReadDTO (reading), CreateDTO (creation), and UpdateDTO (editing) to prevent the leakage of sensitive or unnecessary properties (such as passwords).
  4. Models (Models/): Represent the physical tables of the SQL Server database.
  5. Auto Mapping: AutoMapper is used to perform bidirectional conversions between entities and DTOs in an automated and transparent way.

🛠️ Technologies Used

  • Runtime & Framework: .NET 10 (C#)
  • Data Access: Entity Framework Core 10
  • Database: Microsoft SQL Server
  • Key Libraries: AutoMapper & AutoMapper.Extensions.Microsoft.DependencyInjection

📋 API Endpoints

Controller Method Route Description
Auth POST /api/auth/login Log in user and return simulated token
Brands GET /api/brands Retrieve all registered brands
Brands GET /api/brands/{id} Retrieve a brand by ID
Brands POST /api/brands Register a new brand
Brands PUT /api/brands/{id} Update an existing brand
Brands DELETE /api/brands/{id} Delete a brand from the database
Categories GET /api/categories Retrieve all categories
Categories GET /api/categories/{id} Retrieve a category by ID
Categories POST /api/categories Register a new category
Categories PUT /api/categories/{id} Update an existing category
Categories DELETE /api/categories/{id} Delete a category
Products GET /api/products Retrieve products with query filters
Products GET /api/products/{id} Retrieve details of a product by ID
Products POST /api/products Register a new product
Products PUT /api/products/{id} Update an existing product
Products DELETE /api/products/{id} Delete a product

⚙️ Configuration & Execution

Prerequisites

  • .NET 10 SDK installed.
  • Running instance of SQL Server (LocalDB or other).

Running the App

  1. Open the appsettings.json file and update the connection string DefaultConnection if necessary:
    "ConnectionStrings": {
      "DefaultConnection": "Server=YOUR_SERVER;Database=ECommerceDb;Trusted_Connection=True;TrustServerCertificate=True;"
    }
  2. Restore NuGet packages and build the backend:
    dotnet build
  3. Run the backend server:
    dotnet run
    Note: On the first run, the application will automatically create the database if it does not exist and seed initial test data for brands, categories, users, and products.

About

API RESTful de comercio electrónico (E-Commerce) desarrollada con ASP.NET Core 10, Entity Framework Core, SQL Server y principios SOLID.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages