# emirbellos/cinema-project architecture

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

- Interactive diagram: https://gitdiagram.com/emirbellos/cinema-project
- Repository: https://github.com/emirbellos/cinema-project

## Overview

##### Core Components
- Frontend:
- Built using React.js (with Vite, Tailwind, and ESLint configurations).
- Contains pages and components handling the user interface (e.g., Home, Cartelera, Reservas, etc.).
- Communicates via REST APIs with the backend.
- Backend:
- Developed in Python (with Django as the web framework and Django REST Framework for API endpoints).
- Likely includes the core business logic for managing reservations.
- Although the file tree shows only a single Python file (Pruebapy.py), the README clearly specifies Django-based API services, so more backend modules would exist in the full project.
- Asynchronous Task Manager:
- Uses Celery for handling asynchronous processes (e.g., validating payment, reserving seats, sending confirmation emails).
- Connected to a message broker (RabbitMQ or Redis) as per the README.
- Database:
- PostgreSQL is used for storing persistent data (reservations, seats, users).
- External Services:
- Payment integration via third-party APIs (e.g., Stripe or PayPal).
- Notification services using platforms like SendGrid for sending confirmation emails.
- Deployment Infrastructure:
- Utilizes Docker Compose for managing multi-container configurations.
- Deployment on Azure with resources like a VM Linux instance, Azure Database for PostgreSQL, and monitoring/scaling enabled via services such as Azure Monitor.

##### Architectural Patterns and Design Principles
- Separation of concerns by showing distinct layers (Frontend vs. Backend vs. Infrastructure).
- Use of asynchronous processing for critical workflows (using Celery) and note that the system adheres to a service-oriented architecture.
- Mention RESTful API interactions between the frontend and backend.
- That the system is designed to be scalable and resilient, especially with the optional containerized deployment and cloud-based resources on Azure.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User interaction
    U("User"):::userStyle

    %% Frontend Subgraph
    subgraph "Frontend Layer"
        F1["React Frontend (React/Vite/Tailwind)"]:::frontend
        FP["Pages (UI Elements)"]:::frontend
        FC["Components (UI Elements)"]:::frontend
        F1 --> FP
        F1 --> FC
    end

    %% Backend Subgraph
    subgraph "Backend Layer"
        B1["Django Backend (Python/Django/DRF)"]:::backend
    end

    %% Asynchronous Processing Subgraph
    subgraph "Async Processing"
        CW["Celery Worker"]:::async
        MB["Message Broker (RabbitMQ/Redis)"]:::async
    end

    %% Data Storage and External Services
    DB["PostgreSQL DB"]:::db
    PA["Payment API (Stripe/PayPal)"]:::external
    ES["Email Service (SendGrid)"]:::external

    %% Deployment Environment Subgraph
    subgraph "Deployment Environment"
        D1["Docker Compose"]:::deployment
        D2["Azure VM"]:::deployment
        D3["Azure PostgreSQL DB"]:::deployment
    end

    %% Data Flow Connections
    U -->|"interacts"| F1
    F1 -->|"APIcall"| B1
    B1 -->|"enqueue task"| CW
    CW -->|"via broker"| MB
    CW -->|"updates"| DB
    CW -->|"calls"| PA
    CW -->|"notifies"| ES

    %% Deployment Connections (optional)
    D1 ---|"orchestrates"| B1
    D1 ---|"orchestrates"| CW
    D1 ---|"orchestrates"| MB
    D3 ---|"hosts"| DB

    %% Click Events
    click F1 "https://github.com/emirbellos/cinema-project/tree/main/CinemaProyect/Frontend"
    click FP "https://github.com/emirbellos/cinema-project/tree/main/CinemaProyect/Frontend/src/Pages"
    click FC "https://github.com/emirbellos/cinema-project/tree/main/CinemaProyect/Frontend/src/Components"
    click B1 "https://github.com/emirbellos/cinema-project/blob/main/CinemaProyect/Backend/Pruebapy.py"

    %% Styles
    classDef userStyle fill:#f4f4f4,stroke:#333,stroke-width:2px;
    classDef frontend fill:#ccf,stroke:#333,stroke-width:2px;
    classDef backend fill:#cfc,stroke:#333,stroke-width:2px;
    classDef async fill:#fc9,stroke:#333,stroke-width:2px;
    classDef db fill:#ffc,stroke:#333,stroke-width:2px;
    classDef external fill:#cff,stroke:#333,stroke-width:2px;
    classDef deployment fill:#f9c,stroke:#333,stroke-width:2px;
```
