- Context and Scope
- Development Phases
- Architectural Decisions
- C4 Architecture
- API Reference
- Installation & Running
EcoManager is a web application that supports citizens, collection staff and administrators in reporting, sorting and recycling urban waste (household, paper, plastic, etc.). It also provides:
- User reports of overflow or litter hotspots
- Interactive map (Leaflet + OpenStreetMap)
- Statistics & charts per day/week/month, exportable to HTML, CSV and PDF
- Admin module for managing users, categories and locations
- (Bonus) a simple recycling-process simulator
- Rapid reporting & visualization of waste data
- Export in CSV, PDF and JSON
- Responsive, modern interface (HTML5 + CSS3, no frameworks)
- Secure (SQL Injection & XSS prevention)
- Fully “vanilla” PHP + JS (no frameworks)
| Phase | Duration | Objectives |
|---|---|---|
| 1. Foundation | 1–2 weeks | • Define architecture • Setup Git • Project structure |
| 2. Backend Core | 2-3 weeks | • Models & DB (SQLite) • Services & REST API • OSM integration |
| 3. Frontend | 2-3 weeks | • Responsive HTML/CSS • Dynamic JS (Ajax, Leaflet, Chart.js) |
| 4. Admin & Export | 1–2 weeks | • Admin module • CSV/PDF/JSON export • Recycling simulator |
| 5. Testing & Security | 1 week | • Input validation & XSS/SQLi protection • UAT & bug-fix |
| 6. Deployment | 2-3 days | • Simple production deploy • Final documentation |
| Component | Technology | Why? |
|---|---|---|
| Back-end | PHP 8.2 & Apache & SQLite | Simple, no separate DB server |
| Front-end | Vanilla JS & Leaflet & Chart.js | No JS framework, full control |
| Map Tiles | OpenStreetMap | Free, open data |
| Exports | PHP + JS helpers | CSV nativ, PDF via TCPDF, JSON direct |
- Layered: Controllers → Services → Repositories → DB
- C4 for architecture docs
- Secure by Design: PDO prepared statements,
htmlspecialchars(), session-based auth
- Modularity
Code organized in layers (Controllers, Services, Repositories, Templates), each with a clear responsibility. - Maintainability
File structure and C4 documentation that facilitate onboarding and ongoing maintenance. - Performance
Dynamic interfaces using AJAX, Leaflet, and Chart.js; minimal static pages; SQLite for fast data access. - Security
- Session-based authentication with
password_hash() - PDO Prepared Statements (SQL Injection prevention)
htmlspecialchars()in templates (XSS prevention)
- Session-based authentication with
- REST API
JSON endpoints clearly separated from the UI. - Responsive Web Design
Validated HTML5 + CSS3, adaptive layout for mobile & desktop. - Interactive Map
Leaflet + OpenStreetMap for waste reporting. - Data Visualization
Chart.js for daily/weekly/monthly charts. - Export Formats
CSV, PDF, JSON via dedicated endpoints.
- Separation of Concerns
UI (templates + JS) vs. business logic (Controllers/Services) vs. persistence (Repositories). - DRY (Don’t Repeat Yourself)
Reusable functions and services, PSR-0 autoloading. - Error Handling
PDOERRMODE_EXCEPTIONand appropriate HTTP status codes (400/401/403/500). - Input Validation & Sanitization
- Client-side (JS) and server-side (Validators) validation
- Filtering and sanitization before insertion
- Version Control & Documentation
Git + modular Markdown documentation (C4, API, installation)