𝗧𝗵𝗿𝗲𝗲 𝗧𝗶𝗲𝗿 𝗙𝗼𝗹𝗱𝗲𝗿 𝗦𝘁𝗿𝘂𝗰𝘁𝘂𝗿𝗲𝘀

Most codebases have a utils folder. It becomes a dumping ground. You find date formatters next to user permissions. This is not organization.

Use Three Tier Hoisting. Use three folders. Use one test to decide where code goes.

The Tiers:

The Tests:

The Rule of Three: Start local. Duplicate it twice. Move it up on the third use. This stops early abstraction.

The Import Flow:

Enforce this with ESLint. Build errors stop wrong imports. You stop arguing in code reviews.

New hires find files fast. The utils mess disappears.

Source: https://dev.to/adam_lewis_427616cbc93f0b/a-three-tier-folder-structure-for-long-lived-codebases-3a3l