# rahulpiska/movie_booking_api architecture

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

- Interactive diagram: https://gitdiagram.com/rahulpiska/movie_booking_api
- Repository: https://github.com/rahulpiska/movie_booking_api

## Overview

This is a FastAPI movie-ticket booking API. Users register or log in, browse movies and scheduled shows, inspect seat availability, book seats, review booking history, and cancel bookings; administrators manage the movie, theatre, screen, and show catalog. Route modules own the business operations, with shared authentication helpers, Pydantic schemas, SQLAlchemy models, and database sessions beneath them. The route and model excerpts support the principal relationships; other documented capabilities are represented where their source paths are known.

Main entry points: [`main.py`](https://github.com/rahulpiska/movie_booking_api/blob/main/main.py) (FastAPI app), [`database.py`](https://github.com/rahulpiska/movie_booking_api/blob/main/database.py) (Database sessions), [`models.py`](https://github.com/rahulpiska/movie_booking_api/blob/main/models.py) (Domain ORM), [`routes/auth.py`](https://github.com/rahulpiska/movie_booking_api/blob/main/routes/auth.py) (Login and profile)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["API entry"]
  node_app["FastAPI app<br/>[main.py]"]
  node_schemas["API schemas<br/>[schemas.py]"]
  node_orm["Domain ORM<br/>[models.py]"]
  node_sessions["Database sessions<br/>[database.py]"]
end

subgraph group_identity["Identity"]
  node_users["User registration<br/>[users.py]"]
  node_auth["Login and profile<br/>[auth.py]"]
  node_security["Password and access<br/>[utils.py]"]
end

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

subgraph group_schedule["Shows and seats"]
  node_screens["Screens and seats<br/>[screens.py]"]
  node_shows["Show scheduling<br/>[shows.py]"]
end

subgraph group_booking["Booking"]
  node_bookings["Booking lifecycle<br/>[bookings.py]"]
end

node_client(("API client"))
node_postgres[("PostgreSQL")]

node_client -->|"sends requests"| node_app
node_app -->|"mounts routes"| node_users
node_app -->|"mounts routes"| node_auth
node_app -->|"mounts routes"| node_movies
node_app -->|"mounts routes"| node_theatres
node_app -->|"mounts routes"| node_screens
node_app -->|"mounts routes"| node_shows
node_app -->|"mounts routes"| node_bookings
node_users -->|"hashes passwords"| node_security
node_auth -->|"verifies and issues tokens"| node_security
node_auth -->|"checks current user"| node_security
node_users -->|"uses session"| node_sessions
node_auth -->|"uses session"| node_sessions
node_movies -->|"uses session"| node_sessions
node_theatres -->|"uses session"| node_sessions
node_screens -->|"uses session"| node_sessions
node_shows -->|"uses session"| node_sessions
node_bookings -->|"uses session"| node_sessions
node_users -->|"queries users"| node_orm
node_auth -->|"queries users"| node_orm
node_movies -->|"manages movies and shows"| node_orm
node_theatres -->|"manages theatres"| node_orm
node_screens -->|"creates screens and seats"| node_orm
node_shows -->|"schedules and checks seats"| node_orm
node_bookings -->|"creates and cancels bookings"| node_orm
node_users -->|"validates and formats"| node_schemas
node_auth -->|"formats profile"| node_schemas
node_movies -->|"validates and formats"| node_schemas
node_theatres -->|"validates and formats"| node_schemas
node_screens -->|"validates and formats"| node_schemas
node_shows -->|"validates and formats"| node_schemas
node_bookings -->|"validates and formats"| node_schemas
node_orm -->|"uses declarative base"| node_sessions
node_sessions -->|"connects to"| node_postgres

click node_app "https://github.com/rahulpiska/movie_booking_api/blob/main/main.py"
click node_users "https://github.com/rahulpiska/movie_booking_api/blob/main/routes/users.py"
click node_auth "https://github.com/rahulpiska/movie_booking_api/blob/main/routes/auth.py"
click node_security "https://github.com/rahulpiska/movie_booking_api/blob/main/utils.py"
click node_movies "https://github.com/rahulpiska/movie_booking_api/blob/main/routes/movies.py"
click node_theatres "https://github.com/rahulpiska/movie_booking_api/blob/main/routes/theatres.py"
click node_screens "https://github.com/rahulpiska/movie_booking_api/blob/main/routes/screens.py"
click node_shows "https://github.com/rahulpiska/movie_booking_api/blob/main/routes/shows.py"
click node_bookings "https://github.com/rahulpiska/movie_booking_api/blob/main/routes/bookings.py"
click node_schemas "https://github.com/rahulpiska/movie_booking_api/blob/main/schemas.py"
click node_orm "https://github.com/rahulpiska/movie_booking_api/blob/main/models.py"
click node_sessions "https://github.com/rahulpiska/movie_booking_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_schemas,node_orm,node_sessions,node_client toneBlue
class node_users,node_auth,node_security,node_postgres toneAmber
class node_movies,node_theatres toneMint
class node_screens,node_shows toneRose
class node_bookings toneIndigo
```

## Components

### API entry

- [FastAPI app](https://github.com/rahulpiska/movie_booking_api/blob/main/main.py): `main.py`
- [API schemas](https://github.com/rahulpiska/movie_booking_api/blob/main/schemas.py): `schemas.py`
- [Domain ORM](https://github.com/rahulpiska/movie_booking_api/blob/main/models.py): `models.py`
- [Database sessions](https://github.com/rahulpiska/movie_booking_api/blob/main/database.py): `database.py`

### Identity

- [User registration](https://github.com/rahulpiska/movie_booking_api/blob/main/routes/users.py): `routes/users.py`
- [Login and profile](https://github.com/rahulpiska/movie_booking_api/blob/main/routes/auth.py): `routes/auth.py`
- [Password and access](https://github.com/rahulpiska/movie_booking_api/blob/main/utils.py): `utils.py`

### Catalog management

- [Movie catalog](https://github.com/rahulpiska/movie_booking_api/blob/main/routes/movies.py): `routes/movies.py`
- [Theatre management](https://github.com/rahulpiska/movie_booking_api/blob/main/routes/theatres.py): `routes/theatres.py`

### Shows and seats

- [Screens and seats](https://github.com/rahulpiska/movie_booking_api/blob/main/routes/screens.py): `routes/screens.py`
- [Show scheduling](https://github.com/rahulpiska/movie_booking_api/blob/main/routes/shows.py): `routes/shows.py`

### Booking

- [Booking lifecycle](https://github.com/rahulpiska/movie_booking_api/blob/main/routes/bookings.py): `routes/bookings.py`

### Other components

- **API client**
- **PostgreSQL**

## Connections

- API client → FastAPI app: sends requests
- FastAPI app → User registration: mounts routes (evidence: `main.py`)
- FastAPI app → Login and profile: mounts routes (evidence: `main.py`)
- FastAPI app → Movie catalog: mounts routes (evidence: `main.py`)
- FastAPI app → Theatre management: mounts routes (evidence: `main.py`)
- FastAPI app → Screens and seats: mounts routes (evidence: `main.py`)
- FastAPI app → Show scheduling: mounts routes (evidence: `main.py`)
- FastAPI app → Booking lifecycle: mounts routes (evidence: `main.py`)
- User registration → Password and access: hashes passwords (evidence: `routes/users.py`)
- Login and profile → Password and access: verifies and issues tokens (evidence: `routes/auth.py`)
- Login and profile → Password and access: checks current user (evidence: `routes/auth.py`)
- User registration → Database sessions: uses session (evidence: `routes/users.py`)
- Login and profile → Database sessions: uses session (evidence: `routes/auth.py`)
- Movie catalog → Database sessions: uses session (evidence: `routes/movies.py`)
- Theatre management → Database sessions: uses session (evidence: `routes/theatres.py`)
- Screens and seats → Database sessions: uses session (evidence: `routes/screens.py`)
- Show scheduling → Database sessions: uses session (evidence: `routes/shows.py`)
- Booking lifecycle → Database sessions: uses session (evidence: `routes/bookings.py`)
- User registration → Domain ORM: queries users (evidence: `routes/users.py`)
- Login and profile → Domain ORM: queries users (evidence: `routes/auth.py`)
- Movie catalog → Domain ORM: manages movies and shows (evidence: `routes/movies.py`)
- Theatre management → Domain ORM: manages theatres (evidence: `routes/theatres.py`)
- Screens and seats → Domain ORM: creates screens and seats (evidence: `routes/screens.py`)
- Show scheduling → Domain ORM: schedules and checks seats (evidence: `routes/shows.py`)
- Booking lifecycle → Domain ORM: creates and cancels bookings (evidence: `routes/bookings.py`)
- User registration → API schemas: validates and formats (evidence: `routes/users.py`)
- Login and profile → API schemas: formats profile (evidence: `routes/auth.py`)
- Movie catalog → API schemas: validates and formats (evidence: `routes/movies.py`)
- Theatre management → API schemas: validates and formats (evidence: `routes/theatres.py`)
- Screens and seats → API schemas: validates and formats (evidence: `routes/screens.py`)
- Show scheduling → API schemas: validates and formats (evidence: `routes/shows.py`)
- Booking lifecycle → API schemas: validates and formats (evidence: `routes/bookings.py`)
- Domain ORM → Database sessions: uses declarative base (evidence: `models.py`)
- Database sessions → PostgreSQL: connects to (evidence: `database.py`)
