Skip to content

Domain-Driven ArchitectureModular monolith design

Each business domain is isolated into its own module with clear boundaries, better maintainability, and independent development

What is a Domain?

A domain represents a distinct area of business logic and functionality. Each domain:

  • Has clear boundaries and responsibilities
  • Contains all code related to that business capability
  • Communicates with other domains through well-defined interfaces
  • Can be developed, tested, and deployed independently (within the monolith)

Domain Module Structure

Each domain follows the standard module structure:

bash
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

Next Steps

Wedissimo API Documentation