How coconerd/ibeleaf works
Based on our analysis of the full file tree and the README, this project is a full-stack e-commerce website (named “iBeleaf”) for selling plants. It uses the Laravel framework to structure its backend code (with MVC–style directories like app/Http/Controllers, app/Models, app/Providers, etc.), integrates with third‐party APIs (for example, GHN for shipping fee calculations), and incorporates a rich frontend built on Blade templates, JavaScript, CSS, and Bootstrap.
Main Components
• Client Side (Frontend): Illustrate different web clients such as the customer-facing website (pages like Home, Product Detail, Cart, Checkout, Profile) and the Admin Dashboard. Note that the frontend assets are served from the public directory (assets like CSS, JS, images) and the dynamic content is rendered through Blade views (in resources/views).
• Backend Server: Represent the Laravel application as the core engine. Within this layer, include:
– HTTP Layer: Controllers (both customer-facing and admin controllers in app/Http/Controllers) and Middleware (located under app/Http/Middleware for authentication, role checking, CSRF protection, etc.).
– Application Layer: Business logic implemented in Services (app/Services such as OrderService, ShippingService, FeedbackService, GHNService) and Service Providers (which bootstrap core dependencies).
– Domain Layer: Models (e.g., Product, Order, Cart, Voucher, User) representing the core data and business entities.
– Console/Commands: For scheduled or background tasks (e.g., GenerateProvinceData.php).
• Database: Represent a MySQL (or similar) database layer which stores user data, product catalogs, orders, vouchers, and other transactional records. Note that migrations and seeders (in database/migrations and database/seeders) clearly define the database schema.
• External Services & Integrations:
– OAuth Services: External authentication providers (Google, Facebook) for login functionality.
– Email/Notification Service: Indicate the notification layer (emails sent on order updates, claim statuses) and real-time notifications via websockets.
Relationships and Data Flow
• Within the backend, show communication:
– Controllers receive user actions and delegate processing to the appropriate Service classes.
– Service classes interact with Models, which in turn communicate with the Database.
• For admin functions (dashboard, order management, product management), separate out a distinct admin module that communicates with the same business logic but may enforce additional middleware (e.g., CheckRole).
Architectural Patterns and Design Principles
• Layered (N-tier/MVC) Architecture: Separate presentation (Blade templates, public assets) from business logic (controllers and services) and persistence (database via Eloquent models).
• Separation of Concerns: Use clear boundaries between services (order management, shipping, feedback) and controllers.
• Modular components: The file tree indicates clear modules for authentication, product catalog, order processing, voucher management, notifications, and exception handling.
• External integrations: Mark integration points to external APIs (like GHN’s shipping API and OAuth providers).
Relevant Technologies, Frameworks, & Libraries
• Backend: PHP/Laravel (and its components such as Console, Middleware, Routing, Eloquent ORM).
• Frontend: HTML, CSS, Bootstrap, JavaScript (with vendor scripts noted in the public/assets/vendors and resources/js).
• Database: MySQL (supported by migrations and the provided SQL file “plant_paradise_final.sql”).
• APIs: GHN API for shipping and OAuth2 integrations.
• Real-time: Websocket components (as mentioned in the notifications section of the README).