How datn-2025/datn-bookbee works
Project type and purpose
• This is a monolithic, full-stack Laravel web application.
• Purpose: an e-commerce/bookstore platform with an admin panel, user storefront, order/invoice management, reviews, wishlists, vouchers, payments, and email notifications.
File structure
• Top-level “app” directory implements MVC:
– app/Http/Controllers: Admin and public web controllers
– app/Models: Eloquent ORM models (Book, Category, Order, Payment, etc.)
– app/Mail: transactional emails (UserStatusUpdated)
– app/Providers: service container bindings
• “resources/views”: Blade view templates for admin and store front end
• “routes/web.php”: HTTP routes mapping URIs → controllers
• “public/assets” & “resources/js/css”: static assets (JS, CSS) served to browser
• “database/migrations”, “factories”, “seeders”: database schema, test data
• Config files under “config/” define database, mail, cache, session, queue settings
• “storage”: file uploads, cache, logs, compiled views
• Dev tooling: artisan CLI, Vite for frontend build
README for additional insights
• Standard Laravel framework README – no custom architecture doc
• Relies on Laravel’s features: routing, DI container, Eloquent ORM, queues, broadcasting
a. Main components:
1. Client browser / User Interface
– Static assets (CSS/JS, images)
– Blade-rendered HTML
2. Web Server & PHP Application
– Nginx/Apache → public/index.php → Laravel Kernel
– HTTP middleware (auth, CSRF, session)
3. MVC Layers
– Controllers (app/Http/Controllers)
– Services / business logic (in Controllers or injected services)
– Eloquent Models (app/Models)
– Blade Views (resources/views)
4. Data Stores
– Relational database (MySQL/PostgreSQL): tables for users, books, orders, payments, etc.
– Cache (Redis or file)
– Queue backend (Redis or database)
– File storage (local S3 or public folder)
5. External Services
– Mail provider (SMTP, Mailgun, etc.)
– Payment gateway (Stripe, PayPal, etc.)
– Third-party APIs if any (e.g., shipping)
b. Relationships & interactions:
– Browser sends HTTP request → Web Server → Laravel routing → Controller
– Controller reads/writes via Eloquent → Database/Cache
– Controller dispatches jobs → Queue → Worker processes (e.g., sending email)
– Laravel Mail triggers SMTP API → external mail service
– Response rendered via Blade → HTML + static assets served back to browser
c. Architectural patterns & principles:
– MVC (Model-View-Controller)
– Layered architecture (HTTP, Application, Domain, Persistence)
– Dependency Injection (Service Providers)
– Queued jobs for async tasks (Mail, image processing)
– Configuration via environment (.env)
d. Key technologies & frameworks:
– PHP 8+, Laravel Framework
– Blade templating
– Eloquent ORM
– Vite (frontend asset bundling)
– MySQL/PostgreSQL, Redis
– Nginx/Apache
– Composer & npm/yarn
Detailed elements to capture
• HTTP middleware layer (auth, session, CSRF)
• Route dispatching to controllers
• Key controllers/modules: Admin vs Public store
• Eloquent relationships (Book→Category, Order→User, etc.) optionally in an ER inset
• Queue worker processing (jobs folder, Mail)
• Storage: public disk vs private files