# jagadish210523-lgtm/cinemahub-api architecture

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

- Interactive diagram: https://gitdiagram.com/jagadish210523-lgtm/cinemahub-api
- Repository: https://github.com/jagadish210523-lgtm/cinemahub-api

## Overview

Cinema Hub is a FastAPI cinema-booking API. Clients enter through the application, then use authentication and separate movie, theatre, show, and booking endpoints; these modules validate requests and perform SQLAlchemy operations against persistent MySQL data. The graph preserves the documented API, authentication, validation, and database capabilities. The supplied tree lists flat filenames while excerpts use `router.*` and `app.*` imports, so runtime wiring beyond the shown entry point is uncertain.

Main entry points: [`auth.py`](https://github.com/jagadish210523-lgtm/cinemahub-api/blob/main/auth.py) (Authentication), [`database.py`](https://github.com/jagadish210523-lgtm/cinemahub-api/blob/main/database.py) (Database sessions), [`main.py`](https://github.com/jagadish210523-lgtm/cinemahub-api/blob/main/main.py) (FastAPI app), [`models.py`](https://github.com/jagadish210523-lgtm/cinemahub-api/blob/main/models.py) (SQLAlchemy models)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and access"]
  node_app["FastAPI app<br/>[main.py]"]
  node_auth["Authentication<br/>[auth.py]"]
end

subgraph group_catalog["Cinema catalog"]
  node_movies["Movie endpoints<br/>[movies.py]"]
  node_theatres["Theatre endpoints<br/>[theatres.py]"]
end

subgraph group_schedule["Shows and seats"]
  node_shows["Show endpoints<br/>[shows.py]"]
  node_bookings["Booking and seats<br/>[bookings.py]"]
end

subgraph group_storage["Persistence"]
  node_orm["SQLAlchemy models<br/>[models.py]"]
  node_db["Database sessions<br/>[database.py]"]
end

node_client(("API client"))
node_mysql[("MySQL database")]

node_client -->|"sends requests"| node_app
node_app -->|"registers router"| node_auth
node_app -->|"registers router"| node_movies
node_app -->|"registers router"| node_theatres
node_app -->|"registers router"| node_shows
node_app -->|"registers router"| node_bookings
node_auth -->|"queries users"| node_orm
node_auth -->|"opens sessions"| node_db
node_movies -->|"verifies tokens"| node_auth
node_movies -->|"reads and writes"| node_orm
node_movies -->|"creates tables"| node_db
node_theatres -->|"verifies tokens"| node_auth
node_theatres -->|"reads and writes"| node_orm
node_theatres -->|"creates tables"| node_db
node_shows -->|"verifies tokens"| node_auth
node_shows -->|"reads and writes"| node_orm
node_shows -->|"creates tables"| node_db
node_bookings -->|"verifies tokens"| node_auth
node_bookings -->|"reads and writes"| node_orm
node_bookings -->|"creates tables"| node_db
node_orm -->|"uses base"| node_db
node_db -->|"connects to"| node_mysql

click node_app "https://github.com/jagadish210523-lgtm/cinemahub-api/blob/main/main.py"
click node_auth "https://github.com/jagadish210523-lgtm/cinemahub-api/blob/main/auth.py"
click node_movies "https://github.com/jagadish210523-lgtm/cinemahub-api/blob/main/movies.py"
click node_theatres "https://github.com/jagadish210523-lgtm/cinemahub-api/blob/main/theatres.py"
click node_shows "https://github.com/jagadish210523-lgtm/cinemahub-api/blob/main/shows.py"
click node_bookings "https://github.com/jagadish210523-lgtm/cinemahub-api/blob/main/bookings.py"
click node_orm "https://github.com/jagadish210523-lgtm/cinemahub-api/blob/main/models.py"
click node_db "https://github.com/jagadish210523-lgtm/cinemahub-api/blob/main/database.py"

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_app,node_auth,node_client toneBlue
class node_movies,node_theatres,node_mysql toneAmber
class node_shows,node_bookings toneMint
class node_orm,node_db toneRose
```

## Components

### API and access

- [FastAPI app](https://github.com/jagadish210523-lgtm/cinemahub-api/blob/main/main.py): `main.py`
- [Authentication](https://github.com/jagadish210523-lgtm/cinemahub-api/blob/main/auth.py): `auth.py`

### Cinema catalog

- [Movie endpoints](https://github.com/jagadish210523-lgtm/cinemahub-api/blob/main/movies.py): `movies.py`
- [Theatre endpoints](https://github.com/jagadish210523-lgtm/cinemahub-api/blob/main/theatres.py): `theatres.py`

### Shows and seats

- [Show endpoints](https://github.com/jagadish210523-lgtm/cinemahub-api/blob/main/shows.py): `shows.py`
- [Booking and seats](https://github.com/jagadish210523-lgtm/cinemahub-api/blob/main/bookings.py): `bookings.py`

### Persistence

- [SQLAlchemy models](https://github.com/jagadish210523-lgtm/cinemahub-api/blob/main/models.py): `models.py`
- [Database sessions](https://github.com/jagadish210523-lgtm/cinemahub-api/blob/main/database.py): `database.py`

### Other components

- **API client**
- **MySQL database**

## Connections

- API client → FastAPI app: sends requests (evidence: `README.md`)
- FastAPI app → Authentication: registers router (evidence: `main.py`)
- FastAPI app → Movie endpoints: registers router (evidence: `main.py`)
- FastAPI app → Theatre endpoints: registers router (evidence: `main.py`)
- FastAPI app → Show endpoints: registers router (evidence: `main.py`)
- FastAPI app → Booking and seats: registers router (evidence: `main.py`)
- Authentication → SQLAlchemy models: queries users (evidence: `auth.py`)
- Authentication → Database sessions: opens sessions (evidence: `auth.py`)
- Movie endpoints → Authentication: verifies tokens (evidence: `movies.py`)
- Movie endpoints → SQLAlchemy models: reads and writes (evidence: `movies.py`)
- Movie endpoints → Database sessions: creates tables (evidence: `movies.py`)
- Theatre endpoints → Authentication: verifies tokens (evidence: `theatres.py`)
- Theatre endpoints → SQLAlchemy models: reads and writes (evidence: `theatres.py`)
- Theatre endpoints → Database sessions: creates tables (evidence: `theatres.py`)
- Show endpoints → Authentication: verifies tokens (evidence: `shows.py`)
- Show endpoints → SQLAlchemy models: reads and writes (evidence: `shows.py`)
- Show endpoints → Database sessions: creates tables (evidence: `shows.py`)
- Booking and seats → Authentication: verifies tokens (evidence: `bookings.py`)
- Booking and seats → SQLAlchemy models: reads and writes (evidence: `bookings.py`)
- Booking and seats → Database sessions: creates tables (evidence: `bookings.py`)
- SQLAlchemy models → Database sessions: uses base (evidence: `models.py`)
- Database sessions → MySQL database: connects to (evidence: `database.py`)
