The concept
What is a feature-based architecture?
An approach that organizes code and folders around features, the business capabilities of your product, rather than around technical layers like components, services or utils.
Horizontal vs vertical
Slice your code like your product
A layered codebase cuts the product horizontally: one feature is spread across every technical folder. A feature-based codebase cuts it vertically: each feature is one column you can see, own and measure.
To understand auth, you read four folders.
auth/
billing/
search/
To understand auth, you open one folder.
In practice
The same code, two structures
Highlighted files all belong to the “save user” feature. In a layered tree they are scattered; in a feature tree they live together, with a README that names the owner.
Why it works
Benefits of a feature-based architecture
-
Modular
Each feature lives in its own self-contained folder with everything it needs.
-
Maintainable
Changing a feature means working in one place, not across five technical folders.
-
Scalable
Complex systems are broken down into smaller parts that teams can own independently.
-
Shared language
Product managers, designers and stakeholders recognize the business features in the code.
-
Recursive
Features can contain features. Structure grows with the product, at any depth.
-
Complementary
It does not replace hexagonal or clean architecture. It organizes them around the business.
Anatomy of a feature
Everything about a feature, in its folder
Features reads each part of the folder to build its reports. Nothing to configure: the conventions are the configuration.
- README.md
- The first line after the title becomes the description. The
ownerfront matter property sets the team. - __docs__/decisions/
- Architecture decision records in the MADR format, listed with the feature.
- source files
- Lines of code, files, git history, coverage and TODOs are all computed per feature.
- features/
- A nested
featuresfolder holds sub-features, with ownership inherited from the parent.
Good to know
Feature-based architecture is not feature-based design
Close to DDD, more structured
It is similar to domain-driven design, but more recursive and more structured. It is also easier to understand for beginners, which makes it a good default for growing teams.
Map your own features
No configuration, no account. Point the CLI at a folder and open the dashboard.
$ npx features-cli@latest serve ./src