Skip to content

πŸ“ Naming Conventions β€” project-tree ​

This document defines the naming conventions used to assign semantic meaning to files and folders during project-tree analysis.

These conventions support:

  • Static code analysis
  • Code navigation and documentation
  • Consistent onboarding and architecture

πŸ“š Table of Contents ​


πŸ“„ File Naming Conventions ​

File Name / SuffixSemantic MeaningRole Type
mod.tsModule entry pointModule
main.tsPrimary executable scriptExecutableEntryPoint
index.tsNode/React-style module entryModule
types.tsType and interface definitionsTypeDefinition
constants.tsGlobal constantsConstantDefinition
config.tsModule or app configurationModuleConfig
deps.tsExternal dependencies (Deno)ExternalDependencies
dev_deps.tsDev-only dependencies (Deno)DevDependencies
*.test.ts, *.spec.tsUnit or integration testTestFile
*.mock.tsMocked data / fake implementationsMockFile
controller.tsAPI / CLI / UI controller logicController
service.tsBusiness logicService
router.tsHTTP route definitionsRouter
utils.ts, helpers.tsGeneric helper functionsToolBox
setup.tsOne-time init or seed scriptSetupScript
template.tsTemplate content (non-executable)TemplateFile
.schemaJSON schema definitionSchemaFile
README.mdProject readmeProjectReadme
LICENSELegal noticeLegalNotice

πŸ“ Folder Naming Conventions ​

Folder NameSemantic MeaningRole Type
lib/Technical utilities / abstractionsTechFolder
api/Business logic (application layer)BusinessFolder
apps/, app/Executable applicationsAppsFolder
cli/Command-line interface implementationCommandLineInterfaceFolder
ext/External modules or pluginsExternalModulesFolder
tests/Manual or automated testsTestFolder
mocks/Shared mocks (test/dev)MockFolder
scenarios/Usage or test scenariosTestScenarioFolder
examples/Usage examples / code snippetsDocumentationExampleFolder
config/Project or module configurationConfigurationFolder
bin/CLI executables or toolsCommandsFolder
processes/Modular business/technical processesProcessesFolder
domains/DDD-style domain foldersDomainFoldersCollection
doc/, docs/Markdown documentation and diagramsDocumentationFolder
src/Source root if no higher-level folders are usedSourceRoot or --ignored--

ℹ️ src/ is only treated as SourceRoot when folders like apps/, lib/, domains/ are missing.


πŸ” Variants and Aliases ​

These are recognized equivalences across projects:

Alias ATreated as
utils/helpers/
domain/domains/
app/apps/
doc/docs/
mocks/__mocks__/

❗ Special Cases and Rules ​

βœ… Flat file naming ​

Files like:

txt
user.controller.ts
auth.router.ts
utils/math.ts

…are interpreted by their suffix (.controller.ts, .router.ts), not their prefix.

This allows scalable flat layouts without ambiguity.


β›” Ambiguity fallback ​

If a file or folder doesn’t match any convention, it will be treated as --untyped-- or ignored by semantic tools. Always prefer naming explicitly.


πŸ§ͺ Supported Additional Files ​

File or FolderSemantic MeaningRole Type
*.mock.tsTest or development mock fileMockFile
mocks/Directory for reusable mocksMockFolder
scenarios/End-to-end or testing scenario dataTestScenarioFolder
examples/Usage documentation by codeDocumentationExampleFolder

πŸ“Œ Example Project Tree ​

project-root/
β”œβ”€β”€ apps/
β”‚   └── web/
β”‚       β”œβ”€β”€ main.ts
β”‚       β”œβ”€β”€ web.controller.ts
β”‚       └── web.service.ts
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ constants.ts
β”‚   β”œβ”€β”€ config.ts
β”‚   └── helpers.ts
β”œβ”€β”€ domains/
β”‚   └── user/
β”‚       β”œβ”€β”€ types.ts
β”‚       └── user.service.ts
β”œβ”€β”€ tests/
β”‚   └── user.test.ts
β”œβ”€β”€ mocks/
β”‚   └── user.mock.ts
β”œβ”€β”€ examples/
β”‚   └── user.example.ts
β”œβ”€β”€ deps.ts
β”œβ”€β”€ dev_deps.ts
β”œβ”€β”€ README.md
└── LICENSE

βœ… Conclusion ​

This convention helps to:

  • Maintain consistent and predictable project trees 🧭
  • Improve tooling and semantic code analysis πŸ€–
  • Align developer expectations across repositories 🀝

Use it as a base, extend it carefully β€” and document your extensions.

PubliΓ© sous licence MIT