This project is a demonstration of a fictional Cinema Management Application. It is built on .NET, applying Domain-Driven Design and Clean Architecture principles. The solution leverages a Microservices Architecture, Event-Driven Architecture, Vertical Slice Architecture, and Event Sourcing for its foundation.
Loving it? Please show your support by giving this project a star!
- You will need the latest Visual Studio 2022 and the latest .NET Core SDK (at least .NET 8 SDK).
- You will need also Docker Desktop running on your machine and NET Aspire Workload (installed either Visual Studio or the .NET CLI)
- To run the project just find and build the solution file JordiAragonZaragoza.Cinema.sln and press F5
- Full architecture with responsibility separation concerns, SOLID and clean code (including zero warnings policy)
- Clean Architecture (Onion Architecture)
- Vertical Slices Architecture.
- Domain Driven-Design
- Rich Domain Model with Aggregates and Strong Ids
- Domain Events
- Outbox Pattern with idempotent consumers
- CQRS with DB physical separation using domain events.
- Unit of Work
- Repository & Specification
- Custom API Error Handling with Problems Details
- This project uses JordiAragonZaragoza.SharedKernel building blocks to follow DDD principles and Clean Architecture.
- ASP.NET
- Entity Framework Core
- .NET Aspire
- FastEndpoints
- MediatR
- AutoMapper
- Autofac
- Ardalis.Result
- Ardalis.Specification
- Ardalis.SmartEnums
- Ardalis.GuardClauses
- FluentValidator
- Serilog
- Seq
- Quartz
- Polly
- Swagger UI with JWT support
- EasyCaching
- Volo.Abp.Guids
- StyleCop & SonarAnalyzer
- xUnit & NetArchTest & Testcontainers & Ardalis.HttpClientTestExtensions
- Outbox pattern to handle the domain event outside the source transaction with resilence idempotent consumers support.
- Result Pattern: Flow Control using Ardalis.Result avoiding throwing exceptions.
- API Versioning
- REPR Pattern using FastEndpoints
- Application cache request with invalidation.
- Generic cache repository with invalidation.
- MediatR Pipelines Behaviours (Decorator pattern)
- LoggerBehaviour to track all requests.
- UnitOfWorkBehaviour as a main exception handler to commit or rollback the transaction.
- ValidationBehaviour to add custom validation per each query or command.
- CachingBehavior and InvalidateCachingBehavior to apply/remove requests to the cache.
- DomainEventsDispatcherBehaviour. Deferred approach to raise and dispatch events before complete the transation.
- PerformanceBehaviour to track the execution time performance.
- Architecture Tests to ensure DDD rules required in Vertical Slices Arquitecture
- Unit Tests: Domain and Application
- Functional Tests with Testcontainers: Presentation.HttpRestfulApi
- Integration Tests with Testcontainers: Infrastructure.EntityFramework
- GitHub workflow CI with SonarCloud integration
The reservation bounded context manage the cinema showtimes and ticket reservation.
-
Reserve seats
- Reserving the seat response will contain a GUID of the reservation, also the number of seats, the auditorium used and the movie that will be played.
- It should not be possible to reserve the same seats two times.
- It shouldn't be possible to reserve an already sold seat.
- All the seats, when doing a reservation, need to be contiguous.
- Reservation will expire in 1 minute unless marked as purchased.
- No reservations are allowed after showtime ended.
-
Purchase ticket reservation
- We will need the GUID of the ticket reservation, it is only possible to do it while the seats are reserved.
- It is not possible to purchase ticket reservation two times.
-
Schedule or cancel a showtime (in progress only basic functionality, not completed yet)
Special thanks to all these authors for sharing their knowledge and expertise:
- Ardalis: Clean Architecture
- Jason Taylor: Clean Architecture
- Vaughn Vernon: Implementing Domain-Driven Design (book)
- Vaughn Vernon: Domain-Driven Design Destilado (book)
- Alexey Zimarev: Hands-on Domain-Driven Design (book)
- Microsoft eShopOnContainers
- Microsoft eShopOnWeb
- Kamil Grzybek: Sample .NET Core REST API CQRS
- Kamil Grzybek: Modular Monolith With DDD
- Oskar Dudycz: EventSourcing .NET
- NDC Oslo: Udi Dahan - Talk Session: CQRS pitfalls and patterns
- Explore DDD: Mauro Servienti - Talk Session: Welcome to the (State) Machine
- Explore DDD: Mauro Servienti - Talk Session: All Our Aggregates Are Wrong
- NDC Oslo: Adam Ralph - Talk Session: Finding your service boundaries - a practical guide
- KS2024: Oskar Dudycz - Talk Session: Event Modeling Anti-patterns
- Vladimir Khorikov: DDD in a nutshell
- Diego Martin: SunnyAttic Software Videos
- Jimmy Bogard: Vertical Slice Architecture
- CodeOpinion: Youtube Channel
- Amichai Mantinband: Youtube Channel
- Milan Jovanović: Youtube Channel
The main branch is now on .NET 9 The following previous versions are available:
The Cinema Project was developed by Jordi Aragón Zaragoza
Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.