How bdsumon4u/hotashshop works
Project Type and Purpose
• This is a full-stack Laravel-based e-commerce web application with:
• A user-facing storefront (Blade + Livewire)
• An admin dashboard (Blade templates under resources/views/admin)
• A JSON API for mobile/apps (routes/api.php + Api controllers)
• Integration with external courier service (Pathao)
• Background processing (queues, events, listeners)
Top-Level System Components
a. Web Layer
• Nginx/Apache (Dockerfile + 7.4 container) serving public/index.php
• Laravel HTTP Kernel dispatching routes:
– routes/web.php & routes/user.php → User controllers & Blade views
– routes/admin.php → Admin controllers & views
– routes/api.php → API controllers returning JSON
• Livewire components for reactive pieces (cart, product detail, etc.)
b. Application Layer
• Controllers/Livewire (app/Http/Controllers, app/Http/Livewire)
• Middleware (app/Http/Middleware)
• Domain models (Eloquent models in app/*.php)
• Repositories (app/Repositories) for data-access abstraction
• Services & Packages (app/Pathao, packages/hotash/laravel-multi-ui)
• Events & Listeners (app/Events, app/Listeners)
c. Data Layer
• MySQL/MariaDB (via config/database.php, managed in Docker Compose)
• Redis or cache store (config/cache.php)
• File storage (local S3 driver, storage/app/public)
• Search (Laravel Scout) if enabled
d. Background/Asynchronous
• Queue workers (supervisord.conf) processing jobs, events
• Scheduler (cron in Docker container invoking artisan schedule:run)
e. External Systems
• Pathao Courier APIs (app/Pathao/Apis)
• Email/SMS gateways (config/mail.php, app/Notifications)
• Third-party analytics (Google Tag Manager middleware)
Architectural Patterns & Design Principles
• MVC (Models, Views, Controllers)
• Event-Driven (app/Events → app/Listeners)
• Repository pattern for data access (app/Repositories)
• Service abstraction for external APIs (facade in app/Pathao/Facade)
• Package-based modularity (packages/hotash/laravel-multi-ui)
• Layered separation: Web → Application → Domain → Infrastructure
Relationships & Data Flows
1. User/Browser
– Requests to storefront or admin subdomain → Web server → Laravel
– Authenticated → Controller → Model → View/Livewire → Response
2. API Client
– Requests to /api/* → API controllers → JSON response
3. Order Placement
– Controller validates input → fires OrderPlaced event → Listener sends notification & dispatches Pathao job → Queue worker calls Pathao API → updates order status
4. Admin Actions
– Admin UI controllers handle CRUD (brands, products, settings) → Eloquent → DB
5. Background Jobs
– Queued jobs (exports, notifications) consumed by workers