# sonal-jaiswal/flight-ticket-booking architecture

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

- Interactive diagram: https://gitdiagram.com/sonal-jaiswal/flight-ticket-booking
- Repository: https://github.com/sonal-jaiswal/flight-ticket-booking

## Overview

##### Main Components
- Frontend (Views): All user interface components are represented in the views directory (e.g., land, home, login, register, book, etc.). These pages support both client and admin interactions.
- Backend (Application Logic): This is primarily centered in app.js (which serves as the entry point and likely includes routing, middleware, and session management).
- Data Models: In the models directory, several modules (admin, booking, flight, user) handle the data structure and business logic related to flights and user management.
- Administrative vs. Client Paths: Note the dual model – admin functionalities (e.g., adding, modifying, removing flights) versus client functionalities (e.g., registration, search, booking).

##### Relationships and Interactions
- Within the Backend, break out interactions with the Data Models (admin, booking, flight, user). Indicate CRUD operations flowing between app.js and these model components.
- REST API interactions: Show endpoints interfacing between the client and server and label endpoints that perform REST-ful operations.
- Incorporate Session Management: You might denote a session handling component within the backend, responsible for user authentication and maintaining user state.

##### Architectural Patterns and Design Principles
- MVC Pattern: Clearly segregate the Components (Models, Views, Controllers/Router in app.js).
- Client-Server Separation: Demonstrate the distinct layers (client-side views interacting with the backend).
- Security & Session Management: Indicate that session-handling mechanisms (like authentication middleware in app.js) are in place.

## Diagram (Mermaid)

```mermaid
flowchart TD
    User["User (Client/Admin)"]:::user

    subgraph "Presentation Layer"
        Frontend["Frontend (Views - EJS)"]:::frontend
    end

    Backend["Backend (app.js) [REST API & Session Management]"]:::backend
    Models["Models (Data Models)"]:::models
    Database["Database"]:::database

    User -->|"UserInteraction"| Frontend
    Frontend -->|"HTTP_Request"| Backend
    Backend -->|"CRUD_Operations"| Models
    Models -->|"Data_Storage"| Database
    Backend -->|"HTTP_Response"| Frontend

    click Frontend "https://github.com/sonal-jaiswal/flight-ticket-booking/tree/main/views/"
    click Backend "https://github.com/sonal-jaiswal/flight-ticket-booking/blob/main/app.js"
    click Models "https://github.com/sonal-jaiswal/flight-ticket-booking/tree/main/models/"

    classDef user fill:#f2e6ff,stroke:#663399,stroke-width:2px;
    classDef frontend fill:#ffcccc,stroke:#b30000,stroke-width:2px;
    classDef backend fill:#cce5ff,stroke:#003366,stroke-width:2px;
    classDef models fill:#ccffcc,stroke:#006600,stroke-width:2px;
    classDef database fill:#ffffcc,stroke:#999900,stroke-width:2px;
```
