04.1.6 · Skill in Software development

Code organization

Structuring a codebase so people can find and change things safely.

Code organization covers folders, modules, naming and where logic lives. A predictable structure lets new people and AI agents work in the codebase quickly. Organizing by feature often scales better than organizing by technical layer.

Your status · Code organization

Saved in this browser. Sign in to keep it on every device.It colours this skill's tile on your map.

Why it matters for a product engineer

A predictable structure lets people, and now coding agents, find the right place to change. It decides how far a change spreads, how easy the code is to test, and sometimes how the business works: which code is free and which is paid, which team owns what. Most of it is cheap to decide early and expensive to change later.

How to do it

  1. Group code by feature at the top level, and by technical layer inside each feature.
  2. Put each piece of logic in one place, and let the rest call it.
  3. Make the boundaries visible in folders and imports, so a wrong dependency stands out.
  4. Use names that match the product’s words, the same ones users and documents use.
  5. Write a short map of the codebase in the repository, for new people and for agents.
  6. Move code when the structure no longer fits. Do it in small steps, not in one big change.

Common mistakes

  • A utils folder that slowly holds everything.
  • Folders by file type only, so one feature is spread across the whole tree.
  • The same rule written in several places.
  • Structure decided once and never revisited.
  • Boundaries that exist in a diagram but not in the imports.

Example

Papermark’s open-core business is drawn in folders. Everything under ee/ and app/(ee) is under a commercial licence; the rest of the repository is AGPLv3. Inside ee/features are the features people pay for: AI, billing, permissions, security, templates and workflows. Background jobs live in lib/trigger. (Papermark in In practice)

Anatomy

Part of Papermark's repository, and what each folder means

app/(ee)/1 ee/features/ ai/ billing/ permissions/ security/ templates/ workflows/2 ee/stripe/utils.ts3 lib/trigger/4 lib/tinybird/5

  1. 1CommercialPaid pages, under the enterprise licence.
  2. 2Paid featuresWhat data room customers pay for, one folder each.
  3. 3PricesThe plan amounts, in public code.
  4. 4Background jobsPDF pages, videos, bulk downloads, notifications.
  5. 5Analytics eventsPage views per document version.

The licence line follows the folders, so anyone can see what is free and what is paid.

Observedgithub.com/mfts/papermark, 17 Nov 2026

Sources: Presentation domain data layering (Martin Fowler) ↗

In practice

Real products

Resources

1