Skip to content

Overview & Architecture Philosophy ​

Reyhan Commerce is a sovereign, enterprise-grade, headless e-commerce backend framework designed to power high-performance, maintainable, and infinitely extensible online stores on Laravel 13.

Unlike monolithic shopping carts or generic starter templates, Reyhan enforces an unyielding Core vs. User-Land Boundary. This architectural principle guarantees that developers can customize every aspect of their storeβ€”models, business logic, payment drivers, and administrative workflowsβ€”without altering core framework files, enabling seamless central updates via standard Composer commands.


πŸ›οΈ Core Pillars of Reyhan ​

1. The Action & DTO Domain Standard ​

Business operations in Reyhan are never scattered across fat controllers or tangled model callbacks. Every single commercial operation (e.g., checkout order creation, voucher validation, inventory allocation) is encapsulated in a dedicated final Action class with a strict execute() method and strongly-typed Data Transfer Objects (DTOs). Heavy, unidiomatic Repository patterns are strictly prohibited in favor of native, high-performance Eloquent features.

2. Zero Core Modification (Upgrade Safety) ​

In Reyhan, the core codebase is installed as an immutable Composer library (reyhan-commerce/core). You never edit vendor files. Customizations are achieved via:

  • Dynamic Model Swapping: Reyhan\Core\Support\Reyhan::useModel('product', CustomProduct::class)
  • Modular Extensions: The extensions/ directory with automatic module.json discovery
  • Pipeline Filters: Hooking into commercial cart and checkout calculation pipelines

3. Bring Your Own Database (BYOD) ​

Reyhan does not bundle or force a database server installation. Instead, it relies on enterprise infrastructure: PostgreSQL 17+ (leveraging native JSONB, GIN indices, and pg_trgm fuzzy text matching) and Redis 7+ (for sub-millisecond cart caching, distributed sessions, and worker queues). Connections are managed cleanly via environment variables.

4. Central Orchestrator CLI (./reyhan & reyhan-commerce/installer) ​

The framework ships with an executable orchestrator in the project root that automates development workflows, dependency health diagnostics (doctor), database migrations, zero-downtime updates, and local server synchronization.


πŸ› οΈ Technology Stack & Architectural Foundation ​

DomainTechnology / EngineArchitectural Role & Implementation Details
Backend EnginePHP 8.4+ & Laravel 13Single-responsibility final Action classes, strongly-typed DTOs (spatie/laravel-data), native Eloquent entities, and queue workers.
Admin BackofficeFilament 5 & Livewire 3High-productivity Persian/English admin console, RBAC permissions (filament-shield), and websocket real-time updates.
Storefront LayerDecoupled (Nuxt 4 Storefront β€” Coming Soon)Headless REST APIs (/api/v1) & OpenAPI contracts. Official Nuxt 4 storefront is in active development.
Primary DatabasePostgreSQL 17+Enterprise JSONB variant matrices, GIN indexing, pg_trgm fuzzy text matching, and pessimistic database row-locking (lockForUpdate).
Memory & Mutex EngineRedis 7+Sub-millisecond cart caching, distributed sessions, Horizon queues, and self-purging ZSET stock reservation mutexes.
High-Performance RuntimeFrankenPHP Octane & CaddyWorker-mode execution for microsecond response times and automated SSL certificate management.
Testing & Quality AssurancePest 4End-to-end domain feature testing, concurrency assertions, and automated API testing.

πŸš€ Architectural Feature Matrix ​

DomainArchitectural ImplementationKey Benefit
AuthenticationComplete isolation: OTP SMS for customers, Session/Shield for StaffEnhanced security, zero-friction customer onboarding
Inventory ConcurrencyAtomic database transactions with pessimistic & Redis lockingElimination of overselling during high-traffic flash sales
Payment SubsystemDriver-based unified payment gateway managerSeamless switching between banking gateways
Notification EngineMulti-driver transactional SMS engine with pattern templatesReliable, instant OTP and order status alerts
Text NormalizationAutomated pipeline for character and digit standardizationClean search indexing and consistent Persian/Arabic data
Double-Entry LedgerStrictly balanced debit and credit ledger serviceAbsolute financial integrity for wallets, refunds, and payments

Next Steps ​

To install your first Reyhan Commerce store, proceed to the Installation Guide.

Released under the MIT License.