# 06skyadav/online-food-ordering-system-in-php-main architecture

> Architecture diagram of the GitHub repository 06skyadav/online-food-ordering-system-in-php-main, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/06skyadav/online-food-ordering-system-in-php-main
- Repository: https://github.com/06skyadav/online-food-ordering-system-in-php-main

## Overview

##### Project type and purpose
- This is a monolithic, full‑stack PHP web application (“Online Food Ordering System in PHP”) that supports both customer‑facing ordering and an admin panel for managing restaurants, menus, orders, and users.
- Key use cases: user registration/login, browse restaurants & menus, place orders, view order history; admin CRUD on restaurants, categories, menus, orders, users.

##### File structure
- Top‑level PHP scripts (index.php, restaurants.php, dishes.php, checkout.php, etc.) serve the public customer site.
- “admin/” directory contains the entire back‑office interface (dashboard.php, add_menu.php, all_orders.php, etc.), plus its own CSS/JS/libs.
- “connection/connect.php” provides the database connection. “include/footer.php” is a shared view fragment.
- Assets:
- css/, js/, scss/, images/ for front‑end styling and client‑side scripts (mapbox.js, markerclusterer.js, etc.).
- admin/css/, admin/js/ for back‑office UI and plugins (DataTables, calendar, charts).
- Database script: DATABASE FILE/online_food_ordering_system.sql indicates a MySQL schema.

##### Extract architectural insights from the README
- Confirms core modules: food preview, account creation, ordering, order management, admin panel features (restaurant/category/menu management, delivery management).
- No microservices or external API integrations mentioned—this is a single PHP app with a relational DB.

##### Main components
a. Client layer
- Web browser/mobile browser running HTML, CSS, JS (mapbox, headroom, etc.)
b. Web server/PHP application
- Public portal modules: authentication, restaurant listing, menu browsing, cart/checkout, order history
- Admin portal modules: dashboard, user management, restaurant/category/menu CRUD, order & delivery management
c. Database
- MySQL (schema as per online_food_ordering_system.sql)
d. Static asset server
- Serves CSS/JS/images (could be the same server or a CDN)
e. (Optional) External libraries/APIs
- Mapbox/geolocation, markerclusterer for maps in the front end

##### Relationships and data flows
- Separate flow for admin: same HTTP/S channel but under “/admin” path, with authentication enforced.
- Static asset requests (CSS/JS/images) serve directly or via CDN.

##### Architectural patterns & design principles
- Monolithic MVC‑style layering (albeit without a formal framework):
- Model: connection/connect.php + SQL scripts + PHP data access in each module
- View: PHP templates (index.php, dashboard.php, include/footer.php) with embedded HTML/CSS/JS
- Controller: each PHP file (add_menu.php, update_orders.php) orchestrates input → DB → view
- Separation of concerns: public vs. admin modules in distinct directories.
- Reusable shared components: “include/” folder for common templates; “connection/” for DB connectivity.

##### Technologies & frameworks
- Back end: PHP 7+, MySQL
- Front end: HTML5, CSS3, SCSS, JavaScript (jQuery, mapbox.js, headroom.js, markerclusterer.js, infobox_packed.js)
- Admin UI plugins: DataTables, fullCalendar, C3 charts, SweetAlert, Toastr, Bootstrap
- Build tools: SCSS preprocessor

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    Client["Web Browser\n(HTML/CSS/JS)"]:::client

    %% External APIs
    Mapbox["Mapbox & Geolocation"]:::external
    Marker["MarkerClusterer & InfoBox"]:::external

    %% PHP Application
    subgraph "PHP App" 
        direction TB
        subgraph "Public Portal"
            direction TB
            AuthService["Authentication Module"]:::backend
            MenuService["Menu & Browsing Module"]:::backend
            CartService["Cart & Ordering Module"]:::backend
            HistoryService["Order History Module"]:::backend

            reg["registration.php"]:::backend
            click reg "https://github.com/06skyadav/online-food-ordering-system-in-php-main/blob/master/registration.php"
            log["login.php"]:::backend
            click log "https://github.com/06skyadav/online-food-ordering-system-in-php-main/blob/master/login.php"
            logout["logout.php"]:::backend
            click logout "https://github.com/06skyadav/online-food-ordering-system-in-php-main/blob/master/logout.php"

            home["index.php"]:::backend
            click home "https://github.com/06skyadav/online-food-ordering-system-in-php-main/blob/master/index.php"
            restaurants["restaurants.php"]:::backend
            click restaurants "https://github.com/06skyadav/online-food-ordering-system-in-php-main/blob/master/restaurants.php"
            dishes["dishes.php"]:::backend
            click dishes "https://github.com/06skyadav/online-food-ordering-system-in-php-main/blob/master/dishes.php"

            cartAction["product-action.php"]:::backend
            click cartAction "https://github.com/06skyadav/online-food-ordering-system-in-php-main/blob/master/product-action.php"
            checkout["checkout.php"]:::backend
            click checkout "https://github.com/06skyadav/online-food-ordering-system-in-php-main/blob/master/checkout.php"
            orders["your_orders.php"]:::backend
            click orders "https://github.com/06skyadav/online-food-ordering-system-in-php-main/blob/master/your_orders.php"

            AuthService --> reg
            AuthService --> log
            AuthService --> logout
            MenuService --> home
            MenuService --> restaurants
            MenuService --> dishes
            CartService --> cartAction
            CartService --> checkout
            HistoryService --> orders
        end

        subgraph "Admin Portal"
            direction TB
            AdminAuth["Admin Authentication"]:::backend
            Dashboard["dashboard.php"]:::backend
            click Dashboard "https://github.com/06skyadav/online-food-ordering-system-in-php-main/blob/master/admin/dashboard.php"
            
            subgraph "Restaurant Mgmt"
                addRest["add_restaurant.php"]:::backend
                click addRest "https://github.com/06skyadav/online-food-ordering-system-in-php-main/blob/master/admin/add_restaurant.php"
                updRest["update_restaurant.php"]:::backend
                click updRest "https://github.com/06skyadav/online-food-ordering-system-in-php-main/blob/master/admin/update_restaurant.php"
                delRest["delete_restaurant.php"]:::backend
                click delRest "https://github.com/06skyadav/online-food-ordering-system-in-php-main/blob/master/admin/delete_restaurant.php"
                listRest["all_restaurant.php"]:::backend
                click listRest "https://github.com/06skyadav/online-food-ordering-system-in-php-main/blob/master/admin/all_restaurant.php"
            end

            subgraph "Category Mgmt"
                addCat["add_category.php"]:::backend
                click addCat "https://github.com/06skyadav/online-food-ordering-system-in-php-main/blob/master/admin/add_category.php"
                updCat["update_category.php"]:::backend
                click updCat "https://github.com/06skyadav/online-food-ordering-system-in-php-main/blob/master/admin/update_category.php"
                delCat["delete_category.php"]:::backend
            end

            subgraph "Menu Mgmt"
                addMenu["add_menu.php"]:::backend
                click addMenu "https://github.com/06skyadav/online-food-ordering-system-in-php-main/blob/master/admin/add_menu.php"
                updMenu["update_menu.php"]:::backend
                click updMenu "https://github.com/06skyadav/online-food-ordering-system-in-php-main/blob/master/admin/update_menu.php"
                delMenu["delete_menu.php"]:::backend
                click delMenu "https://github.com/06skyadav/online-food-ordering-system-in-php-main/blob/master/admin/delete_menu.php"
                listMenu["all_menu.php"]:::backend
                click listMenu "https://github.com/06skyadav/online-food-ordering-system-in-php-main/blob/master/admin/all_menu.php"
            end

            subgraph "Order Mgmt"
                allOrders["all_orders.php"]:::backend
                click allOrders "https://github.com/06skyadav/online-food-ordering-system-in-php-main/blob/master/admin/all_orders.php"
                delOrders["delete_orders.php"]:::backend
                click delOrders "https://github.com/06skyadav/online-food-ordering-system-in-php-main/blob/master/admin/delete_orders.php"
                updOrders["order_update.php"]:::backend
                click updOrders "https://github.com/06skyadav/online-food-ordering-system-in-php-main/blob/master/admin/order_update.php"
                viewOrder["view_order.php"]:::backend
                click viewOrder "https://github.com/06skyadav/online-food-ordering-system-in-php-main/blob/master/admin/view_order.php"
            end

            subgraph "User Mgmt"
                allUsers["all_users.php"]:::backend
                click allUsers "https://github.com/06skyadav/online-food-ordering-system-in-php-main/blob/master/admin/all_users.php"
                updUsers["update_users.php"]:::backend
                click updUsers "https://github.com/06skyadav/online-food-ordering-system-in-php-main/blob/master/admin/update_users.php"
                delUsers["delete_users.php"]:::backend
                click delUsers "https://github.com/06skyadav/online-food-ordering-system-in-php-main/blob/master/admin/delete_users.php"
                profile["userprofile.php"]:::backend
                click profile "https://github.com/06skyadav/online-food-ordering-system-in-php-main/blob/master/admin/userprofile.php"
            end

            adminIndex["admin/index.php"]:::backend
            click adminIndex "https://github.com/06skyadav/online-food-ordering-system-in-php-main/blob/master/admin/index.php"
            adminLogout["admin/logout.php"]:::backend
            click adminLogout "https://github.com/06skyadav/online-food-ordering-system-in-php-main/blob/master/admin/logout.php"

            AdminAuth --> adminIndex
            AdminAuth --> adminLogout
            AdminAuth --> Dashboard
        end

        %% Shared Components
        shared1["include/footer.php"]:::utility
        click shared1 "https://github.com/06skyadav/online-food-ordering-system-in-php-main/blob/master/include/footer.php"
        shared2["admin/include/footer.php"]:::utility
        click shared2 "https://github.com/06skyadav/online-food-ordering-system-in-php-main/blob/master/admin/include/footer.php"
        dbConn["DB Connection\n(connection/connect.php)"]:::utility
        click dbConn "https://github.com/06skyadav/online-food-ordering-system-in-php-main/blob/master/connection/connect.php"

        PublicPortal --> dbConn
        AdminPortal --> dbConn
        shared1 -.-> PublicPortal
        shared2 -.-> AdminPortal
    end

    %% Static Assets
    subgraph "Static Asset Server"
        direction TB
        pubCSS["css/style.css,\ncss/login.css,\ncss/animate.css"]:::assets
        pubJS["js/foodpicky.js,\njs/mapbox.js,\njs/markerclusterer.js,\njs/infobox_packed.js,\njs/headroom.js"]:::assets
        scss["scss/style.scss"]:::assets
        images["images/, fonts/"]:::assets

        adminCSS["admin/css/"]:::assets
        adminJS["admin/js/"]:::assets
        adminImgs["admin/images/, admin/Res_img/"]:::assets
        adminIcons["admin/icons/"]:::assets
    end

    %% Database
    DB["MySQL Database"]:::db
    schema["online_food_ordering_system.sql"]:::db
    click schema "https://github.com/06skyadav/online-food-ordering-system-in-php-main/blob/master/DATABASE FILE/online_food_ordering_system.sql"

    %% Data Flows
    Client -->|"HTTP Request/Response"| PublicPortal
    Client -->|"HTTP Request/Response"| AdminPortal
    PublicPortal -->|"SQL Queries/Results"| DB
    AdminPortal -->|"SQL Queries/Results"| DB
    DB -->|"Query Results"| PublicPortal
    DB -->|"Query Results"| AdminPortal

    Client -->|"Asset Requests"| pubCSS
    Client --> pubJS
    Client --> images
    PublicPortal --> pubCSS
    PublicPortal --> pubJS
    PublicPortal --> images

    AdminPortal --> adminCSS
    AdminPortal --> adminJS
    AdminPortal --> adminImgs
    AdminPortal --> adminIcons

    Client --> Mapbox
    Client --> Marker

    %% Styles
    classDef client fill:#cce5ff,stroke:#004085,color:#004085
    classDef backend fill:#d4edda,stroke:#155724,color:#155724
    classDef db fill:#fff3cd,stroke:#856404,color:#856404
    classDef assets fill:#e2e3e5,stroke:#6c757d,color:#6c757d
    classDef external fill:#f5c6cb,stroke:#721c24,color:#721c24
    classDef utility fill:#f0f0f0,stroke:#333333,color:#333333
```
