How 42webok/online-food-ordering works
Project type and purpose
• This is a full-stack, PHP-based web application (“Online Food Ordering System”) with two main user interfaces (public/front-end and admin panel) and a set of REST-style API endpoints under development. Users browse menu items, manage a cart, place orders; administrators manage banners, categories, dishes, coupons, delivery boys, and view contact messages.
File structure
• Top-level directories
– /front_html & root PHP files: public-facing HTML/PHP views (menus, cart, checkout, contact, login/register).
– /admin: admin dashboard UI and PHP controllers (login, CRUD scripts, utility includes).
– /api: PHP scripts grouped by resource (banner, category, coupen_code, delivery_boy, dish, contact_data, users) plus authentication.
– /assets & /admin/assets & /front_html/assets: static assets (CSS, JS, fonts, images) for each UI.
– /vendor & composer.json: third-party PHP dependencies (via Composer).
– Shared includes (function_inc.php, database.inc.php) for business logic and DB connectivity.
• Architectural clues
– MVC-style separation (views in HTML/PHP, controllers in PHP scripts, data access in includes).
– API layer sits alongside UI—enables mobile or JS-powered clients.
– Shared database backend (MySQL) accessed via config and include files.
README insights
• Tech stack: Frontend (HTML5, CSS3, JS, Bootstrap, jQuery), Backend (Core PHP), Database (MySQL).
• API planned: JSON-based endpoints for products, cart, orders, contact.
• Emphasis on modular API structure under /api.
Main components & interactions
a. Components
• User Devices (Web browser on desktop/mobile)
• Public-Facing Frontend UI
• Admin Backend UI
• API Layer
• Business Logic (PHP controllers and functions)
• Data Access Layer (database.inc.php, function_inc.php)
• MySQL Database
• Static Asset Store (CSS, JS, images served by web server)
• External Services (e.g., email verification service, optional SMS/API)
b. Relationships & Data Flow
1. Browser → Frontend UI → PHP controllers → Data Access → MySQL
2. Browser → /api endpoints → JSON responses ← PHP business logic ← MySQL
3. Admin UI → Admin PHP controllers → MySQL (CRUD)
4. Shared static assets served directly by web server or via CDN
5. PHP mail() or SMTP calls for password reset & contact form
c. Architectural patterns & principles
– Layered architecture: Presentation (views), Controller (business logic), Data Access.
– Resource-based API endpoints organized into modules (REST style).
– Reusable includes for config, DB connection, common functions.
d. Key technologies
– Apache/Nginx + PHP7+
– MySQL
– Bootstrap, jQuery, Font Awesome for UI
– Composer for dependency management (vendor)
– JSON for API payloads