A robust, production-ready e-commerce platform built with ASP.NET Core 8, featuring a modular architecture for scalability and maintainability. The project supports a full product catalog, shopping cart, secure authentication, order management, and real-time payment processing via Stripe. Designed for both customers and administrators, it leverages modern .NET technologies and best practices for a seamless shopping and management experience.
- Features
- Tech Stack
- Project Structure
- Getting Started
- Configuration
- API Endpoints
- Usage
- Testing
- Deployment
- Architecture Overview
- Contributing
- License
- Product catalog with advanced filtering, sorting, and search
- Shopping cart and basket management (with Redis caching)
- Secure user authentication and registration (ASP.NET Identity)
- Order management and checkout process
- Stripe payment integration for real-time transactions
- Admin panel for product and order management
- RESTful API architecture
- Entity Framework Core with SQL Server
- Redis integration for caching and basket storage
- AutoMapper for DTO mapping
- Swagger/OpenAPI documentation
- Exception handling middleware
- Seeding for initial data and users
- Backend: ASP.NET Core 8, Entity Framework Core
- Database: SQL Server
- Cache: Redis (StackExchange.Redis)
- Authentication: ASP.NET Identity
- Payments: Stripe
- API Documentation: Swagger
- Other: AutoMapper, StackExchange.Redis
E-Commerce.NET/
├── Store.Data/ # Data access, entities, and migrations
├── Store.Repository/ # Repository pattern, specifications, and unit of work
├── Store.Service/ # Business logic, services, DTOs, token service, payment integration
├── Store.Web/ # Web API, controllers, middleware, startup
- .NET 8.0 SDK
- SQL Server
- Redis
- Stripe Account for payment processing
- Clone the repository:
git clone https://github.com/omarovici/E-Commerce.NET.git cd E-Commerce.NET - Configure connection strings and Stripe keys:
- Update
DefaultConnection,IdentityConnection, andRedisinStore.Data/Store.Web/appsettings.jsonandappsettings.Development.json. - Add your Stripe API keys under the
Stripesection:"Stripe": { "SecretKey": "your_stripe_secret_key", "PublishableKey": "your_stripe_publishable_key" }
- Update
- Apply migrations and seed data:
- The application will automatically apply migrations and seed data on first run.
- Run the application:
dotnet run --project Store.Data/Store.Web/Store.Web.csproj
- Access the API:
- Swagger UI: https://localhost:5001/swagger
- appsettings.json: Contains connection strings and configuration for logging, Redis, Stripe, and other services.
- Environment Variables:
DefaultConnection: SQL Server connection string for main dataIdentityConnection: SQL Server connection string for identity/authRedis: Redis connection string (e.g.,localhost:6379)Stripe:SecretKeyandStripe:PublishableKey: Stripe API keys
GET /api/products/getallbrands— Get all product brandsGET /api/products/getalltypes— Get all product typesGET /api/products/getallproducts— List products with filtering, sorting, and paginationGET /api/products/getproductbyid?id={id}— Get product details by ID
GET /api/basket/{id}— Retrieve basket by IDPOST /api/basket— Update or create basketDELETE /api/basket/{id}— Delete basket by ID
POST /api/account/login— User loginPOST /api/account/register— User registrationGET /api/account/getcurrentuserdetails— Get details of the currently authenticated user
POST /api/order/createorderasync— Create a new orderGET /api/order/getallordersforuserasync— List all orders for the current userGET /api/order/getorderbyidasync?id={id}— Get order details by order IDGET /api/order/getalldeliverymethodsasync— Get all available delivery methods
POST /api/payment/createorupdatepaymentintent— Create or update Stripe payment intentPOST /api/payment/webhook— Stripe webhook endpoint for payment events
For a full list and details, use the Swagger UI.
- Use the Swagger UI to explore and test API endpoints.
- Register as a user, browse products, add items to the cart, and place orders.
- Admin users can manage products and orders via the API.
- Payments are processed securely via Stripe.
- Unit and integration tests can be added using xUnit or NUnit.
- To run tests (if available):
dotnet test
- Update connection strings and environment variables for production.
- Use
dotnet publishto build and deploy the application. - Configure your web server (IIS, Nginx, Apache) to serve the published files.
- Ensure SQL Server, Redis, and Stripe are accessible from your deployment environment.
- Repository Pattern: Abstracts data access logic for maintainability and testability.
- Specification Pattern: Enables flexible and reusable query logic.
- Unit of Work: Manages transactions and repository instances.
- DTOs and AutoMapper: Clean separation between data models and API contracts.
- Middleware: Handles exceptions and cross-cutting concerns.
- Seeding: Ensures initial data and admin users are available on first run.
- Stripe Integration: Handles payment processing securely and efficiently.
- Fork the repository
- Create your feature branch (
git checkout -b feature/YourFeature) - Commit your changes (
git commit -am 'Add new feature') - Push to the branch (
git push origin feature/YourFeature) - Open a pull request
This project is licensed under the MIT License.