# sanjeevveerapandian/booking-system-api architecture

> Architecture diagram of the GitHub repository sanjeevveerapandian/booking-system-api, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sanjeevveerapandian/booking-system-api
- Repository: https://github.com/sanjeevveerapandian/booking-system-api

## Overview

#### Purpose and runtime
MovieBooking is a layered ASP.NET Core backend for cinema operations: identity, theater/movie/show administration, seat selection, booking, payment, invoicing, and ticket delivery. The HTTP host starts in `MovieBooking.API/Program.cs`; endpoint groups are implemented as MVC controllers under `MovieBooking.API/Controllers`.

#### Composition and dependency boundaries
The solution separates API delivery, application use cases, persistence, and infrastructure adapters. Dependency injection is assembled through `MovieBooking.Application/Extensions/ApplicationServiceRegistration.cs`, `MovieBooking.Persistence/Extensions/PersistenceServiceRegistration.cs`, and `MovieBooking.Infrastructure/Extensions/InfrastructureServiceRegistration.cs`. Application services depend on interfaces; persistence and infrastructure provide implementations.

#### HTTP API and authorization edge
Controllers expose resource-oriented operations for auth, bookings, catalog, venues, shows, payments, invoices, tickets, and administration. Key entry points include `MovieBooking.API/Controllers/AuthController.cs`, `MovieBooking.API/Controllers/BookingsController.cs`, and `MovieBooking.API/Controllers/AdminController.cs`. JWT issuance is abstracted by `MovieBooking.Application/Interfaces/IJwtTokenGenerator.cs` and implemented in `MovieBooking.Infrastructure/Security/JwtTokenGenerator.cs`, making authentication an infrastructure boundary.

#### Core booking lifecycle
Booking is the central transactional workflow: requests use booking DTOs, the application service coordinates availability and persistence, and booking/seat associations represent reserved seats. Primary paths are `MovieBooking.Application/Services/BookingService.cs`, `MovieBooking.Application/DTOs/Booking/CreateBookingDto.cs`, `MovieBooking.Persistence/Models/Booking.cs`, and `MovieBooking.Persistence/Models/BookingSeat.cs`. Seat availability is a separate service/repository concern through `MovieBooking.Application/Services/SeatService.cs` and `MovieBooking.Persistence/Repositories/SeatRepository.cs`.

#### Cinema catalog and scheduling
Theater, screen, seat, movie, and show services form the scheduling hierarchy that booking consumes. Relevant components are `MovieBooking.Application/Services/TheaterService.cs`, `MovieBooking.Application/Services/ScreenService.cs`, `MovieBooking.Application/Services/ShowService.cs`, plus persisted models `MovieBooking.Persistence/Models/Theater.cs`, `MovieBooking.Persistence/Models/Screen.cs`, and `MovieBooking.Persistence/Models/Show.cs`. Movie metadata is managed independently by `MovieBooking.Application/Services/MovieService.cs` and `MovieBooking.Persistence/Models/Movie.cs`.

#### Financial and fulfillment stages
After booking, payment, invoice, and ticket services model downstream commercial artifacts. The main application stages are `MovieBooking.Application/Services/PaymentService.cs`, `MovieBooking.Application/Services/InvoiceService.cs`, and `MovieBooking.Application/Services/TicketService.cs`; persisted financial records are `MovieBooking.Persistence/Models/Payment.cs` and `MovieBooking.Persistence/Models/Invoice.cs`. Generated ticket PDFs are served from API static content under `MovieBooking.API/wwwroot/tickets`.

#### Persistence and external services
Entity Framework-style data access is centralized in `MovieBooking.Persistence/Context/MovieBookingDbContext.cs`, with entity-specific repository interfaces/implementations such as `MovieBooking.Persistence/Repositories/IBookingRepository.cs` and `MovieBooking.Persistence/Repositories/BookingRepository.cs`. SMTP email is an external integration behind `MovieBooking.Application/Interfaces/IEmailService.cs`, implemented by `MovieBooking.Infrastructure/Email/EmailService.cs`; email logging is represented by `MovieBooking.Persistence/Models/EmailLog.cs`.

Main entry points: [`MovieBooking.API/Controllers`](https://github.com/sanjeevveerapandian/booking-system-api/tree/main/MovieBooking.API/Controllers) (MVC controllers), [`MovieBooking.Persistence/Context/MovieBookingDbContext.cs`](https://github.com/sanjeevveerapandian/booking-system-api/blob/main/MovieBooking.Persistence/Context/MovieBookingDbContext.cs) (MovieBooking DbContext), [`MovieBooking.Application/Services/BookingService.cs`](https://github.com/sanjeevveerapandian/booking-system-api/blob/main/MovieBooking.Application/Services/BookingService.cs) (Booking service), [`MovieBooking.Application/Services/PaymentService.cs`](https://github.com/sanjeevveerapandian/booking-system-api/blob/main/MovieBooking.Application/Services/PaymentService.cs) (Payment service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API delivery"]
  node_host{{"ASP.NET Core host<br/>HTTP host<br/>[Program.cs]"}}
  node_controllers["MVC controllers<br/>HTTP endpoints<br/>[Controllers]"]
  node_ticket_files["Ticket PDFs<br/>static content<br/>[tickets]"]
end

subgraph group_application["Application use cases"]
  node_booking["Booking service<br/>application service<br/>[BookingService.cs]"]
  node_booking_dto["Create booking DTO<br/>request DTO"]
  node_seat_service["Seat service<br/>application service<br/>[SeatService.cs]"]
  node_catalog_services["Cinema scheduling services<br/>application services<br/>[ShowService.cs]"]
  node_payment["Payment service<br/>application service<br/>[PaymentService.cs]"]
  node_invoice["Invoice service<br/>application service<br/>[InvoiceService.cs]"]
  node_ticket["Ticket service<br/>application service<br/>[TicketService.cs]"]
  node_jwt_contract["JWT token contract<br/>application interface"]
  node_email_contract["Email contract<br/>application interface<br/>[IEmailService.cs]"]
end

subgraph group_persistence["Persistence"]
  node_db_context[("MovieBooking DbContext<br/>EF data context")]
  node_booking_repository["Booking repository<br/>repository implementation"]
  node_seat_repository["Seat repository<br/>[SeatRepository.cs]"]
  node_booking_records[("Booking and seat records<br/>persistence models<br/>[Booking.cs]")]
  node_catalog_records[("Cinema catalog records<br/>persistence models<br/>[Show.cs]")]
  node_financial_records[("Payment and invoice records<br/>persistence models<br/>[Payment.cs]")]
end

subgraph group_infrastructure["Infrastructure"]
  node_jwt_generator["JWT token generator<br/>security adapter"]
  node_email_service["SMTP email service<br/>email adapter<br/>[EmailService.cs]"]
end

node_host -->|"hosts"| node_controllers
node_controllers -->|"booking requests"| node_booking
node_controllers -->|"catalog and show operations"| node_catalog_services
node_controllers -->|"payment operations"| node_payment
node_controllers -->|"invoice operations"| node_invoice
node_controllers -->|"ticket operations"| node_ticket
node_controllers -->|"auth token issuance"| node_jwt_contract
node_booking_dto -->|"input"| node_booking
node_booking -->|"checks availability"| node_seat_service
node_booking -->|"persists booking"| node_booking_repository
node_seat_service -->|"queries seats"| node_seat_repository
node_booking_repository -->|"uses"| node_db_context
node_seat_repository -->|"uses"| node_db_context
node_db_context -->|"maps"| node_booking_records
node_db_context -->|"maps"| node_catalog_records
node_db_context -->|"maps"| node_financial_records
node_catalog_services -->|"manages catalog"| node_db_context
node_booking -->|"initiates commercial flow"| node_payment
node_payment -->|"produces invoice"| node_invoice
node_invoice -->|"enables ticket"| node_ticket
node_payment -->|"stores payment"| node_financial_records
node_invoice -->|"stores invoice"| node_financial_records
node_ticket -->|"writes PDFs"| node_ticket_files
node_jwt_contract -.->|"implemented by"| node_jwt_generator
node_email_contract -.->|"implemented by"| node_email_service
node_ticket -->|"delivers ticket"| node_email_contract

click node_host "https://github.com/sanjeevveerapandian/booking-system-api/blob/main/MovieBooking.API/Program.cs"
click node_controllers "https://github.com/sanjeevveerapandian/booking-system-api/tree/main/MovieBooking.API/Controllers"
click node_booking "https://github.com/sanjeevveerapandian/booking-system-api/blob/main/MovieBooking.Application/Services/BookingService.cs"
click node_booking_dto "https://github.com/sanjeevveerapandian/booking-system-api/blob/main/MovieBooking.Application/DTOs/Booking/CreateBookingDto.cs"
click node_seat_service "https://github.com/sanjeevveerapandian/booking-system-api/blob/main/MovieBooking.Application/Services/SeatService.cs"
click node_catalog_services "https://github.com/sanjeevveerapandian/booking-system-api/blob/main/MovieBooking.Application/Services/ShowService.cs"
click node_payment "https://github.com/sanjeevveerapandian/booking-system-api/blob/main/MovieBooking.Application/Services/PaymentService.cs"
click node_invoice "https://github.com/sanjeevveerapandian/booking-system-api/blob/main/MovieBooking.Application/Services/InvoiceService.cs"
click node_ticket "https://github.com/sanjeevveerapandian/booking-system-api/blob/main/MovieBooking.Application/Services/TicketService.cs"
click node_jwt_contract "https://github.com/sanjeevveerapandian/booking-system-api/blob/main/MovieBooking.Application/Interfaces/IJwtTokenGenerator.cs"
click node_email_contract "https://github.com/sanjeevveerapandian/booking-system-api/blob/main/MovieBooking.Application/Interfaces/IEmailService.cs"
click node_db_context "https://github.com/sanjeevveerapandian/booking-system-api/blob/main/MovieBooking.Persistence/Context/MovieBookingDbContext.cs"
click node_booking_repository "https://github.com/sanjeevveerapandian/booking-system-api/blob/main/MovieBooking.Persistence/Repositories/BookingRepository.cs"
click node_seat_repository "https://github.com/sanjeevveerapandian/booking-system-api/blob/main/MovieBooking.Persistence/Repositories/SeatRepository.cs"
click node_booking_records "https://github.com/sanjeevveerapandian/booking-system-api/blob/main/MovieBooking.Persistence/Models/Booking.cs"
click node_catalog_records "https://github.com/sanjeevveerapandian/booking-system-api/blob/main/MovieBooking.Persistence/Models/Show.cs"
click node_financial_records "https://github.com/sanjeevveerapandian/booking-system-api/blob/main/MovieBooking.Persistence/Models/Payment.cs"
click node_jwt_generator "https://github.com/sanjeevveerapandian/booking-system-api/blob/main/MovieBooking.Infrastructure/Security/JwtTokenGenerator.cs"
click node_email_service "https://github.com/sanjeevveerapandian/booking-system-api/blob/main/MovieBooking.Infrastructure/Email/EmailService.cs"
click node_ticket_files "https://github.com/sanjeevveerapandian/booking-system-api/tree/main/MovieBooking.API/wwwroot/tickets"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_host,node_controllers,node_ticket_files toneBlue
class node_booking,node_booking_dto,node_seat_service,node_catalog_services,node_payment,node_invoice,node_ticket,node_jwt_contract,node_email_contract toneAmber
class node_db_context,node_booking_repository,node_seat_repository,node_booking_records,node_catalog_records,node_financial_records toneMint
class node_jwt_generator,node_email_service toneRose
```

## Components

### API delivery

- [ASP.NET Core host](https://github.com/sanjeevveerapandian/booking-system-api/blob/main/MovieBooking.API/Program.cs): HTTP host · Starts the API and composes dependency injection. · `MovieBooking.API/Program.cs`
- [MVC controllers](https://github.com/sanjeevveerapandian/booking-system-api/tree/main/MovieBooking.API/Controllers): HTTP endpoints · Resource endpoints for auth, booking, catalog, administration, and fulfillment. · `MovieBooking.API/Controllers`
- [Ticket PDFs](https://github.com/sanjeevveerapandian/booking-system-api/tree/main/MovieBooking.API/wwwroot/tickets): static content · Generated tickets served by the API. · `MovieBooking.API/wwwroot/tickets`

### Application use cases

- [Booking service](https://github.com/sanjeevveerapandian/booking-system-api/blob/main/MovieBooking.Application/Services/BookingService.cs): application service · Coordinates booking creation and reserved-seat persistence. · `MovieBooking.Application/Services/BookingService.cs`
- [Create booking DTO](https://github.com/sanjeevveerapandian/booking-system-api/blob/main/MovieBooking.Application/DTOs/Booking/CreateBookingDto.cs): request DTO · `MovieBooking.Application/DTOs/Booking/CreateBookingDto.cs`
- [Seat service](https://github.com/sanjeevveerapandian/booking-system-api/blob/main/MovieBooking.Application/Services/SeatService.cs): application service · Handles seat availability concerns. · `MovieBooking.Application/Services/SeatService.cs`
- [Cinema scheduling services](https://github.com/sanjeevveerapandian/booking-system-api/blob/main/MovieBooking.Application/Services/ShowService.cs): application services · Manages theaters, screens, shows, and movies. · `MovieBooking.Application/Services/ShowService.cs`
- [Payment service](https://github.com/sanjeevveerapandian/booking-system-api/blob/main/MovieBooking.Application/Services/PaymentService.cs): application service · `MovieBooking.Application/Services/PaymentService.cs`
- [Invoice service](https://github.com/sanjeevveerapandian/booking-system-api/blob/main/MovieBooking.Application/Services/InvoiceService.cs): application service · `MovieBooking.Application/Services/InvoiceService.cs`
- [Ticket service](https://github.com/sanjeevveerapandian/booking-system-api/blob/main/MovieBooking.Application/Services/TicketService.cs): application service · Generates ticket fulfillment artifacts. · `MovieBooking.Application/Services/TicketService.cs`
- [JWT token contract](https://github.com/sanjeevveerapandian/booking-system-api/blob/main/MovieBooking.Application/Interfaces/IJwtTokenGenerator.cs): application interface · `MovieBooking.Application/Interfaces/IJwtTokenGenerator.cs`
- [Email contract](https://github.com/sanjeevveerapandian/booking-system-api/blob/main/MovieBooking.Application/Interfaces/IEmailService.cs): application interface · `MovieBooking.Application/Interfaces/IEmailService.cs`

### Persistence

- [MovieBooking DbContext](https://github.com/sanjeevveerapandian/booking-system-api/blob/main/MovieBooking.Persistence/Context/MovieBookingDbContext.cs): EF data context · Centralized entity data access. · `MovieBooking.Persistence/Context/MovieBookingDbContext.cs`
- [Booking repository](https://github.com/sanjeevveerapandian/booking-system-api/blob/main/MovieBooking.Persistence/Repositories/BookingRepository.cs): repository implementation · `MovieBooking.Persistence/Repositories/BookingRepository.cs`
- [Seat repository](https://github.com/sanjeevveerapandian/booking-system-api/blob/main/MovieBooking.Persistence/Repositories/SeatRepository.cs): repository · `MovieBooking.Persistence/Repositories/SeatRepository.cs`
- [Booking and seat records](https://github.com/sanjeevveerapandian/booking-system-api/blob/main/MovieBooking.Persistence/Models/Booking.cs): persistence models · Represents bookings and their reserved-seat associations. · `MovieBooking.Persistence/Models/Booking.cs`
- [Cinema catalog records](https://github.com/sanjeevveerapandian/booking-system-api/blob/main/MovieBooking.Persistence/Models/Show.cs): persistence models · Theater, screen, show, and movie data. · `MovieBooking.Persistence/Models/Show.cs`
- [Payment and invoice records](https://github.com/sanjeevveerapandian/booking-system-api/blob/main/MovieBooking.Persistence/Models/Payment.cs): persistence models · `MovieBooking.Persistence/Models/Payment.cs`

### Infrastructure

- [JWT token generator](https://github.com/sanjeevveerapandian/booking-system-api/blob/main/MovieBooking.Infrastructure/Security/JwtTokenGenerator.cs): security adapter · `MovieBooking.Infrastructure/Security/JwtTokenGenerator.cs`
- [SMTP email service](https://github.com/sanjeevveerapandian/booking-system-api/blob/main/MovieBooking.Infrastructure/Email/EmailService.cs): email adapter · `MovieBooking.Infrastructure/Email/EmailService.cs`

## Connections

- ASP.NET Core host → MVC controllers: hosts
- MVC controllers → Booking service: booking requests
- MVC controllers → Cinema scheduling services: catalog and show operations
- MVC controllers → Payment service: payment operations
- MVC controllers → Invoice service: invoice operations
- MVC controllers → Ticket service: ticket operations
- MVC controllers → JWT token contract: auth token issuance
- Create booking DTO → Booking service: input
- Booking service → Seat service: checks availability
- Booking service → Booking repository: persists booking
- Seat service → Seat repository: queries seats
- Booking repository → MovieBooking DbContext: uses
- Seat repository → MovieBooking DbContext: uses
- MovieBooking DbContext → Booking and seat records: maps
- MovieBooking DbContext → Cinema catalog records: maps
- MovieBooking DbContext → Payment and invoice records: maps
- Cinema scheduling services → MovieBooking DbContext: manages catalog
- Booking service → Payment service: initiates commercial flow
- Payment service → Invoice service: produces invoice
- Invoice service → Ticket service: enables ticket
- Payment service → Payment and invoice records: stores payment
- Invoice service → Payment and invoice records: stores invoice
- Ticket service → Ticket PDFs: writes PDFs
- JWT token contract → JWT token generator: implemented by
- Email contract → SMTP email service: implemented by
- Ticket service → Email contract: delivers ticket
