A scalable e-commerce platform built with modern architectural patterns and best practices. This platform leverages Entity Framework, LINQ, and follows Clean Architecture principles to provide a robust solution for e-commerce needs.
The project is structured into the following layers:
src/
├── Talabat.APIs/ # API controllers and presentation layer
├── Talabat.Core/ # Domain entities, interfaces, business logic
├── Talabat.Repository/ # Data access implementation
├── Talabat.Services/ # Business services implementation
- Talabat.APIs: Contains API controllers, filters, and configuration
- Talabat.Core: Houses domain entities, interfaces, and core business logic
- Talabat.Repository: Implements data access patterns and database operations
- Talabat.Services: Contains business service implementations and external integrations
- Onion Architecture: Separation of concerns and maintainability.
- Repository Pattern: Abstraction of the data access layer and consistent interface for querying the database.
- Unit of Work Pattern: Management of the context and transaction of the Entity Framework.
- Specification Pattern: Building complex queries in a composable and maintainable way.
- Stripe Payment Gateway: Integration with Stripe for payment processing.
- .NET 6.0 SDK
- Docker and Docker Compose
- Visual Studio 2022 or VS Code
-
Clone the repository:
git clone https://github.com/Mo7ammedd/Talabat-APIs.git cd Talabat-APIs
-
Build and run the containers:
docker-compose up --build
This will start:
- Talabat API on port 8080
- Redis on port 6379
- SQL Server on port 1433
-
Update the connection strings in
appsettings.json
:{ "ConnectionStrings": { "DefaultConnection": "Server=localhost;Database=TalabatDb;User=sa;Password=YourStrong!Passw0rd;", "IdentityConnection": "Server=localhost;Database=TalabatIdentity;User Id=sa;Password=YourStrong!Passw0rd;" }, "Redis": { "ConnectionString": "localhost:6379" }, "Jwt": { "SecretKey": "7f98e3b1-4b7b-4b7b-8b7b-7b7b7b7b7b7b", "ValidIssuer": "https://localhost:7284/", "ValidAudience": "Mohammed-Mostafa-Apis-Client", "TokenLifeTime": 60 } "StripeSettings": { "PublishableKey": "", "SecretKey": "" } }
-
Run the application:
dotnet restore dotnet run --project Talabat.APIs
- API documentation available at
https://localhost:7284/swagger/index.html
- Detailed endpoint documentation in the
Talabat.APIs
project - Postman documentation available here
- Make changes to the code
- Build the Docker image:
docker-compose build
- Run the containers:
docker-compose up
- Access the API at
http://localhost:8080
AccountController
POST /api/account/login
: Login a userPOST /api/account/register
: Register a new userGET /api/account
: Get the current userGET /api/account/address
: Get the user's addressPUT /api/account/address
: Update the user's addressGET /api/account/emailexists
: Check if an email existsPUT /api/account/update
: Update the user's informationPUT /api/account/updatepassword
: Update the user's password
BasketController
GET /api/basket
: Get a basket by IDPOST /api/basket
: Update a basketDELETE /api/basket/id
: Delete a basket by ID
ErrorsController
GET /errors/{code}
: Handle errors
OrderController
POST /api/order
: Create a new orderGET /api/order
: Get orders for the current userGET /api/order/{id}
: Get an order by IDGET /api/order/deliveryMethods
: Get delivery methods
ProductsController
GET /api/products
: Get a list of productsGET /api/products/{id}
: Get a product by IDGET /api/products/brands
: Get a list of product brandsGET /api/products/categories
: Get a list of product categories
# Run unit tests
dotnet test
# Run the application with Docker
docker-compose up
- Health checks available at
/health
- Logs are written to console and can be viewed using
docker-compose logs
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a pull request
This project is licensed under the MIT License.
For support, please create an issue in the repository.