Organize by domain subdirectory with a barrel module that imports sub-modules. Each sub-concern gets its own module. The parent module imports all sub-modules and re-exports only what external consumers need, keeping internals private.
One folder per domain feature — all related files live together.
Create nested modules when a feature has multiple distinct sub-concerns.
The parent barrel module controls the public surface via selective re-exports.
Sub-modules can be independently tested without the parent barrel module.
Avoid deep nesting beyond two levels — it adds complexity without much benefit.