How webby813/todoit-backend works
Main System Components
a. Clients
• Web browsers (Blade views served via public/index.php)
• Third-party API consumers (mobile apps, Postman, etc.)
b. Ingress Layer
• Web server (Nginx or Apache)
• SSL/TLS termination (if present)
c. Application Layer
• PHP runtime (PHP-FPM)
• Laravel framework
d. API Layer
• API routing (routes/api.php)
• Controllers (app/Http/Controllers/Api/V1/*)
• Form Requests (app/Http/Requests/V1) for validation
• API Resources (app/Http/Resources/V1) for output formatting
• Authentication via Sanctum (config/sanctum.php)
e. Web (Blade) Layer
• Web routing (routes/web.php)
• Blade views (resources/views/*.blade.php)
• Asset pipeline (Vite, JS/CSS under resources/js, resources/css)
f. Domain & Persistence
• Eloquent Models (app/Models/*) – User, TodoTask, pivot table
• Database (MySQL, PostgreSQL) with Migrations (database/migrations)
• Factories & Seeders (database/factories, database/seeders)
g. Infrastructure Services
• Cache (Redis, file)
• Queue (jobs table, workers)
• Storage (local/public under storage/app)
• Logging (storage/logs)
• Session management
• Configuration (config/*.php)
Relationships & Data Flow
• Browser → Nginx/Apache → public/index.php → Laravel bootstraps →
• If route is under /api/v1/*: pass through API middleware → Controller →
Request validation → Business logic → Eloquent → Database →
Resource transformation → JSON response → Browser or client.
• If route is a web route: Controller → Blade view rendering → HTML/CSS/JS → Browser.
• Asset requests (JS, CSS) → Vite dev server or compiled assets in public → Browser.
• Background jobs: dispatched from Controllers or Events → queued (DB/Redis) → Worker consumes → updates Database / sends notifications.
Architectural Patterns & Principles
• MVC pattern: Controllers, Models, Views.
• Layered architecture: Routing → Controllers → Requests → Domain → Persistence → Resources.
• Separation of concerns: Validation in Form Requests, presentation in Resources/Views.
• RESTful API design under versioned namespace (Api\V1).
• Dependency injection container (Providers/*.php) for service bindings.
• Environment configuration (.env.example) for 12-factor compliance.
Technologies, Frameworks & Libraries
• PHP + Laravel 10.x
• Sanctum for API authentication
• Eloquent ORM for database abstractions
• Vite (via vite.config.js) for asset bundling
• PHPUnit for testing (tests/)
• Composer & NPM for dependency management
• Blade templating engine
• Redis (optional) for cache/queues