Skip to content

Directory Structure ​

Introduction ​

The default Reyhan Commerce application structure is intended to provide a great starting point for both small and large e-commerce applications. It adheres to the standard Laravel 13 directory layout while adding specialized extension points for headless commerce.


The Root Directory ​

The root of your application contains essential project files and configuration:

text
my-store/
├── app/                  # Application code, models, actions, and providers
├── bootstrap/            # Framework bootstrapper and cache files
├── config/               # Application configuration files
├── database/             # Migrations, model factories, and seeders
├── extensions/           # Modular drop-in plugins (PSR-4 auto-discovered)
├── public/               # Web server document root (index.php, assets)
├── resources/            # Views, localization files, and CSS/JS
├── routes/               # Route definitions (api.php, web.php, console.php)
├── storage/              # File uploads, session data, and logs
├── tests/                # Automated Pest 4 and PHPUnit test suites
├── vendor/               # Composer dependencies (including reyhan-commerce/core)
├── .env                  # Environment configuration file
├── artisan               # Laravel command-line interface
├── composer.json         # Application dependencies manifest
└── reyhan                # Unified Reyhan CLI orchestrator binary

The App Directory ​

The app directory contains the core code of your application:

  • Actions/: Contains single-responsibility Action classes that execute your store's business logic.
  • DTOs/ (or Data/): Contains strongly-typed Data Transfer Objects used across actions and API endpoints.
  • Filament/: Contains custom administrative resources, pages, and analytical widgets for the backoffice console.
  • Models/: Contains your Eloquent model classes (including custom models subclassed from Reyhan\Core\Models\*).
  • Pipelines/: Contains custom pipe classes for the checkout, pricing, and inventory channels.
  • Providers/: Contains the application service providers, including AppServiceProvider and Filament\AdminPanelProvider.

The Config Directory ​

The config directory contains all of your application's configuration files:

  • reyhan.php: The central configuration for model swapping registries, commercial pipelines, and store defaults.
  • payment.php: Configuration for banking gateways and transaction drivers.
  • sms.php: Configuration for SMS notification gateways and OTP fast-service patterns.
  • database.php: PostgreSQL, MySQL, Redis, and connection pools.

The Database Directory ​

The database directory contains your database migrations, model factories, and seeds:

  • migrations/: User-land migrations for adding custom columns or new tables. Core framework migrations are loaded automatically from the core package.
  • seeders/: Initial catalog seeders for provinces, cities, categories, and demo products.

The Extensions Directory ​

The extensions directory is designed for modular, self-contained packages. Extensions placed inside this directory are auto-discovered at runtime via dynamic PSR-4 autoloading:

text
extensions/
└── my-carrier-plugin/
    ├── composer.json
    ├── src/
    └── routes/

TIP

Read the Modular Extensions Guide for details on developing and distributing plugins.


The Routes Directory ​

  • api.php: Custom REST API endpoints for your application. Core commerce endpoints (/api/v1/*) are registered automatically by the core package.
  • web.php: Web routes (such as redirecting root traffic to /admin or rendering signed shipping labels).
  • console.php: Custom Artisan console commands and scheduled tasks.

The Storage Directory ​

The storage directory contains your compiled Blade templates, file-based sessions, file caches, and log files generated by the framework.


The Tests Directory ​

The tests directory contains your automated tests. Out of the box, Reyhan includes Pest 4 unit and feature test examples for commerce workflows and architecture validation.

Released under the MIT License.