# slavakuntsov/untitled-cinema architecture

> Architecture diagram of the GitHub repository slavakuntsov/untitled-cinema, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/slavakuntsov/untitled-cinema
- Repository: https://github.com/slavakuntsov/untitled-cinema

## Overview

##### Project Type and Purpose
- This is a full-stack cinema booking application that features an Angular-based frontend and multiple backend microservices. The system is organized into separate modules for managing bookings, movies, users, and shared functionalities such as messaging and broker services.
- The project is containerized – notice the docker-compose file, Dockerfiles for both the client, server, and Nginx, indicating that deployment uses container orchestration and possibly an API gateway for routing requests.

##### Main Components
a. Frontend:
– Angular client under src/client.
– Contains components, pages, shared UI elements, widgets, and state management.
– Interacts with the backend via REST APIs and possibly via websockets (observable in authentication interceptors, etc.).

b. Backend Microservices:
– Booking Service: Contains API, Application, Domain, Infrastructure, Persistence, and Test projects. Manages bookings, seat reservations, and related workflows.
– Movie Service: Similar layered structure and handles movies, halls, sessions management, and associated operations.
– User Service: Manages users, authentication, notifications, and tokens. Has its own API, Application, Domain, Infrastructure, Persistence.
– Each microservice is further decomposed into standard layers (e.g., Controllers, Handlers for commands/queries, Domain entities, Repositories) reflecting a Clean Architecture or CQRS pattern in parts.

c. Shared/Infrastructure Components:
– Shared Libraries for Brokers (RabbitMQ for message queuing between services), Databases, Domain tools, Extensions (logging, exception handling, etc.), Redis cache, and Utilities.
– Note the existence of a Shared folder with subcomponents for Brokers, Protobufs, Redis, etc., indicating cross-service communication and common services.

d. Gateway and Infrastructure:
– An Nginx configuration folder with a Dockerfile and certificates, likely providing reverse-proxying, load balancing and possibly SSL termination.
– docker-compose file shows orchestration of client, multiple server microservices, and infrastructure components.
– There are Dockerfiles for the entire solution and separate ones like BookingsDockerfile or MoviesDockerfile which help manage containerization per service.

##### Relationships and Interactions
– The Angular client makes HTTP/REST calls to the backend services (Booking, Movie, User) via the API endpoints exposed by each microservice.
– Nginx acts as a reverse proxy or gateway, directing the incoming requests from the client to the appropriate microservice.
– The services interact with each other indirectly using asynchronous messaging through RabbitMQ (located in the Shared/Brokers section) for cross-cutting concerns such as notifications, session seats updates, or handling transactions.
– The infrastructure layer of each service interacts with its persistent storage using Entity Framework (or equivalent ORMs) to perform CRUD operations on the databases.

##### Key Architectural Patterns and Technologies
– Microservices Architecture: Each major domain (bookings, movies, users) is split into independent services with internal layered structure.
– Clean Architecture / CQRS: Notice the separation of commands and queries (Handlers, Commands, Queries folders) and distinct Application, Domain, Persistence projects.
– Containerization: Dockerfiles and docker-compose configuration indicate the use of Docker in deployment.
– Messaging and Asynchronous Communication: Use of RabbitMQ for inter-service message passing and possibly Redis for caching.
– Frontend Angular: Organized with feature modules and reusable components, utilizing services, routing, and interceptors for API communications.
– Security: Presence of JWT authentication and associated authentication interceptors both in the frontend and in the User Service’s Domain and Infrastructure.

## Diagram (Mermaid)

```mermaid
flowchart TD
    A["Angular Client"]:::frontend
    B["API Gateway / Nginx"]:::gateway
    C["Booking Service"]:::microservice
    D["Movie Service"]:::microservice
    E["User Service"]:::microservice
    F["Shared Messaging & Utilities"]:::shared

    A -->|"HTTP/REST"| B
    B -->|"REST API"| C
    B -->|"REST API"| D
    B -->|"REST API"| E

    C -->|"Async-Messaging"| F
    D -->|"Async-Messaging"| F
    E -->|"Async-Messaging"| F

    click A "https://github.com/slavakuntsov/untitled-cinema/tree/main/src/client"
    click B "https://github.com/slavakuntsov/untitled-cinema/tree/main/src/nginx"
    click C "https://github.com/slavakuntsov/untitled-cinema/tree/main/src/server/Microservices/BookingService"
    click D "https://github.com/slavakuntsov/untitled-cinema/tree/main/src/server/Microservices/MovieService"
    click E "https://github.com/slavakuntsov/untitled-cinema/tree/main/src/server/Microservices/UserService"
    click F "https://github.com/slavakuntsov/untitled-cinema/tree/main/src/server/Shared"

    classDef frontend fill:#a6cee3,stroke:#1f78b4,stroke-width:2px;
    classDef gateway fill:#fdbf6f,stroke:#ff7f00,stroke-width:2px;
    classDef microservice fill:#b2df8a,stroke:#33a02c,stroke-width:2px;
    classDef shared fill:#cab2d6,stroke:#6a3d9a,stroke-width:2px;
```
