Tutorial: Create a New Module
Audience: Product engineer
Time: ~60 minutes
Prerequisites: ENGINEERING/ddd-rules.md, ENGINEERING/onboarding.md
Last updated: 2026-07-05
Outcome
A new bounded context module registered in the product with architecture-test compliance.
Steps
1. Create folder structure
app/Modules/YourModule/
├── Domain/
├── Application/
├── Infrastructure/
├── Http/
├── Providers/
├── Database/
└── Tests/2. Register ServiceProvider
Add to bootstrap/providers.php in dependency order.
3. Define public surface
- Application Actions for writes
- Optional
*Contractinterface if cross-module access needed - Domain events for async integration
4. Add architecture tests
Verify no forbidden cross-module Infrastructure imports.
5. Document
Copy module-template.md to docs/MODULES/{product}/your-module.md.
Verify
bash
php artisan test --testsuite=ArchitectureRelated
Breadcrumbs: Home → Tutorials → Create Module