Package by Feature / Screaming Architecture
Package by Feature groups code by business capability instead of technical layer. The directory tree should communicate what the application does.
src/app/
├── orders/
├── billing/
├── users/
├── orchestration/
└── shared_kernel/
Complete Configuration
deply:
paths: ["."]
exclude_files:
- '.*/\.venv/.*'
- '.*/tests?/.*'
layers:
- name: orders
collectors:
- type: directory
directories: ["src/app/orders"]
- name: billing
collectors:
- type: directory
directories: ["src/app/billing"]
- name: users
collectors:
- type: directory
directories: ["src/app/users"]
- name: orchestration
collectors:
- type: directory
directories: ["src/app/orchestration"]
- name: shared_kernel
collectors:
- type: directory
directories: ["src/app/shared_kernel"]
ruleset:
orders:
disallow_layer_dependencies: [billing, users]
billing:
disallow_layer_dependencies: [orders, users]
users:
disallow_layer_dependencies: [orders, billing]
shared_kernel:
disallow_layer_dependencies: [orders, billing, users, orchestration]
Use orchestration or explicit feature APIs for legitimate collaboration. Avoid a generic shared package that becomes an unowned dependency sink. Internal layers may still exist inside a feature when its complexity requires them.
Deply can prevent direct feature imports, but it cannot determine feature ownership, cohesion, or whether an orchestration dependency is justified.
Validate
deply validate --config=deply.yaml
deply analyze --parallel --config=deply.yaml
Reference: Screaming Architecture.