Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ahmedeldamity/mercora
Mercora is a modern e-commerce platform built with ASP.NET Core API designed with a focus on Clean Architecture.
https://github.com/ahmedeldamity/mercora
asp-net-core caching csharp docker docker-image dockerfile dotnet-core ecommerce-api health-check net8 onion-architecture rate-limiting redis sql-server stripe-payments
Last synced: 28 days ago
JSON representation
Mercora is a modern e-commerce platform built with ASP.NET Core API designed with a focus on Clean Architecture.
- Host: GitHub
- URL: https://github.com/ahmedeldamity/mercora
- Owner: ahmedeldamity
- Created: 2024-08-02T13:45:24.000Z (3 months ago)
- Default Branch: master
- Last Pushed: 2024-10-09T19:43:37.000Z (28 days ago)
- Last Synced: 2024-10-09T22:23:41.190Z (28 days ago)
- Topics: asp-net-core, caching, csharp, docker, docker-image, dockerfile, dotnet-core, ecommerce-api, health-check, net8, onion-architecture, rate-limiting, redis, sql-server, stripe-payments
- Language: C#
- Homepage:
- Size: 559 KB
- Stars: 17
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
🚀 Mercora
[MicrosoftSQLServer]: https://img.shields.io/badge/Microsoft%20SQL%20Server-CC2927?style=for-the-badge&logo=microsoft%20sql%20server&logoColor=white
[.Net]: https://img.shields.io/badge/.NET-5C2D91?style=for-the-badge&logo=.net&logoColor=white
[C#]: https://custom-icon-badges.demolab.com/badge/C%23-%23239120.svg?logo=cshrp&style=for-the-badge&logoColor=white
[JSON]: https://img.shields.io/badge/JSON-000?logo=json&style=for-the-badge&logoColor=white
[Docker]: https://img.shields.io/badge/Docker-2496ED?style=for-the-badge&logo=docker&logoColor=white
[Redis]: https://img.shields.io/badge/Redis-DC382D?style=for-the-badge&logo=redis&logoColor=white
[Stripe]: https://img.shields.io/badge/Stripe-5851DD?style=for-the-badge&logo=stripe&logoColor=white![MicrosoftSQLServer]
![.Net]
![C#]
![JSON]
![Docker]
![Redis]
![Stripe]
Mercora is a modern e-commerce platform built with ASP.NET Core API designed with a focus on Clean Architecture.## 🐳 Docker Compose
This project utilizes Docker Compose to define and run a multi-container application consisting of:
- Redis Caching: Provides caching capabilities to enhance performance.
- SQL Server Database: Serves as the data storage for the application.
- API: Hosts the application's backend logic and endpoints.## 💎 Prerequisites
## 🎇 Setup and Configuration
**1- Clone the Repository**
```bash
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.
```bash
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**
- API: Access the API at `http://localhost:8080`.
- SQL Server Database: Connect to the SQL Server using the connection string `Server=store_database;Database=StoreDatabase;User Id=sa;Password=PAssWord**;`.
- Redis Caching: Redis can be accessed at `redis://localhost:6379`.
## Persisting Data
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.
## Database ERD
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.
![image](https://github.com/user-attachments/assets/d7723c57-a4f1-47df-b98d-8afb7c467e11)
## ✔️ Health Check
**The application includes a unified health check endpoint to monitor the status of various system components:**
- SQL Server Database: Ensures the connection to the store database is healthy.
- Redis Caching: Verifies the availability and functionality of the Redis caching system.
- Hangfire Job Processing: Checks the status of Hangfire to ensure background jobs are being processed correctly.
- Mail Service: Monitors the mail service to confirm that emails can be sent.
## 🔄 API Versioning
**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.**
## ⏳ Rate Limiting
**The API uses multiple rate limiting strategies to manage traffic:**
- Fixed Window: Limits requests within a defined time window.
- Sliding Window: Allows a smoother request flow by checking limits within a moving time window.
- Concurrency Limit: Restricts the number of concurrent requests being processed at the same time.
## API Endpoints
**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 |
## ⚔ Stopping and Removing Containers
To stop and remove all running containers, use:
```bash
docker-compose down
```