Skip to content

Module Structure Standard

Define a predictable, scalable structure for feature modules in src/modules.

Applies to all module folders under src/modules/*.

Modules are composed of components and must follow the Component Structure Standard.

Each module must be isolated in its own folder:

src/modules/YourModule/

Use one of the following entry patterns:

Pattern A (preferred when exporting additional symbols):

src/modules/YourModule/
module.tsx
index.ts

Pattern B (simple modules):

src/modules/YourModule/
index.tsx
src/modules/YourModule/
components/
hooks/
context/
data/
utils/
styles/
types/
index.tsx | module.tsx + index.ts

Not every folder is required. Add only what the module needs.

Modules may depend on:

  • shared primitives (src/components, src/context, src/utils, src/services)
  • other modules only through their public module entry points

Avoid importing internal files from another module.

  • Keep module-specific logic inside the module unless multiple modules need it.
  • Keep module route/state behavior documented in the module doc page.
  • Avoid spreading module domain logic into shared UI components.
  • Cross-module deep imports (../OtherModule/components/X).
  • Multiple competing entry points for one module.
  • Module-global styles leaking into unrelated modules.
  • Module has one clear entry point.
  • Internal structure is coherent and minimal.
  • Cross-module imports use public entries only.
  • New behavior is reflected in docs/modules/<module>.md.