Feature-first
One notes folder holds domain, application, infrastructure, and presentation. The composition root stays shared.
Feature-first puts the whole notes use case in one folder. features/notes/domain, application, infra, and presentation sit together. A small shared/ kernel holds ValidationFailure. app/ is still the only wiring site.
Open features/notes/ and you can read save-a-note without jumping to four top-level directories. The dependency rule is unchanged: features/notes/domain imports nothing from the other three, even though they are siblings.
The tree
lib/src/features/notes/domain/note.dart
lib/src/features/notes/application/save_note_use_case.dart
lib/src/features/notes/infra/note_repository_impl.dart
lib/src/features/notes/presentation/notes_endpoint.dart
lib/src/features/notes/presentation/wire_mappers.dart
lib/src/shared/validation_failure.dart
lib/src/app/use_cases.dart
lib/src/bootstrap/talaria_monitoring.dartThe package is examples/serverpod/feature_first. From that directory, dart test runs the domain test, the use-case test with a fake repository, and one integration test through the endpoint.
Read this track
- Pros and cons
- When to use it
- Domain
- Application
- Infrastructure
- Presentation
- Composition root
- Tests
- Talaria
Compare this tree with layer-first and hybrid. The chooser is the table of where a file sits.