Skip to content

Mariomedhat899/Store.G02.V2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

78 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Store API V2 πŸ›’

A scalable, enterprise-grade E-commerce backend built with ASP.NET Core Web API following Clean Architecture principles.

License ASP.NET Core C# Swagger


πŸ“‹ Table of Contents


✨ Features

Feature Description
πŸ”Ή Product Catalog Full CRUD with advanced filtering by Brand, Type, Price & Search
πŸ”Ή Pagination & Sorting Optimized queries for large datasets with configurable page size
πŸ”Ή Specification Pattern Encapsulated query logic for clean, reusable filtering/sorting
πŸ”Ή Generic Repository + UoW Abstracted data access with transactional consistency
πŸ”Ή DTO + AutoMapper Decoupled API contracts with efficient object mapping
πŸ”Ή Global Error Handling Consistent error responses with detailed diagnostics
πŸ”Ή JWT Authentication Secure endpoints with role-based authorization
πŸ”Ή Swagger UI Interactive API documentation with try-it-out support

πŸ—οΈ Architecture & Design Patterns

Store.G02.V2/ β”œβ”€β”€ Core/ # Domain Entities, Interfaces, Specifications β”‚ β”œβ”€β”€ Entities/ # Aggregates & Value Objects β”‚ β”œβ”€β”€ Interfaces/ # Repository & Service contracts β”‚ └── Specifications/ # Query specification implementations β”‚ β”œβ”€β”€ Infrastructure/ # External Implementations β”‚ β”œβ”€β”€ Data/ # EF Core DbContext & Migrations β”‚ β”œβ”€β”€ Repositories/ # Concrete Repository implementations β”‚ └── Services/ # Email, File Storage, Auth services β”‚ β”œβ”€β”€ Shared/ # Cross-cutting Concerns β”‚ β”œβ”€β”€ DTOs/ # Request/Response models β”‚ β”œβ”€β”€ Exceptions/ # Custom exception types β”‚ └── Helpers/ # Utilities & Extensions β”‚ └── Store.G02.V2/ # Presentation Layer (API) β”œβ”€β”€ Controllers/ # REST API endpoints β”œβ”€β”€ Middleware/ # Global error handling, logging └── Properties/ # appsettings, launchSettings

Patterns Implemented:

  • βœ… Clean Architecture – Separation of concerns, dependency inversion
  • βœ… Repository + Unit of Work – Testable, transactional data access
  • βœ… Specification Pattern – Reusable, composable query logic
  • βœ… Generic Repository – DRY CRUD operations across entities
  • βœ… DTO Pattern – Secure, versioned API contracts
  • βœ… Dependency Injection – Built-in .NET Core DI container

πŸ—‚οΈ Project Structure

πŸ“¦ Store.G02.V2.sln β”œβ”€β”€ πŸ“ Core/ β”‚ β”œβ”€β”€ πŸ“„ Product.cs, Brand.cs, Type.cs β”‚ β”œβ”€β”€ πŸ“„ IRepository.cs, IUnitOfWork.cs β”‚ └── πŸ“„ BaseSpecification.cs, ISpecification β”‚ β”œβ”€β”€ πŸ“ Infrastructure/ β”‚ β”œβ”€β”€ πŸ“„ StoreContext.cs (EF Core) β”‚ β”œβ”€β”€ πŸ“„ ProductRepository.cs β”‚ └── πŸ“„ AuthService.cs (JWT Implementation) β”‚ β”œβ”€β”€ πŸ“ Shared/ β”‚ β”œβ”€β”€ πŸ“„ ProductDto.cs, PaginationDto.cs β”‚ β”œβ”€β”€ πŸ“„ ApiException.cs, ApiResponse β”‚ └── πŸ“„ MappingProfiles.cs (AutoMapper) β”‚ └── πŸ“ Store.G02.V2/ (API Project) β”œβ”€β”€ πŸ“„ Program.cs, appsettings.json β”œβ”€β”€ πŸ“„ ProductsController.cs, AuthController.cs └── πŸ“„ SwaggerConfig.cs

πŸ› οΈ Tech Stack

Layer Technology
Framework ASP.NET Core 7/8 Web API
Language C# 12 with modern features
ORM Entity Framework Core
Database SQL Server (LocalDB/Production)
Mapping AutoMapper
Auth JWT Bearer Tokens, ASP.NET Core Identity
Docs Swagger/OpenAPI 3.0
Testing xUnit/MSTest ready structure
Tools Postman, Bruno, Swagger UI

πŸš€ Getting Started

Prerequisites

Quick Start

# 1. Clone the repository
git clone https://github.com/Mariomedhat899/Store.G02.V2.git
cd Store.G02.V2

# 2. Restore NuGet packages
dotnet restore

# 3. Configure connection string
# Edit: Store.G02.V2/appsettings.json
"ConnectionStrings": {
  "DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=StoreG02V2;Trusted_Connection=True;"
}

# 4. Apply Entity Framework migrations
Update-Database
# OR via CLI:
dotnet ef database update

# 5. Run the API
dotnet run --project Store.G02.V2
# Or press F5 in Visual Studio

---
πŸ” Authentication & Authorization
This API supports JWT-based authentication for protected endpoints:
POST /api/auth/login
Content-Type: application/json

{
  "email": "user@example.com",
  "password": "yourPassword123"
}
Response:
{
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "expiresIn": 3600,
  "user": { "id": "guid", "email": "user@example.com", "roles": ["Customer"] }
}
Use the token in subsequent requests:
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
---
πŸ—„οΈ Database & Migrations
# Add a new migration
Add-Migration AddProductImageUrl -Context StoreContext

# Update database
Update-Database -Context StoreContext

# Script migration for deployment
Script-Migration -Context StoreContext

# Remove last migration (if needed)
Remove-Migration -Context StoreContext

Seed Data: Initial Brands, Types, and sample Products are seeded on first run.

πŸ›’ ASP.NET Core E-commerce API | Clean Architecture + Repository + Specification Pattern | JWT Auth | EF Core + SQL Server | Swagger Docs

About

πŸ›’ ASP.NET Core E-commerce API | Clean Architecture + Repository + Specification Pattern | JWT Auth | EF Core + SQL Server | Swagger Docs

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages