# rajpatel676/bookify architecture

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

- Interactive diagram: https://gitdiagram.com/rajpatel676/bookify
- Repository: https://github.com/rajpatel676/bookify

## Overview

##### Project type and purpose
- Bookify is a full-stack web application for online booking (hotels, restaurants, guest houses).
- It uses static HTML/CSS/JS for the UI, a Node.js backend (server.js), and a MySQL database for persistence.

##### File structure
- Top-level “Table_Booking” folder:
- public/ – all static HTML pages (index.html, booking.html, login.html, etc.)
- css/ – global style.css
- img/ – static images
- lib/ – third-party JS/CSS libraries (owlcarousel, animate.css, tempusdominus, etc.)
- js/ – contains both client code (main.js) and the Node.js backend (server.js, package.json, node_modules)
- vercel.json – optional deployment settings for Vercel
- Configuration: package.json for npm, .gitignore, README.md

##### README
- Confirms HTML/CSS frontend, Node.js backend, and MySQL database named “usersystem” with tables “users” (id, name, email, password) and likely a “bookings” table.
- Mentions real-time data sync and email notifications (contact page SMTP).

##### Main components
a. Frontend (Client Browser)
- Static assets:
- HTML pages (public/)
- CSS (css/)
- JS/CSS libraries (lib/)
- Client-side logic (js/main.js)
b. Backend (Node.js server)
- server.js (Express or HTTP server)
- API endpoints:
- Authentication (signup, login, reset password)
- Booking operations (search availability, book, cancel)
- Contact/email service
- Business logic (in server.js)
- Environment config (e.g., SMTP credentials, DB connection)
c. Database (MySQL)
- usersystem database
- users table
- bookings (or reservations) table
d. External services
- SMTP/email provider for contact form
- (Optional) Vercel/serverless functions if used for deployment

##### Relationships and data flows
- User’s Browser → HTTP(S) GET/POST → Node.js Server
- Node.js Server → SQL queries → MySQL Database
- Node.js Server → SMTP commands → Email Service
- Static assets served by the same Node.js server (or via CDN/Vercel)

##### Architectural patterns & principles
- Layered architecture: Presentation (HTML/CSS/JS) → API layer (Express routes) → Data layer (MySQL)
- Single-page navigation via static HTML pages + client JS for dynamic interactions
- Separation of concerns: static file hosting vs API endpoints vs data persistence
- Use of third-party libraries for UI enhancements (animate.css, owlcarousel, tempusdominus)

##### Final checklist
- Annotations for key technologies (Node.js, MySQL, HTML/CSS, lib folder components, SMTP)
- Deployment node (localhost:3000 or Vercel)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend (Client)" 
        direction TB
        Browser["User's Browser"]:::frontend
        subgraph "Static Assets"
            direction TB
            Public["public/"]:::frontend
            CSS["css/style.css"]:::frontend
            IMG["img/"]:::frontend
            LIB["lib/"]:::frontend
            CLIENTJS["js/main.js"]:::frontend
        end
    end

    %% Backend Layer
    subgraph "Backend (Node.js Server)" 
        direction TB
        Server["server.js (Express)"]:::backend
        PackageJS["package.json"]:::backend
        NodeMod["node_modules/"]:::backend
    end

    %% Database and External Services
    DB[(usersystem MySQL DB)]:::db
    Email["SMTP Email Service"]:::external

    %% Deployment & Metadata
    Deploy["vercel.json"]:::deploy
    subgraph "Project Metadata"
        direction TB
        README["README.md"]:::meta
        GitIgnore[".gitignore"]:::meta
        RootPackage["package.json"]:::meta
    end

    %% Data Flows
    Browser -->|"HTTP GET/POST"| Server
    Server -->|"SQL queries"| DB
    Server -->|"SMTP commands"| Email

    %% Static Asset Requests
    Browser -->|"loads static assets"| Public
    Browser --> CSS
    Browser --> IMG
    Browser --> LIB
    Browser --> CLIENTJS

    %% Backend Package Links
    Server --- PackageJS
    Server --- NodeMod

    %% Deployment Link
    Deploy -.-> Server

    %% Click Events
    click Public "https://github.com/rajpatel676/bookify/tree/main/Table_Booking/public/"
    click CSS "https://github.com/rajpatel676/bookify/blob/main/Table_Booking/css/style.css"
    click IMG "https://github.com/rajpatel676/bookify/tree/main/Table_Booking/img/"
    click LIB "https://github.com/rajpatel676/bookify/tree/main/Table_Booking/lib/"
    click CLIENTJS "https://github.com/rajpatel676/bookify/blob/main/Table_Booking/js/main.js"
    click Server "https://github.com/rajpatel676/bookify/blob/main/Table_Booking/js/server.js"
    click PackageJS "https://github.com/rajpatel676/bookify/blob/main/Table_Booking/js/package.json"
    click NodeMod "https://github.com/rajpatel676/bookify/tree/main/Table_Booking/js/node_modules/"
    click Deploy "https://github.com/rajpatel676/bookify/blob/main/Table_Booking/vercel.json"
    click README "https://github.com/rajpatel676/bookify/blob/main/README.md"
    click GitIgnore "https://github.com/rajpatel676/bookify/blob/main/Table_Booking/.gitignore"
    click RootPackage "https://github.com/rajpatel676/bookify/blob/main/Table_Booking/package.json"

    %% Styles
    classDef frontend fill:#1E90FF,stroke:#000,color:#fff
    classDef backend fill:#32CD32,stroke:#000,color:#fff
    classDef db fill:#FFA500,stroke:#000,color:#000
    classDef external fill:#9370DB,stroke:#000,color:#fff
    classDef deploy fill:#9ACD32,stroke:#000,color:#000
    classDef meta fill:#D3D3D3,stroke:#000,color:#000
```
