Search⌘ K

Organizing by Feature

Explore how organizing code by feature can improve project structure in web applications using hexagonal architecture. Understand how grouping related classes into feature packages reduces unwanted dependencies and clarifies functionality. Learn to create expressive package structures that reveal application use cases and promote clean architecture.

Let’s try to address some of the issues of the “organize by layer” approach.

Project structure

The next approach is to organize our code by feature:

buckpal
└── account
    ├── Account
    ├── AccountController
    ├── AccountRepository
    ├── AccountRepositoryImpl
    └── SendMoneyService

Explanation

In essence, we have put all the code related to accounts into the high-level package account. We ...