How jsnmrs/aggro works
The Aggro project is a full-stack web application built with the CodeIgniter 4 PHP framework. It powers BMXfeed – a BMX news aggregator and video discovery platform – and integrates with YouTube, Vimeo, and RSS feeds to collect and display BMX-related content. The project leverages a containerized development environment (Docksal), utilizes MySQL/MariaDB as the backend database, and uses Vanilla CSS with PostCSS for frontend styling.
Main Components
• Backend: The core of the application is built with PHP using the CodeIgniter 4 framework. The “app” directory contains controllers (e.g., Home.php, Aggro.php), models (e.g., AggroModels.php, NewsModels.php), configuration files (in app/Config), libraries, helpers, and views.
• Frontend: The “public” directory holds the static assets including the main index.php entry point, CSS files (with PostCSS processing), and other public resources.
• Database: Aggro uses MySQL/MariaDB, and the SQL dump (aggro-db.sql) outlines the structure. Database configuration is managed within CodeIgniter’s config (app/Config/Database.php) and via environment variables.
• External Services: Integration with YouTube and Vimeo APIs for video details, as well as SimplePie for RSS feed parsing.
• Docksal / Dev Environment: The project uses Docksal for local development. The “.docksal” directory contains commands, environment configuration (docksal.env and docksal.yml), and custom scripts to facilitate various tasks (e.g., testing, deployment, frontend build).
• Additional Components: CRON jobs (using .crontab) for scheduled tasks such as news feed updates, video checks, archiving, and cache clearing.
Establish Relationships and Interactions
• The Frontend (public/) requests data served by the PHP backend in response to user interactions.
• Controllers in the CodeIgniter framework process requests, interact with Models (app/Models) to fetch or update data from the MySQL/MariaDB database, and then hand off responses to Views (in app/Views) for rendering the UI.
• The backend communicates with external APIs (YouTube, Vimeo) to fetch video metadata and parse RSS feeds through SimplePie.
• Scheduled tasks executed from the system’s CRON (defined in .crontab) interact with the backend logic to maintain updated feeds, perform video checks, and manage the archive.
• Docksal orchestrates the containers needed for development and testing. Custom Docksal commands (e.g., fin test, fin deploy, fin frontend) encapsulate build, maintenance, and deployment processes.
Architectural Patterns and Technologies
• MVC Pattern: The directory structure (with separate folders for Controllers, Models, Views, Config, etc.) clearly reflects a Model-View-Controller architecture.
• Containerized Development: The use of Docksal ensures that developers run the application in a consistent containerized environment.
• CI/CD: GitHub workflows for automated deployment and testing indicate a continuous integration and deployment pipeline.
• Separation of Concerns: Different components (backend logic, frontend assets, database interaction, scheduling) are separated into distinct directories and configuration files, ensuring modularity.