- PostgresSQL 18.0.0 or higher
- Seeding- must be done manually as we are using Dapper
- Docker Desktop 4.79 or higher
- Docker Compose 5.1.4 or higher
Run the following SQL to initialise and seed the database (as we use Dapper in this microservice, we do not have migrations or automatic seeding):
- Build and run the docker-compose file
docker-compose -f docker-compose.yaml up --build-
Can access the service's Swagger UI at http://localhost:9090/swagger/index.html
-
stop the containers
docker-compose -f docker-compose.yaml down- If you wish to run docker manually instead of through docker-compose, or wish to push the docker image to Docker Hub, follow the instructions in ManualDockerInstructions.md
-
Uses the Clean Architecture (API / Core / Infrastructure) pattern, which keeps business rules independent of frameworks, databases, and external services.
- API – Exposes endpoints, handles requests/responses, authentication, and application configuration.
- Core – Contains domain models, business rules, use cases, and contracts/interfaces for external dependencies.
- Infrastructure – Implements persistence, external integrations, and other technical concerns defined by the Core.
-
The Layered Architecture is an alternative approach that organizes the application into layers (Presentation, Business Logic, Data Access), this is done to separate concerns and promote maintainability, but it can lead to tight coupling between layers and less flexibility in adapting to changes.
- I implemented the Product Service Micro-Service using this approach to demonstrate the differences between the two architectures and how Clean Architecture can provide better separation of concerns and flexibility in adapting to changes.
- Uses Dapper as the ORM (not EF)
- While EF is better for change tracking (migrations), and has LINQ support
- Dapper is better for high-performance latency-sensitive Microservices as can execute raw sql with minimal overhead and not relying on how LINQ is decomiled into sql
- Dependency Injection
- Uses AutoMapper
- Clean Architecture Principles (split sub-projects: API | Core | Infrastructure )
- Has injected Exception Handling Middleware
- Has Fluent Validation for confirming correctness of DTO's, automatically validated incoming requests through FluentValidation's MVC Pipeline Middleware
- Uses Swagger for interactive API documentation
- Uses PostgresSQL as the database
- Uses traditional Controller-based endpoints