How shigaev/edu.platform works
Main Components
• Client Layer:
• Web Browser / Clients that access the public site and the admin interface.
• Frontend Application (public site):
• This includes the entry point (frontend/public/index.php), controllers, models, and views.
• Also shows assets like CSS, JS, images, and fonts.
• Accompanied by the “src/frontend” folder that contains JavaScript and SCSS components built by Webpack.
• Backend Application (admin interface):
• Similarly composed of its entry point (backend/public/index.php), controllers, models, and views.
• Has its own configuration, routing, and asset structure.
• The “src/backend” directory provides frontend assets and styling for the admin area.
• Core/Framework Components:
• The “core” directory includes essential classes like the Router, Controller, ActiveRecord (Model implementation), Db for database interactions, Settings, and View.
• Shared/Common Code:
• The “common” directory, which contains shared models and possibly other resources utilized by both the frontend and backend.
• Database Layer:
• MySQL database that stores persistent data.
• The “db/migrations” directory and the “phinx.php” configuration file indicate that database versioning and migration scripts are managed via Phinx.
• Additional Services and Utilities:
• The “services” directory (e.g., UserAuthService.php) handles business logic such as user authentication.
• Exception handling is centralized in the “exceptions” folder.
• The “config” directories (both at the root and within frontend/backend) indicate separate routing and settings configuration.
• Build and Asset Pipeline:
• The “webpack.config.js”, “package.json”, and “package-lock.json” files indicate an asset bundling/build step that compiles the SCSS and JavaScript used in both frontend and backend modules.
Relationships and Interactions
• The client (web browser) sends HTTP requests that are routed to either the frontend or backend via Apache’s VirtualHost configurations.
• The Apache configuration excerpt from the README details two separate VirtualHosts:
• “edu.platform” (points to the frontend/public folder)
• “edu.platform.admin” (points to the backend/public folder)
• Each application (frontend and backend) processes the HTTP request via a common router (in the “core/Router.php”), which directs the request to the appropriate controller.
• The controllers invoke relevant models (sometimes shared via “common/models”) and render views (HTML templates in folders like “frontend/views” or “backend/views”).
• Database interactions occur via the “core/Db.php” and are governed by migrations to create/update tables.
• The asset pipeline with Webpack takes raw SCSS/JS from the “src” directories to produce optimized assets that reside in the “public” folders.
• The services (e.g., UserAuthService) and exception handlers provide additional application logic and error handling.
Architectural Patterns and Technologies
• MVC Pattern: Both frontend and backend applications are organized by the Model-View-Controller paradigm.
• Separation of Concerns: Clear distinctions exist between presentation (views), business logic (controllers and services), and data access (models/Core).
• Shared Core Library: Reusable core modules encapsulate common functionalities like routing, database access, and view loading.
• Asset Pipeline: Use of modern tooling (Webpack, SCSS) for frontend build and optimization.
• Database Migration: Phinx is used for managing schema changes, indicating a version-controlled database evolution.
Final Reminders to the Principal Software Engineer
• Component is clearly labeled.
• Be detailed—outline every major folder and module that plays a significant role in the overall architecture.