Clean architecture
The architecture implemented in the generated application follows the Clean Architecture principles, originally described by Robert C. Martin.
It aims to reduce the dependencies between your business logic and the services you consume (API, database, framework, third-party libraries), to maintain a stable application during its evolutions, its tests but also during changes or updates from external resources.
The code is divided into layers, each having their responsibility. The lower layers should not be aware of the upper layers, in order to not be impacted when they change.
Core principles
Dependency rule
The fundamental rule of Clean Architecture is that dependencies must point inward. Inner layers should never know anything about outer layers.
Important
The Domain layer is the core of your business. It must remain independent of any external concern (database, UI, application layer). This ensures that your business logic can be tested in isolation and remains stable over time.
Benefits
| Benefit | Description |
|---|---|
| Testability | Business logic can be tested without database, UI, or external services |
| Maintainability | Changes in external systems don't affect core business logic |
| Flexibility | Easy to swap implementations (e.g., change database provider) |
| Independence | Business rules don't depend on UI, or infrastructure |
Generated application architecture
When Neos generates an application from your YAML metadata, it produces code that follows the same Clean Architecture principles as the framework itself:
Layer responsibilities
| Layer | Generated/Business Code |
|---|---|
| Domain | Entities, Entity validation rules, Entity event rules |
| Application | Entity views, Server methods, Entity view rules |
| Infrastructure | Generated repositories, Database context |
| Presentation | Generated REST API endpoints |
flowchart TB
subgraph Presentation["Presentation Layer"]
direction LR
API[REST API<br/>Controllers]
SPA[Vue.js SPA<br/>Frontend]
end
subgraph Application["Application Layer"]
direction LR
EV[Entity Views]
SM[Server Methods]
REPO_IMPL[Entity View Repository<br/>Implementations]
EVVR[Entity View<br/>Validation Rules]
EVER[Entity View<br/>Event Rules]
COMM[Inter-cluster Communication]
NOT[Notifications]
end
subgraph Domain["Domain Layer"]
direction LR
E[Entities]
EVR[Entity<br/>Validation Rules]
EER[Entity<br/>Event Rules]
REPO_INT[Repository<br/>Interfaces]
end
subgraph Infrastructure["Infrastructure Layer"]
direction LR
DB[(Database)]
EXT[External<br/>Services]
end
Presentation --> Application
Application --> Domain
Infrastructure --> Domain
style Domain fill:#e8f5e9,color:#000
style Application fill:#e3f2fd,color:#000
style Presentation fill:#fff3e0,color:#000
style Infrastructure fill:#fce4ec,color:#000
See also
- Generated solution structure - Understanding the generated .NET solution
- Domain vs Application - When to use each layer
- Business assemblies - Project structure and testing strategy
- Repositories - Data access patterns
- Dependency injection - Service registration and scopes
- Server code overview - Business code entry points
- Entity validation rules - Domain layer validation
- Entity view validation rules - Application layer validation

