Skip to content

omidsotooni/Shop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

121 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›’ Shop - ASP.NET Core Clean Architecture E-Commerce

A modular e-commerce web application built with ASP.NET Core (.NET 10), Clean Architecture, and PostgreSQL.

It includes an admin panel, product management, shopping cart, orders, payments, blog system, and background jobs.


πŸš€ Tech Stack

  • ASP.NET Core (.NET 10)
  • Entity Framework Core 10
  • PostgreSQL (Npgsql)
  • Clean Architecture
  • Cookie Authentication (Role-based Authorization)
  • Hangfire (Background Jobs)
  • Swagger (API Documentation)

✨ Features

  • Clean Architecture (Domain / Application / Infrastructure / Presentation)
  • Admin panel (Products, Categories, Blog, Users)
  • Role-based authentication & authorization
  • Shopping cart system
  • Order & payment system (ZarinPal / IDPay integration)
  • Background jobs with Hangfire
  • Blog system with SEO-friendly routing
  • Pagination, search, and filtering

πŸ“ Project Structure

Shop/
β”œβ”€β”€ EndPoint.Site (Presentation Layer)
β”‚   β”œβ”€β”€ Controllers
β”‚   β”œβ”€β”€ Areas (Admin)
β”‚   β”œβ”€β”€ Views
β”‚   β”œβ”€β”€ wwwroot
β”‚   β”œβ”€β”€ ViewComponents
β”‚   β”œβ”€β”€ Models
β”‚   └── RestApis
β”‚
β”œβ”€β”€ Shop.Application
β”‚   β”œβ”€β”€ Dtos
β”‚   β”œβ”€β”€ Interfaces
β”‚   └── Services
β”‚
β”œβ”€β”€ Shop.Domain
β”‚   └── Entities
β”‚
β”œβ”€β”€ Shop.Infrastructure
β”‚   β”œβ”€β”€ Contexts
β”‚   β”œβ”€β”€ Migrations
β”‚   └── Persistence
β”‚
β”œβ”€β”€ Shop.Common
β”‚   β”œβ”€β”€ Helpers
β”‚   β”œβ”€β”€ Roles
β”‚   └── Utilities

Infrastructure layer contains implementations for external dependencies such as database access (EF Core) and third-party services.


βš™οΈ How to Run

1. Clone repository

git clone <repo-url>
cd Shop

2. Configure database

2. Configure database

Update connection string in appsettings.json:

"ConnectionStrings": {
  "DefaultConnection": "YOUR_CONNECTION_STRING"
}

Update connection string in EndPoint.Site/Program.cs:

Host=127.0.0.1;Port=5432;Database=ShopDB;Username=postgres;Password=123456

3. Install EF tools (if needed)

dotnet tool install --global dotnet-ef

4. Run migrations

dotnet ef database update \
--project Shop.Infrastructure \
--startup-project EndPoint.Site \
--context DataBaseContext

5. Run project

dotnet run --project EndPoint.Site

πŸ” Authentication

  • Cookie-based authentication

  • Role-based policies:

    • Admin
    • Operator
    • Customer
    • Author

Configured in Program.cs


🧠 Architecture Notes

This project follows Clean Architecture:

Domain

  • Core entities and business rules

Application

  • DTOs, interfaces, services, business logic

Infrastructure

  • EF Core DbContext
  • Database access
  • Migrations

EndPoint.Site

  • ASP.NET Core MVC UI
  • Controllers / Views / REST APIs
  • Dependency Injection setup

Common

  • Shared helpers, roles, DTO utilities

🎯 Purpose

This project demonstrates:

  • Clean Architecture in ASP.NET Core
  • Scalable e-commerce backend design
  • Integration with payment gateways
  • Background job processing using Hangfire

πŸ§ͺ Future for Improvements

  • Docker support
  • Unit & Integration tests
  • CI/CD pipeline (GitHub Actions)
  • Caching (Redis)

πŸ”§ Important Notes

  • Migrations must be executed from Infrastructure project
  • Startup project is EndPoint.Site
  • DbContext is located in Shop.Infrastructure
  • Use EF CLI instead of Add-Migration in PowerShell

πŸš€ Getting Started (Quick Run)

git clone <repo-url>
cd Shop
dotnet ef database update --project Shop.Infrastructure --startup-project EndPoint.Site
dotnet run --project EndPoint.Site

---

## πŸ“Œ License

MIT License

About

Clean Architecture E-Commerce platform built with ASP.NET Core (.NET 10), PostgreSQL, and Hangfire. Includes admin panel, payments, blog, and background jobs.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors