How lqtuan123/lms works
Project Type & Purpose
• This is a monolithic, full-stack Laravel web application with two main “faces”:
• A public-facing frontend (Blade templates + rich JS/CSS asset bundles)
• An administrative backend (“backend” controllers + assets)
• It exposes a JSON REST API (/routes/api.php) for mobile or third-party clients, and supports CLI automation via Artisan commands (app/Console/Commands).
• It is organized into domain-specific modules (app/Modules/Blog, Book, Group, Teaching_1, Teaching_2, Teaching_3, Exercise, Resource, Tuongtac, etc.) each implementing an internal MVC (Controllers, Models, Views, Routes, Migrations, Services).
File Structure & Architectural Patterns
• Top-level:
• app/Http (HTTP controllers & middleware)
• app/Models (Eloquent models)
• app/Modules (self-contained feature folders with their own MVC + routes + migrations + views)
• app/Services & app/Helpers (domain services, utility classes)
• resources/views (global views—frontend & backend)
• public/backend & public/frontend (compiled CSS/JS/images for each UI)
• Uses Laravel’s MVC pattern and Service Provider system (app/Providers/ModuleServiceProvider auto-registers modules).
• Configuration (config/*), database migrations (database/migrations & each module’s Migrations), and seeders.
a. Clients (Web Browser public + Web Browser admin + Mobile/API Consumer)
b. HTTP Layer (Nginx/Apache → index.php → Laravel kernel → Middleware → Route dispatcher)
c. Controllers
• Frontend Controllers (app/Http/Controllers/frontend + resources/views)
• Backend Controllers (app/Http/Controllers/Admin + resources/views/backend)
• API Controllers (app/Http/Controllers/Api)
d. Domain Modules (each module folder under app/Modules)
• Inside each: MVC triad + module-specific routes
e. Services & Helpers (e.g. PointService, RatingService, SocialService)
f. Data Layer
• Eloquent Models (app/Models & app/Modules/*/Models)
• Database (MySQL/Postgres)
• Cache (Redis/Memcached)
• Filesystem (local or S3 via config/filesystems)
g. Infrastructure
• OAuth2 Passport (config/passport.php + oauth_* tables)
• Mail (app/Mail + external SMTP)
• Queue / Jobs (config/queue.php)
• Scheduler (app/Console/Commands + cron)
Interactions & Data Flows
• Clients → HTTP Server → Laravel Pipeline → Appropriate Controller
• Controllers → Services/Domain Logic → Eloquent Models → Database
• Controllers → Views → Clients (HTML) or JSON (API)
• Controllers/Services → Mailer/Queue/External APIs → Responses
• Artisan Commands → Services → Models → DB (offline workflows)
• Modules communicate only through services or shared models, enforcing separation.
Architectural Patterns & Principles
• Modular Monolith: self-contained modules with internal MVC, auto-discovered via ModuleServiceProvider.
• Dependency Injection via Laravel’s Service Container.
• MVC at both global and per-module levels.
• RESTful API design for /api.
• Separation of concerns: Views, Controllers, Models, Services.