How chlnlto/malvar-ems works
Project type and purpose
• This is a Laravel‐based full-stack web application with an integrated Filament admin panel. It manages municipal data such as barangays, companies, waste collection schedules, environmental clearances, announcements, documents, officials, and user records. It also provides export (XLSX/CSV) and PDF certificate generation features.
File structure
• Top-level directories:
• app/: application code (Models, Controllers, Policies, Services, Filament resources & widgets)
• config/: framework and package configuration
• database/: migrations and seeders
• public/: web assets (CSS/JS), index.php entry point
• resources/: Blade views, front-end CSS/JS sources
• routes/: web and console routes
• storage/: logs, caches, file uploads
• scripts/: deployment helpers
• tests/: unit and feature tests
• Key patterns:
• MVC (app/Models + app/Http/Controllers + resources/views)
• Service layer (app/Services, app/Exports)
• Filament Admin (app/Filament – Resources, Pages, Widgets)
• Authorization via Policies
README
• Generic Laravel framework README; confirms this is a Laravel web app but does not describe custom architecture. So rely on file structure for domain specifics.
Main components and their relationships
a. Frontend (Browser + Assets)
• Blade templates (resources/views)
• Filament UI (app/Filament + public/css & public/js/filament)
b. Web Server & Entry Point
• Nginx/Apache → public/index.php → Laravel HTTP kernel
c. Routing & HTTP Layer
• routes/web.php & console.php → Middleware → Controllers (e.g. HomeController, BarangayController, ExportController, PDFCertificateController)
d. Service Layer & Business Logic
• app/Services (PDFCertificateService) and app/Exports (EnvironmentalClearanceExport, etc.)
e. Domain Models & Data Access
• app/Models (Eloquent ORM)
• app/Policies (authorization)
f. Persistence & Infrastructure
• Database (MySQL/PostgreSQL) via config/database.php
• Migrations & Seeders populate tables
• Cache & Sessions (file, Redis, etc.)
• Queue (jobs table or Redis)
• Filesystem (local “storage/app/public” & “storage/app/private”)
g. External Services
• Mail (SMTP via config/mail.php)
• Broadcasting (Pusher/Echo in public/js/filament/echo.js)
• Third-party APIs (if any) configured in config/services.php
h. CI/CD & Deployment
• GitHub Actions (/.github/workflows/deploy.yml)
• Deployment scripts (scripts/deployment/*.sh)
Architectural patterns & design principles
• Layered architecture: Presentation → Application → Domain → Infrastructure
• MVC for the core app
• Service-oriented components for PDF generation & data export
• Policy-based authorization
• Filament as a module‐based admin panel using Livewire
• Separation of concerns: Controllers delegate to Services/Exports/Models
Relationships & data flow
• HTTP request from Browser → Web Server → Laravel Router
• Router → Controller → Service/Model → Database
• Service → Export/PDF generation → Storage or Response
• Response → Controller → Blade/Livewire → Browser
• Background jobs enqueued by Controllers → Queue Workers → Services → Database/Storage
• File uploads/downloads via Storage layer → public URLs