# Project Structure Analysis

## Overview
This project is a multi-channel e-commerce backend platform built with Laravel 10. It features a comprehensive admin panel using Laravel Nova, a robust API for frontend consumption, and modular components for key functionality.

## Key Technologies
- **Framework:** Laravel 10.x
- **Admin Panel:** Laravel Nova
- **API Documentation:** Dedoc Scramble
- **Authentication:** Laravel Sanctum
- **Media Management:** Spatie Media Library
- **Permissions:** Spatie Laravel Permission
- **Localization:** Spatie Laravel Translatable

## Directory Structure

### Core Application (`app/`)
The application logic is organized by domain and function.

#### Models (`app/Models/`)
Entities are grouped by domain:
- **Ecommerce/**: Core e-commerce entities.
  - `Product/`: Product, Brand, Category, Collection, Review, Inventory.
  - `Order/`: Order management, payments, shipping, status.
  - `Channel/`: Multi-channel support logic.
  - `Payouts/`: Vendor payout management.
- **CMS/**: Content management entities.
  - `Marketing/`: Newsletter, subscriptions.
  - `Media/`: Banners, carousels, galleries.
- **System/**: System-wide configurations.
  - `Settings/`: Currency, Location (Province, Region), Payments.
  - `Roles/`: RBAC (Roles and Permissions).
  - `VersionManagement/`: App version tracking.
- **Post/**: Specific business logic (e.g., `PostBranch`).
- **Auth/**: Authentication related models (e.g., `Verification`).

#### Modules (`app/Modules/`)
Contains standalone modules for encapsulated functionality:
- **GlobalOrder/**: Handling global order logic (Controllers, Models, Migrations, Nova Resources).

#### Http (`app/Http/`)
- **Controllers/Api/V1/**: API endpoints for the frontend/mobile app.
  - Organized by resource (Product, Order, Auth, Cart, etc.).
- **Controllers/Api/V1/Vendor/**: Dedicated endpoints for vendor operations.

#### Helpers (`app/Helpers/`)
- **Ecommerce/**: Domain-specific helper logic.
  - `Product/Filter/`: Product filtering logic.
  - `Product/Sort/`: Product sorting logic.

#### Repositories (`app/Repositories/`)
- Implements the Repository pattern to abstract data access layers.

#### Nova (`app/Nova/`)
- Configuration for Laravel Nova resources, defining the admin interface.

### Routes (`routes/`)
- `api/v1/v1-api.php`: Main public API routes (Customer facing).
- `api/v1/vendor/vendor-api.php`: Vendor specific API routes.
- `web.php`: Web routes (likely for admin panel access or fallbacks).

### Custom Components (`nova-components/`)
Custom-built Vue.js components for Laravel Nova:
- `DynamicFields`: Handling dynamic field sets.
- `InlineRelationship`: Managing related models inline.
- `InventoryHistoryItems`: Visualizing inventory changes.
- `PayoutProducts`: Managing product payouts.
- `ProductInventory`: Inventory management interface.

### Config (`config/`)
- Standard Laravel configuration files plus package-specific configs (`scramble.php`, `nova.php`, etc.).

## Database
- **Migrations:** Standard Laravel migrations.
- **Seeds:** Database seeders for initial data population.

## Architecture Patterns
- **Repository Pattern:** Used for data access abstraction.
- **Modular Monolith:** Emerging structure with `app/Modules`.
- **Domain-Driven Design (Lite):** logical grouping of models and helpers by domain (Ecommerce, CMS, System).
- **Service Providers:** heavily used for package integration and registering services (`app/Providers`).
