# joseriospacheco/cine architecture

> Architecture diagram of the GitHub repository joseriospacheco/cine, 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/joseriospacheco/cine
- Repository: https://github.com/joseriospacheco/cine

## Overview

##### Main Components
- Client (Browser/User) Interface – separate areas for regular users (e.g., index.jsp, login.jsp, reserva.jsp) and for administrators (located under web/admin).
- Web Layer (Presentation) – JSP pages (regular and admin), along with supporting HTML, CSS, JavaScript (JQuery, Ajax) used by the frontend.
- Controller & Business Logic Layer – the backend code found in the src directory. Under the “Datos” package, you have data access objects (such as BibliotecaDB, DatosButacas, etc.) that encapsulate database queries and business rules. The “Entidades” package represents the data models (e.g., Pelicula, Reserva, Sala, etc.).
- Persistence Layer – MySQL database as indicated by the cinema.sql file. This layer stores the application’s data such as movies, reservations, users, and cinema details.
- External Services – A component for integration with the IMDb API to fetch movie details automatically.
- Configuration/Deployment – Build files (build.xml, nbproject files) and configuration files (MANIFEST.MF, sun-web.xml) that support project building and deployment.

##### Relationships and Interactions
- The Client Interface uses browsers to send HTTP requests to the web layer (JSPs). Different JSPs are dedicated to admin features (e.g., agregarFunciones.jsp, modificarPeliculas.jsp) and user interactions (e.g., registrarme.html, reserva.jsp).
- The web layer, following the MVC pattern, acts as the controller to delegate requests to the proper business logic components within the “src” directory.
- The business logic layer (Datos classes) communicates with the MySQL database to retrieve and update persistent data.
- When movie data is needed, a separate component handles the API call to IMDb and returns JSON data, which is then processed by the application.

##### Highlighting Architectural Patterns
- The MVC (Model-View-Controller) pattern is evident: the JSPs provide the View, the servlets/JSP pages invoke business logic (Controller), and the “Entidades” along with “Datos” packages represent the Model.
- The separation of concerns is clearly maintained by placing interface files (under web) separate from the Java source code (under src).
- There is a clear distinction between the admin and public functionalities, which should be represented as separate but interacting components.

##### Relevant Technologies and Frameworks
- Frontend: HTML, CSS, JQuery, Ajax (for dynamic content updates).
- Backend: Java/JSP, MVC architecture.
- Database: MySQL.
- External API Integration: IMDb’s API (returning JSON).
- Development/Build Environment: NetBeans (as suggested by nbproject files), with Ant used for building (build.xml).

## Diagram (Mermaid)

```mermaid
graph TD
    %% Client Interfaces
    subgraph "Client Interfaces"
        UI_Public("User Interface - Public"):::client
        UI_Admin("Admin Interface"):::client
    end

    %% Web Layer (Presentation/Controller)
    subgraph "Web Layer"
        Web("Web Controller (JSP)"):::web
    end

    %% Business Logic Layer
    subgraph "Business Logic Layer"
        Datos("Datos Layer (Business Logic)"):::logic
        Entidades("Entidades Layer (Models)"):::logic
    end

    %% Persistence Layer
    subgraph "Persistence Layer"
        DB("MySQL Database"):::database
    end

    %% External Services
    subgraph "External Services"
        IMDb("IMDb API"):::external
    end

    %% Configuration & Deployment
    subgraph "Configuration & Deployment"
        Build("Build File"):::config
        NB("NetBeans Project"):::config
        Manifest("Manifest File"):::config
        SunWeb("Sun Web Config"):::config
    end

    %% Connections
    UI_Public -->|"HTTP_Request"| Web
    UI_Admin -->|"HTTP_Request"| Web
    Web -->|"invoke_logic"| Datos
    Datos -->|"uses_models"| Entidades
    Datos -->|"CRUD_operations"| DB
    Datos -->|"fetch_movie_data"| IMDb
    Build ---|"configures"| Web
    NB ---|"supports"| Web
    Manifest ---|"configures"| Datos
    SunWeb ---|"configures"| Web

    %% Click Events
    click UI_Public "https://github.com/joseriospacheco/cine/blob/master/web/index.jsp"
    click UI_Admin "https://github.com/joseriospacheco/cine/blob/master/web/admin/index.jsp"
    click Web "https://github.com/joseriospacheco/cine/blob/master/web/Procesa.jsp"
    click Datos "https://github.com/joseriospacheco/cine/blob/master/src/java/Datos/BibliotecaDB.java"
    click Entidades "https://github.com/joseriospacheco/cine/blob/master/src/java/Entidades/Pelicula.java"
    click DB "https://github.com/joseriospacheco/cine/blob/master/cinema.sql"
    click Build "https://github.com/joseriospacheco/cine/blob/master/build.xml"
    click NB "https://github.com/joseriospacheco/cine/tree/master/nbproject"
    click Manifest "https://github.com/joseriospacheco/cine/blob/master/src/conf/MANIFEST.MF"
    click SunWeb "https://github.com/joseriospacheco/cine/blob/master/web/WEB-INF/sun-web.xml"

    %% Styles
    classDef client fill:#a2d5f2,stroke:#1f78b4,stroke-width:2px;
    classDef web fill:#c7f9cc,stroke:#2d6a4f,stroke-width:2px;
    classDef logic fill:#f6bd60,stroke:#f28482,stroke-width:2px;
    classDef database fill:#ffd6a5,stroke:#ff7f11,stroke-width:2px;
    classDef external fill:#ffafcc,stroke:#d62828,stroke-width:2px;
    classDef config fill:#d0f4de,stroke:#379683,stroke-width:2px;
```
