Layered
Layered architecture is an ordered list. Earlier layers may depend on later layers. Later layers may not depend back outward.
architecture :layered
This compiles to:
- components named
interface,application, anddomain - allowlist dependency rules in layer order
- a cycle check across the layers
The default Rails-flavored layers are:
interface: "app/controllers/**/*.rb"
application: %w[app/services/**/*.rb app/jobs/**/*.rb app/mailers/**/*.rb]
domain: "app/models/**/*.rb"
Override them when the app uses different directories:
architecture :layered, layers: {
interface: "app/controllers/**/*.rb",
application: "app/services/**/*.rb",
domain: "app/models/**/*.rb"
}