How cybrarist/discount-bandit works
Project Type & Purpose
• This is a full-stack web application built with PHP (using Composer and Artisan) designed as a price tracker across multiple online shopping platforms. It notifies users when items drop to their desired price. It includes both a web interface for end-users and an administration section (through Filament) for managers.
• The README emphasizes deployment requirements (PHP, MySQL/SQLite, Apache/Nginx) as well as optional Docker deployment, which indicates flexibility in installation and environment configuration.
File Structure
• The “app” directory contains the core application’s logic following an MVC-like pattern: models (app/Models), controllers (app/Http/Controllers), requests, jobs, notifications, and helpers.
• The “app/Filament” subdirectories show resources, pages, and relation managers that suggest use of the Filament admin panel for backend management (CRUD operations for categories, groups, products, users, etc.).
• The “routes” folder splits the endpoints into web, API, and console routes.
• The “database” directory contains migrations, factories, and seeders that indicate relational database setup.
• The “public” directory contains assets and the entry point (index.php) that handles web client requests.
• The presence of Docker configuration files (Dockerfile, docker-compose.yaml) in the root and the “docker” folder shows that containerized deployment is supported.
• Additional directories targeting testing (tests/Unit and tests/Feature) are also present, ensuring the system is well tested.
Key Components & Their Interactions
a. Web Server and Frontend:
• The “public” folder represents the web entry point, with static assets (CSS, JavaScript) and HTML views (rendered by Laravel’s Blade templates in “resources/views”).
• Routes (routes/web.php) serve user-facing pages, while routes/api.php expose endpoints for integration.
b. Backend Application Layer:
• Controllers (in app/Http/Controllers) handle HTTP requests.
• Business logic is further separated into helpers (app/Helpers) and models (app/Models).
• Modules like Filament (app/Filament/) power the admin panel, and the commands in app/Console/Commands are used for maintenance and background tasks.
c. Database & Persistence:
• Database migrations and seeders set up the schema for entities such as products, stores, categories, users, and price histories.
• The configuration files in “config/database.php” and related settings configure how Laravel connects with MySQL or SQLite.
d. Background Processes & Notifications:
• Jobs (e.g., CrawlProductJob) handle asynchronous processing for crawling product prices.
• Notification channels (e.g., Apprise, Ntfy, and potential Telegram integration noted in the README) manage push notifications when discounts occur.
e. External Integrations:
• The helpers under “app/Helpers/StoresAvailable” indicate integrations with multiple shopping platforms (e.g., Amazon, Ajio, Flipkart) using tailored classes.
Architectural Patterns and Technologies
• MVC Pattern: Controllers, Models, and Views are clearly separated.
• Service Layer and Helpers: Business logic – especially for price tracking and integration with external stores – is modularized in helper classes.
• Admin Panel: The use of Filament indicates a dedicated panel for managing resources.
• Containerization: Docker files along with CI/CD GitHub workflows show modern deployment practices.
• API Design: With dedicated API controllers and resource classes (under “app/Http/Resources/Api”), the system supports external API access.