Module Structure Standard
Module Structure Standard
Section titled “Module Structure Standard”Purpose
Section titled “Purpose”Define a predictable, scalable structure for feature modules in src/modules.
Applies to all module folders under src/modules/*.
Relationship to Component Standard
Section titled “Relationship to Component Standard”Modules are composed of components and must follow the Component Structure Standard.
Required Conventions
Section titled “Required Conventions”1) One module, one root folder
Section titled “1) One module, one root folder”Each module must be isolated in its own folder:
src/modules/YourModule/2) Clear module entry point
Section titled “2) Clear module entry point”Use one of the following entry patterns:
Pattern A (preferred when exporting additional symbols):
src/modules/YourModule/ module.tsx index.tsPattern B (simple modules):
src/modules/YourModule/ index.tsx3) Recommended internal layout
Section titled “3) Recommended internal layout”src/modules/YourModule/ components/ hooks/ context/ data/ utils/ styles/ types/ index.tsx | module.tsx + index.tsNot every folder is required. Add only what the module needs.
4) Dependency boundaries
Section titled “4) Dependency boundaries”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.
Architectural Rules
Section titled “Architectural Rules”- 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.
Anti-Patterns
Section titled “Anti-Patterns”- Cross-module deep imports (
../OtherModule/components/X). - Multiple competing entry points for one module.
- Module-global styles leaking into unrelated modules.
PR Review Checklist
Section titled “PR Review Checklist”- 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.