What is a Domain?
A distinct area of business logic with clear boundaries, responsibilities, and well-defined interfaces for communication
Each business domain is isolated into its own module with clear boundaries, better maintainability, and independent development
A domain represents a distinct area of business logic and functionality. Each domain:
Each domain follows the standard module structure:
modules/DomainName/
├── Config/
│ └── config.php # Domain configuration
├── Database/
│ ├── Migrations/ # Domain-specific migrations
│ ├── Seeders/ # Domain data seeders
│ └── Factories/ # Model factories
├── Http/
│ ├── Controllers/ # Domain controllers
│ ├── Requests/ # Form validation
│ ├── Resources/ # API resources
│ └── Middleware/ # Domain-specific middleware
├── Models/ # Domain models
├── Events/ # Domain events
├── Listeners/ # Event listeners
├── Jobs/ # Background jobs
├── Notifications/ # Domain notifications
├── Policies/ # Authorization policies
├── Providers/
│ └── DomainServiceProvider.php # Service provider
├── Routes/
│ ├── api.php # API routes
│ └── web.php # Web routes (if needed)
├── Services/ # Business logic services
├── ValueObjects/ # Domain value objects
└── Tests/
├── Feature/ # Integration tests
└── Unit/ # Unit tests