# hridoyhazard/food-paradise architecture

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

- Interactive diagram: https://gitdiagram.com/hridoyhazard/food-paradise
- Repository: https://github.com/hridoyhazard/food-paradise

## Overview

Based on our analysis of both the file tree and the README details, this project – Food Paradise – is a full-stack food blogging web application. It combines a rich, responsive frontend (built with HTML, CSS, Bootstrap, JavaScript, and jQuery) with a PHP-based backend (utilizing CodeIgniter and MySQL) and includes features such as user authentication, recipe posting, CRUD operations for food services, video/photo galleries, and PDF receipt generation using TCPDF.

##### Project Type & Purpose
- Project as a full-stack food blogging application. Its purpose is to allow foodies and bloggers to explore recipes, learn cooking techniques via articles and videos, and perform administrative tasks (like adding or editing services/recipes) with built-in functionalities such as user registration/login and PDF receipt printing.
- That the project uses a mix of front-end technologies to create a responsive user interface and PHP with CodeIgniter for the backend logic supported by a MySQL database.

- Client/Presentation Layer:
- Web Browser / User Interface: Represent pages such as Home, Login, Signup, Recipe Listings, Gallery, Filtered views, and Service management pages.
- Technologies: HTML, CSS (bootstrap styling), JavaScript, and jQuery.
- Server/Application Layer:
- PHP Scripts/Controllers: Include key PHP files (index.php, login.php, signup.php, add.php, edit.php, delete.php, service.php, print_pdf.php, etc.) that handle routing, business logic, and CRUD operations.
- External Libraries: Integrate TCPDF (located in the tcpdf directory) for generating PDF receipts and any other libraries if applicable.
- Data Layer:
- MySQL Database: Represent the database storing food recipes, user credentials, service information, and other contents. Mention the SQL file (food_paradise.sql) as a schema reference.

##### Relationships and Data Flow
- For the frontend, show that static assets (CSS, JavaScript, images, videos) are served from their respective folders.

##### Important Architectural Patterns & Design Principles
- MVC Pattern: Even if CodeIgniter’s folder structure is not explicitly visible, the project utilizes an MVC-like pattern with separate concerns for presentation (HTML/CSS/JS) and business logic (PHP controllers).
- Separation of Concerns: Clearly separate the concerns of UI, server-side processing, and data management.
- Modularity: Highlight PHP files for specific tasks (e.g., sign in/up, CRUD operations, PDF generation) as independently manageable modules.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client/Presentation Layer
    subgraph "Client/Presentation Layer"
        subgraph "UI Pages"
            UI_index("index.php"):::frontend
            UI_login("login.php"):::frontend
            UI_signup("signup.php"):::frontend
            UI_addModal("add_modal.php"):::frontend
            UI_editDeleteModal("edit_delete_modal.php"):::frontend
        end
        subgraph "Static Assets"
            Assets_css("CSS (css/): style.css, style2.css, sign.css"):::assets
            Assets_js("JS (js/): script.js, gallary.js, sign.js"):::assets
            Assets_bootstrap("Bootstrap (bootstrap/)"):::assets
            Assets_jquery("jQuery (jquery/)"):::assets
        end
    end

    %% Server/Application Layer
    subgraph "Server/Application Layer"
        subgraph "PHP Controllers"
            CTRL_add("add.php"):::backend
            CTRL_edit("edit.php"):::backend
            CTRL_delete("delete.php"):::backend
            CTRL_service("service.php"):::backend
            CTRL_printPDF("print_pdf.php"):::backend
            CTRL_login("login.php"):::backend
            CTRL_logout("logout.php"):::backend
            CTRL_sign("sign.php"):::backend
        end
        CI("CodeIgniter Framework"):::framework
        TCPDF("TCPDF Library"):::library
    end

    %% Data Layer
    subgraph "Data Layer"
        DB("MySQL Database"):::database
    end

    %% Relationships from Client to Backend
    UI_index -->|"HTTP_Request"| CTRL_service
    UI_login  -->|"HTTP_Request"| CTRL_login
    UI_signup -->|"HTTP_Request"| CTRL_sign
    UI_addModal -->|"HTTP_Request"| CTRL_add
    UI_editDeleteModal -->|"HTTP_Request"| CTRL_edit
    UI_editDeleteModal -->|"HTTP_Request"| CTRL_delete

    %% Relationship within Backend - MVC routing and external calls
    CTRL_service -->|"MVC_Routing"| CI
    CTRL_printPDF -->|"PDF_Generation"| TCPDF

    %% Relationship from Backend to Data Layer
    CTRL_service -->|"SQL_Query"| DB
    CTRL_add -->|"SQL_Query"| DB
    CTRL_edit -->|"SQL_Query"| DB
    CTRL_delete -->|"SQL_Query"| DB
    CTRL_login -->|"SQL_Query"| DB
    CTRL_sign -->|"SQL_Query"| DB
    CTRL_logout -->|"SQL_Query"| DB

    %% Click Events for Client/Presentation Layer
    click UI_index "https://github.com/hridoyhazard/food-paradise/blob/main/index.php"
    click UI_login "https://github.com/hridoyhazard/food-paradise/blob/main/login.php"
    click UI_signup "https://github.com/hridoyhazard/food-paradise/blob/main/signup.php"
    click UI_addModal "https://github.com/hridoyhazard/food-paradise/blob/main/add_modal.php"
    click UI_editDeleteModal "https://github.com/hridoyhazard/food-paradise/blob/main/edit_delete_modal.php"
    click Assets_css "https://github.com/hridoyhazard/food-paradise/tree/main/css/"
    click Assets_js "https://github.com/hridoyhazard/food-paradise/tree/main/js/"
    click Assets_bootstrap "https://github.com/hridoyhazard/food-paradise/tree/main/bootstrap/"
    click Assets_jquery "https://github.com/hridoyhazard/food-paradise/tree/main/jquery/"

    %% Click Events for PHP Controllers
    click CTRL_add "https://github.com/hridoyhazard/food-paradise/blob/main/add.php"
    click CTRL_edit "https://github.com/hridoyhazard/food-paradise/blob/main/edit.php"
    click CTRL_delete "https://github.com/hridoyhazard/food-paradise/blob/main/delete.php"
    click CTRL_service "https://github.com/hridoyhazard/food-paradise/blob/main/service.php"
    click CTRL_printPDF "https://github.com/hridoyhazard/food-paradise/blob/main/print_pdf.php"
    click CTRL_login "https://github.com/hridoyhazard/food-paradise/blob/main/login.php"
    click CTRL_logout "https://github.com/hridoyhazard/food-paradise/blob/main/logout.php"
    click CTRL_sign "https://github.com/hridoyhazard/food-paradise/blob/main/sign.php"

    %% Click Events for Backend Framework and External Library
    click CI "https://github.com/hridoyhazard/food-paradise/blob/main/source/config.php"
    click TCPDF "https://github.com/hridoyhazard/food-paradise/tree/main/tcpdf/"

    %% Click Event for Data Layer
    click DB "https://github.com/hridoyhazard/food-paradise/blob/main/food_paradise.sql"

    %% Styles
    classDef frontend fill:#ffe6e6,stroke:#cc0000,stroke-width:2px;
    classDef assets fill:#e6f7ff,stroke:#337ab7,stroke-width:2px;
    classDef backend fill:#e6ffe6,stroke:#009933,stroke-width:2px;
    classDef framework fill:#fff2e6,stroke:#ff9900,stroke-width:2px;
    classDef library fill:#e6f2ff,stroke:#0066cc,stroke-width:2px;
    classDef database fill:#ffe6ff,stroke:#cc0066,stroke-width:2px;
```
