How bam4102/ysabelles-mirror works
Main Components
• Client (Frontend): This is comprised of the HTML pages (e.g., index.php, home.php, login_page.php), CSS assets (in assets/css), JavaScript assets (in assets/scripts), and image/font assets. These are rendered in the browser.
• Web Server / Application Layer: The PHP backend is structured into different modules:
– API endpoints (in the “api” directory) provide specific server-side functionalities (e.g., get_products.php, categories.php).
– Controllers (in assets/controllers) that are organized by business domain (e.g., login, checkout, branch_requests, products, calendar, transactions2, reports, transmittal, etc.). These handle requests, business logic, and communication with the Database.
– Views (in assets/views) that provide the presentation templates which are rendered dynamically by the controllers.
– Models (found in assets/models) that interact with the database.
– Supporting libraries/utilities (e.g., assets/nav, or scripts under assets/scripts) that add client-side functionality.
• Database: Though not directly represented as a directory, you have several SQL scripts (in api and assets/sql directories) and database connection files (e.g., db.php) indicating an underlying relational database. Scripts such as “database_example.sql” and “u171783535_ysabelles(12).sql” suggest preconfigured aspects of the database schema.
Relationships and Interactions
• Client requests (e.g., coming via browser HTTP calls) interact with the Web Server.
• The Web Server routes these requests (for instance, through index.php, home.php, or directly via endpoints in assets/controllers) to the appropriate controllers.
• Controllers process the request, possibly invoking models to query or update the database, and then pass results to the appropriate Views to render HTML pages.
• API endpoints are used for AJAX calls—often by JavaScript from assets/scripts—to fetch or update data asynchronously.
• There is a distinct separation for features like login (authentication), cart functions (shopping cart management), branch requests (inventory requests perhaps across store branches), transactions (handling payments, bonding, releasing funds), reports, and transmittals for product transfers.
Architectural Patterns and Design Principles
• Modular Design: The project is clearly organized into modules (or “domains”) with dedicated controllers and views for each business function.
• MVC-like Separation: Even if not a strict MVC framework, there’s a practical separation between the presentation layer (views and CSS/JS assets), the business logic (controllers), and the data access (models and SQL scripts).
• API and AJAX Integration: There is robust use of API endpoints to handle asynchronous data flows between the client layer and backend services.
• Clear Separation Between Frontend and Backend Code: Assets such as controllers (PHP) and client scripts (JavaScript) are organized into their own directories.