How chittun1810/library-book-management-system works
Main Components
a. Client Layer
• Web Browser or API Consumer (e.g., Postman)
b. Presentation / Web Server
• Nginx or Apache (serving static assets from /public)
• PHP-FPM (executes Laravel)
c. Application Layer (Laravel MVC)
• HTTP Kernel & Middleware (authentication, rate-limiting, input sanitization)
• Routing (routes/web.php for Blade views, routes/api.php for JSON APIs)
• Controllers (e.g., BookController, UserController)
• Form Requests (validation classes under app/Http/Requests)
• Models & Eloquent ORM (app/Models, relationships to books, authors, borrow_records, users)
• Enums & Helpers (app/Enums, app/Helpers/Response.php)
• Service Providers (bootstrapping in app/Providers)
d. Persistence Layer
• Relational Database (MySQL/PostgreSQL) accessed via Eloquent
• Database Migrations & Seeders (database/migrations, database/seeders)
• Factories for testing (database/factories)
e. Infrastructure & Supporting Services
• Cache & Session Store (filesystem or Redis configured in config/cache.php, config/session.php)
• Queue / Jobs (database or Redis queues)
• Mail Service (SMTP or third-party via config/mail.php)
• File Storage (storage/app/public, local or S3 via config/filesystems.php)
f. Asset Pipeline
• Vite for compiling JS/CSS (vite.config.js, resources/js, resources/css)
g. CI/CD
• GitHub Actions workflows (.github/workflows/laravel.yml, test.yml)
Component Interactions and Data Flows
• Browser → HTTP Request → Web Server (Nginx/Apache) → PHP-FPM
• PHP-FPM → Laravel Kernel → Selected Middleware → Router → Controller
• Controller → Validate via Form Request → Interact with Eloquent Models → Query/Update Database
• Controller → Return Response (Blade View or JSON) → PHP-FPM → Web Server → Browser
• Events / Jobs dispatched by Controllers → Queue Backend → Worker → Business Logic → DB/Cache/Mail
• Asset Requests (CSS/JS/images) served directly from /public or via Vite dev server in development
Architectural Patterns & Principles
• MVC (Model-View-Controller) separation
• RESTful resource controllers (AuthorController, BookController, etc.)
• Layered architecture (presentation / application / domain / infrastructure)
• Dependency injection (via Service Providers)
• Single Responsibility (form requests isolate validation, helpers isolate common logic)
• Convention-over-configuration (Laravel folder conventions)