This is a Backend API for a Restaurant Management System in .NET Framework using CQRS pattern and DDD.
The API can be accessed at the following URLs:
- Language: C#
- Framework: .NET LTS
- Database: SQL Server / Azure SQL
- ORM: Entity Framework Core
- Validation: FluentValidation
- Logging: Serilog, Azure Application Insights
- API Documentation: Swagger
- Testing: xUnit, Moq
- CI/CD: GitHub Actions
- Deployment: Azure App Service, Azure Storage Service
- Design Patterns: CQRS, Mediator, Repository, Domain-Driven Design
This project contains the API layer of the Restaurants application. It includes controllers, middlewares, and extensions for setting up the API.
- Controllers: Handles HTTP requests and responses.
- Extensions: Contains extension methods for configuring services.
- Middlewares: Custom middleware for handling errors and request timing.
- Program.cs: Entry point of the API application.
This project contains the application layer, which includes business logic and application services.
This project contains the domain layer, which includes domain entities and business rules.
This project contains the infrastructure layer, which includes data access and external service integrations.
This folder contains unit and integration tests for the various projects.
- Restaurants.API.Tests: Tests for the API layer.
- Restaurants.Application.Tests: Tests for the application layer.
- Restaurants.Domain.Tests: Tests for the domain layer.
- Restaurants.Infrastructure.Tests: Tests for the infrastructure layer.
To build and run the solution, follow these steps:
- Clone the repository.
- Open the solution file
Restaurants.sln
in your favorite IDE. - Build the solution.
- Create a .env file in the
src/Restaurants.API
directory (example provided in .env.example) - Run the
Restaurants.API
project. - (Optional) Run the unit tests with
dotnet test -e APPLICATIONINSIGHTS_CONNECTION_STRING="<your-connection-string>"
Configuration files for the API project are located in the src/Restaurants.API/
directory:
appsettings.Development.json
: Development-specific configuration settings.
The solution uses Serilog for logging. Configuration for Serilog can be found in the Program.cs
file of the Restaurants.API
project. The logs are generated in the console, in log files within the src/Restaurants.API/Logs
directory, and in Application Insights (connection string to be defined in .env file).
Swagger is used for API documentation. It is configured in the AddPresentation
method in the WebApplicationBuilderExtensions
class located in src/Restaurants.API/Extensions/WebApplicationBuilderExtensions.cs
. The swagger UI can be accessed at /swagger
endpoint.
Custom middleware for error handling and request timing is registered in the AddPresentation
method and used in the Program.cs
file of the Restaurants.API
project.
The Restaurants.Infrastructure
project includes a seeder for initializing the database with sample data. It is invoked in the Program.cs
file of the Restaurants.API
project.
This project is licensed under the MIT License.