EcomProject
A modular E-Commerce learning project built using ASP.NET Core Web API, ASP.NET Core MVC, and Entity Framework Core with SQL Server. This solution is structured into independent API, Data, and MVC layers following clean, maintainable practices.
π Tech Stack
ASP.NET Core 10 (Web API + MVC)
Entity Framework Core + SQL Server
EF Core Migrations (Category & Product tables)
Repository Pattern
Swagger / OpenAPI
JWT Authentication (Implemented inside Ecom.API only)
π Solution Structure EcomProject β βββ Ecom.API β REST API (Category & Product CRUD + JWT Auth) β βββ Controllers β βββ JWT authentication (local to this project) β βββ Swagger documentation β βββ Ecom.Data β Data Access Layer β βββ DbContext (EcomDbContext) β βββ Entities (Category, Product) β βββ Repositories (Interface + Implementation) β βββ Migrations (EF Core) β βββ Ecom.MVC β MVC Frontend (to consume API later) βββ Controllers βββ Views βββ Models
π Authentication
JWT Authentication is implemented only inside Ecom.API
Login endpoint returns a JWT token
API endpoints validate the token
AuthService.API is NOT integrated yet (planned future step)
ποΈ Database
Using SQL Server
EF Core migrations executed successfully
Tables created:
Categories
Products
Products have a foreign key referencing Categories
π Current Features β Category API
Get all categories
Get category by ID
Create category
Update category
Delete category
β Product API
Get all products
CRUD operations
Category relationship included
β Database Layer
Fully implemented repository pattern
EF Core migrations applied
SQL Server connection configured
MVC created
API integration (calling Ecom.API) coming soon
π Upcoming Features
Full integration of MVC UI β Ecom.API
Move Authentication to AuthService.API (external microservice)
Add custom JWT middleware
Product image upload
Pagination / filtering / sorting
Admin & user roles
Deployment
π§ͺ Testing the API (Swagger)
Run API and open:
https://localhost:/swagger
In appsettings.json of Ecom.API:
"ConnectionStrings": { "DefaultConnection": "your SQL Server connection string" }
2οΈβ£ Apply Migration (already done but for future updates) dotnet ef database update --project Ecom.Data
3οΈβ£ Run API dotnet run --project Ecom.API
4οΈβ£ Run MVC (UI) dotnet run --project Ecom.MVC
π€ Contributions
This is a learning project β improvements and suggestions are welcome.
β Support
If this project helps you in interviews or learning, please β the repository!