Skip to content

The Cinema Project is a WebApi project written in .NET 7 following DDD and Clean Architecture. The application allows to manage cinema showtimes and ticket reservation.

License

Notifications You must be signed in to change notification settings

jordiaragonzaragoza/JordiAragon.Cinema

Repository files navigation

What is the Cinema Project?

The Cinema Project is a HttpRestfulApi project written in .NET 7 following DDD and Clean Architecture. The reservation bounded context manage the cinema showtimes and ticket reservation.

How to use:

  • You will need the latest Visual Studio 2022 and the latest .NET Core SDK (at least .NET 7 SDK).
  • You will need also Docker Desktop running on your machine.
  • To run the project just find and build the solution file JordiAragon.Cinema.Reservation.sln and select docker-compose as startup project.

Architecture:

  • 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/Application 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

Custom Shared Kernel:

Diagram:

JordiAragon.Cinema - Clean architecture graph

Technologies implemented:

  • ASP.NET 7.0
  • Entity Framework Core 7.0
  • FastEndpoints
  • MediatR
  • AutoMapper
  • Autofac
  • Ardalis.Result
  • Ardalis.Specification
  • Ardalis.SmartEnums
  • Ardalis.GuardClauses
  • FluentValidator
  • Serilog
  • Quartz
  • Polly
  • Swagger UI with JWT support
  • EasyCaching
  • Volo.Abp.Guids
  • StyleCop & SonarAnalyzer
  • xUnit & NetArchTest & Testcontainers & Ardalis.HttpClientTestExtensions

Cross-cutting concerns

  • Outbox pattern to handle the domain event out side 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.

Testing

  • 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

SonarCloud

Reservation Bounded Context - Commands and queries.

  • Create/Cancel showtime

  • 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.

Resources and Inspiration

Special thanks to all these authors for sharing their knowledge and expertise:

About:

The Cinema Project was developed by Jordi Aragón Zaragoza

License:

Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.

Creative Commons License

About

The Cinema Project is a WebApi project written in .NET 7 following DDD and Clean Architecture. The application allows to manage cinema showtimes and ticket reservation.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published