# krish-karmacharya/movie-ticket-booking-system architecture

> Architecture diagram of the GitHub repository krish-karmacharya/movie-ticket-booking-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/krish-karmacharya/movie-ticket-booking-system
- Repository: https://github.com/krish-karmacharya/movie-ticket-booking-system

## Overview

- Frontend Application:
- Represented by the "frontend" directory.
- Built with React.js, using Material-UI for design, Redux Toolkit for state management, React Router for navigation, and Axios for interfacing with the backend APIs.
- Key components include pages like HomePage, Movies management components (AddMovie, AllMovies, MovieItem, Movies), authentication and profile components, and utilities (like API helpers).

- Backend Application:
- Represented by the "backend" directory.
- Built using Node.js with Express.js. It contains clear separation with controllers, models, and routes for handling various aspects (movies, users, bookings, and admin-related operations).
- Controllers such as admin-controller.js, booking-controller.js, movie-controller.js, and user-controller.js indicate RESTful API endpoints.
- Data models for Admin, Bookings, Movie, and User (as seen in the models folder) indicate interactions with MongoDB via Mongoose.
- Middleware and business logic like JWT-based authentication and password hashing using bcryptjs.

- Database:
- Although not in the repository file structure physically, the README and backend setup instructions clearly indicate MongoDB is used.

##### Relationships and Interactions
- That the frontend communicates with endpoints such as authentication (login/register) and movie management endpoints (GET, POST, PUT, DELETE for movies) through the Express server.
- If applicable, note interactions between different controllers and models in the backend to showcase internal request flows.

##### Architectural Patterns and Technologies
- RESTful API architecture used in the backend.
- Usage of JWT for authentication handling, which secures endpoints and manages user sessions.
- Mention password security measures using bcryptjs in the backend.
- On the frontend, indicate the use of Redux Toolkit for state management and React Router for navigational state.
- Clearly label external libraries or frameworks like Material-UI (MUI).

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Frontend Layer"
        FE("Frontend Application"):::frontend
        HP("Home Page Component"):::frontend
        MOV("Movies Components"):::frontend
        AUTH("Authentication Components"):::frontend
        UP("User Profile"):::frontend
        AP("Admin Profile"):::frontend
        APIH("API Helper"):::frontend
        RS("Redux Store"):::frontend
    end

    subgraph "Backend Layer"
        BE("Backend Application"):::backend
        BR("Routes"):::backend
        BC("Controllers"):::backend
        BM("Models"):::backend
    end

    subgraph "Data Layer"
        DB("MongoDB Database"):::database
    end

    %% Frontend to Backend connections
    FE -->|"axios_calls"| BE
    APIH -->|"API_request"| BR

    %% Backend internal flow
    BR -->|"routes_to"| BC
    BC -->|"calls_model"| BM
    BM -->|"CRUD_operations"| DB

    %% Click Events
    click FE "https://github.com/krish-karmacharya/movie-ticket-booking-system/tree/main/frontend"
    click HP "https://github.com/krish-karmacharya/movie-ticket-booking-system/blob/main/frontend/src/components/HomePage.js"
    click MOV "https://github.com/krish-karmacharya/movie-ticket-booking-system/tree/main/frontend/src/components/Movies/"
    click AUTH "https://github.com/krish-karmacharya/movie-ticket-booking-system/tree/main/frontend/src/components/Auth/"
    click UP "https://github.com/krish-karmacharya/movie-ticket-booking-system/blob/main/frontend/src/profile/UserProfile.js"
    click AP "https://github.com/krish-karmacharya/movie-ticket-booking-system/blob/main/frontend/src/profile/AdminProfile.js"
    click APIH "https://github.com/krish-karmacharya/movie-ticket-booking-system/blob/main/frontend/src/api-helpers/api-helpers.js"
    click RS "https://github.com/krish-karmacharya/movie-ticket-booking-system/blob/main/frontend/src/store/index.js"
    click BE "https://github.com/krish-karmacharya/movie-ticket-booking-system/tree/main/backend"
    click BR "https://github.com/krish-karmacharya/movie-ticket-booking-system/tree/main/backend/routes/"
    click BC "https://github.com/krish-karmacharya/movie-ticket-booking-system/tree/main/backend/controllers/"
    click BM "https://github.com/krish-karmacharya/movie-ticket-booking-system/tree/main/backend/models/"

    %% Styles
    classDef frontend fill:#D0E6FF,stroke:#1F77B4,stroke-width:2px,color:#1F77B4;
    classDef backend fill:#FFD0D0,stroke:#D62728,stroke-width:2px,color:#D62728;
    classDef database fill:#DFFFD0,stroke:#2CA02C,stroke-width:2px,color:#2CA02C;
```
