Onion Store is a modern e-commerce platform built with ASP.NET Core API and Onion Architecture.
This project utilizes Docker Compose to define and run a multi-container application consisting of:
1- Clone the Repository
git clone "https://github.com/ahmedeldamity/Mercora"
cd Mercora
2- Build and Start Containers
Use Docker Compose to build and start all containers defined in the docker-compose.yml
file.
docker-compose up --build
This command will build the necessary images (if not already built) and start the containers as defined.
3- Access the Services
http://localhost:8080
.Server=store_database;Database=StoreDatabase;User Id=sa;Password=PAssWord**;
.redis://localhost:6379
.Data for SQL Server and Redis is persisted using Docker volumes. Ensure that volumes are properly configured in docker-compose.yml to prevent data loss on container restarts.
The Entity-Relationship Diagram (ERD) for the SQL Server database is included below. This diagram illustrates the structure of the database, including tables, relationships, and key constraints.
The application includes a unified health check endpoint to monitor the status of various system components:
API versioning is supported to ensure backward compatibility as the API evolves. Clients can specify the version via the URL path, query string, or request headers.
The API uses multiple rate limiting strategies to manage traffic:
Health Check :
Method | Endpoint | Description |
---|---|---|
GET | /_health | Returns the health status of the system. |
Products:
Method | Endpoint | Description |
---|---|---|
GET | /api/product | Retrieve a list of products. |
GET | /api/product/{id} | Retrieve details of a specific product. |
POST | /api/product | Add a new product. |
PUT | /api/product/{id} | Update product. |
DELETE | /api/product/{id} | Delete a product. |
Brands :
Method | Endpoint | Description |
---|---|---|
GET | /api/brand | Retrieve a list of brands. |
GET | /api/brand/{id} | Retrieve details of a specific brand. |
GET | /api/brand/search | Retrieve details of a specific brand. |
POST | /api/brand | Add a new brand |
PUT | /api/brand/{id} | Update brand. |
DELETE | /api/brand/{id} | Delete a brand. |
Categories :
Method | Endpoint | Description |
---|---|---|
GET | /api/category | Retrieve a list of categories. |
GET | /api/category/{id} | Retrieve details of a specific category. |
GET | /api/category/search | Retrieve details of a specific category. |
POST | /api/category | Add a new category |
PUT | /api/category/{id} | Update category. |
DELETE | /api/category/{id} | Delete a category. |
Delivery Methods :
Method | Endpoint | Description |
---|---|---|
GET | /api/DeliveryMethod | Retrieve a list of Delivery Methods. |
GET | /api/DeliveryMethod/{id} | Retrieve details of a specific Delivery Method. |
POST | /api/DeliveryMethod | Add a new Delivery Method |
PUT | /api/DeliveryMethod/{id} | Update Delivery Method. |
DELETE | /api/DeliveryMethod/{id} | Delete a Delivery Method. |
Account :
Method | Endpoint | Description |
---|---|---|
Post | /api/v1.0/Account/register | Register a new user and receive a JWT token V-1.0 |
Post | /api/v2.0/Account/register | Register a new user and receive a JWT token V-2.0 |
Post | /api/v2.1/Account/register | Register a new user and receive a JWT token V-2.1 |
Post | /api/v1.0/Account/login | Authenticate a user and receive a JWT token V-1.0 |
Post | /api/v2.0/Account/login | Authenticate a user and receive a JWT token V-2.0 |
POST | /api/v1/Account/google-login | Authenticate a user and receive a JWT token. |
GET | /api/v1/Account | Get Current User. |
GET | /api/v1/Account/refresh-token | Get New Refresh Token. |
Post | /api/v1/Account/revoke-token | Revoke Refresh Token. |
Authentications :
Method | Endpoint | Description |
---|---|---|
Post | /api/v1/Auth/send-email-verification-code | Send Email Verification Code V-1.0 |
Post | /api/v2/Auth/send-email-verification-code | Send Email Verification Code V-2.0 |
Post | /api/v1/Auth/verify-register-code | Verify Register Code. |
Post | /api/v1/Auth/send-password-verification-code | Send Password Reset Email V-1.0 |
Post | /api/v2/Auth/send-password-verification-code | Send Password Reset Email V-2.0 |
Post | /api/v1/Auth/Verify-Reset-Code | Verify Reset Code. |
Post | /api/v1/Auth/change-password | Change Password. |
Basket :
Method | Endpoint | Description |
---|---|---|
Post | /api/Basket | Create or Update Basket. |
GET | /api/Basket/{id} | Retrieve the current user's basket. |
DELETE | /api/Basket/{id} | Delete Basket. |
Payment :
Method | Endpoint | Description |
---|---|---|
Post | /api/Payment/{{basketId}} | Create or Update Payment. |
Order :
Method | Endpoint | Description |
---|---|---|
Post | /api/Order | Create Order. |
GET | /api/Order | Get User Orders. |
GET | /api/Order/{{id}} | Get Order By Id |
To stop and remove all running containers, use:
docker-compose down