ZStore.Net is an e-commerce platform built with ASP.NET Core MVC, Entity Framework Core and MS SQL Server, with a CI/CD pipeline that builds and deploys on every merge.
It is the .NET counterpart of ZStore.JEE: the same domain — an online store — rebuilt on a different platform, to compare how each ecosystem shapes the code.
Goals#
The aim was not to invent a new kind of shop, but to build a familiar one properly: a codebase where adding a feature doesn't mean touching unrelated code, where the database schema evolves with the code instead of drifting from it, and where shipping is a git push rather than a checklist.
What it does#
- Product catalogue — categories, product listings with images and descriptions, and inventory tracking
- Shopping cart — persisted for signed-in users
- Checkout — a multi-step flow from address to confirmation
- Order management — customers follow their orders; admins manage fulfilment from placement to delivery
- User accounts — registration, login, profile and order history with ASP.NET Core Identity
- Role-based access — attribute-based authorization separating administrators from customers
- Admin dashboard — manage products, categories, users and orders from one panel
- CI/CD — automated build and deployment on every merge
Architecture#
Browser
│
Razor views (server-rendered MVC)
│
Controllers HTTP only: bind input, pick a view
└── Services business rules
└── Repositories data access
└── Entity Framework Core
└── MS SQL ServerZStore.Net/
├── Controllers/ # HTTP handlers
├── Services/ # business logic interfaces + implementations
├── Repositories/ # data access layer
├── Models/ # domain entities
├── ViewModels/ # view-specific DTOs
├── Views/ # Razor templates
└── Migrations/ # EF Core migration historyKey decisions#
Keep controllers thin#
The most common way an MVC codebase decays is the fat controller: business rules, queries and view logic all in one action method. Here controllers only bind input and choose a view. Business rules live in services, data access in repositories, and both are registered through ASP.NET Core's built-in dependency injection — so a service can be tested without an HTTP request, and a repository swapped without touching the rules above it.
View models between domain and view#
Razor views receive view models, not entities. That keeps the domain model free to change without breaking templates, and prevents a view from accidentally lazy-loading half the database or exposing fields it should never render.
Schema as code#
Entity Framework Code-First migrations manage the database schema. Each feature that changes the model ships with its migration, committed alongside the code, so any checkout of the repository can rebuild the exact schema it expects with dotnet ef database update. No manual SQL scripts, no "works on my database".
Shipping on every merge#
Every merge to main runs the pipeline:
# simplified
on:
push:
branches: [main]
jobs:
build-and-deploy:
- dotnet test
- docker build + push
- deployTest, build a Docker image, deploy. Combined with Git Flow for branching, the main branch is always deployable and a release is just a merge.
Running it#
git clone https://github.com/ismailza/zstore.net
cd zstore.net
# With Docker
docker compose up --build
# Or locally
dotnet ef database update
dotnet run --project ZStore.NetResults#
- A layered structure that makes adding features straightforward without modifying unrelated code
- EF Core Code-First migrations eliminate manual schema management
- Automated CI/CD reduces deployment to a merge
- Docker gives the same runtime in development and production
What I learned#
Building the same store on Jakarta EE and on ASP.NET Core was one of the most useful comparisons I have made. The layering is identical on paper; the difference is how much the framework does for you. ASP.NET Core gives you dependency injection, identity and migrations out of the box — in the Jakarta EE version, each of those was a decision I had to make myself.
ZStore.net
ZStore.net is an e-commerce platform designed to manage product categories, user accounts, orders, and more. Built using ASP.NET Core, it provides a scalable and maintainable architecture with a focus on performance and modularity.
Table of Contents
Features
- Admin Panel for managing products, categories, and users
- User authentication and authorization
- Shopping cart functionality
- Order management
- Customizable storage options
- API documentation using Swagger
Technology Stack
- Backend: ASP.NET Core
- Database: Entity Framework Core with SQL Server
- ORM: Entity Framework Core
- Frontend: Razor Pages (for now, expandable to Angular/React)
- Hosting: Dockerized for easy deployment
- Documentation: Swagger
Getting Started
Prerequisites
- .NET 6 or later installed
- SQL Server or any other database of choice configured
- Visual Studio or VS Code
- Docker (optional, for containerized deployment)
Clone the Repository
git clone https://github.com/ismailza/zstore.net.gitSetup Configuration
- Open the project in Visual Studio or VS Code
- Create a file named appsettings.json in the root directory:
cp appsettings.Example.json appsettings.json- Create a connection string named ZStoreConnection in the appsettings.json file and replace the value with your database connection string:
"ConnectionStrings": {
"ZStoreConnection": "Server=localhost,1433;Database=dotnetcore;User Id=sa;Password=;Trusted_Connection=True;TrustServerCertificate=True;Integrated Security=False;MultipleActiveResultSets=true"
}- You can also configure other settings in the appsettings.json file, such as storage options, etc.
- For the storage options, you can choose between LocalStorage and other cloud storage providers like Azure Blob Storage, AWS S3, etc.
- For Cart storage, you can choose between Session storage and Cookie storage.
Database Setup
The project use SQL Server as the default database provider. You can change the database provider by modifying the connection string in the appsettings.json file.
You can use docker compose to run the SQL Server container:
docker-compose up -dIf you are using SQL Server, you can create the database by running the following commands in the Package Manager Console:
dotnet ef database updateRunning the Application
- Build and run the application:
dotnet run- Open your browser and navigate to https://localhost:5079
Docker Deployment
- Build the Docker image:
docker build -t zstore.net .- Run the Docker container:
docker run -d -p 5079:80 zstore.net- Open your browser and navigate to https://localhost:5079
Contributing
Feel free to fork this repository and submit pull requests. All contributions are welcome.
License
This project is licensed under the MIT License - see the LICENSE file for details.
MIT License Copyright (c) 2024 Ismail ZAHIR Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
