-
Notifications
You must be signed in to change notification settings - Fork 0
Project Structure
Folder and file structure options with naming conventions when creating software projects
- Clear feature ownership
- Module usage predictability (refactoring, maintenance, you know what's shared, what's not, prevents accidental regressions, avoids huge directories of not-actually-reusable modules, etc) CI runs only the tests that matter (future)
- Code splitting (future)
.
├── build # Compiled files (alternatively `dist`)
├── docs # Documentation files (alternatively `doc`)
├── src # Source files (alternatively `lib` or `app`)
├── test # Automated tests (alternatively `spec` or `tests`)
├── tools # Tools and utilities
├── LICENSE
└── README.md
Use short lowercase names at least for the top-level files and folders except
LICENSE
,README.md
The actual source files of a software project are usually stored inside the
src
folder. Alternatively, you can put them into the lib
(if you're
developing a library), or into the app
folder (if your application's source
files are not supposed to be compiled).
Samples: jQuery
src
, Node.jslib
andsrc
, D3.jssrc
, AngularJSsrc
, Adobe Bracketssrc
, three.jssrc
, Expresslib
, Socket.IOlib
, Less.jslib
, Redissrc
, Acelib
, Semantic UIsrc
, Zepto.jssrc
, Emscriptensrc
, RethinkDBsrc
, Bitcoinsrc
, MongoDBsrc
, Facebook Reactsrc
, Rustsrc
, ASP.NETsrc
, SignalRsrc
, libgit2src
Automated tests are usually placed into the test
or, less commonly, into the spec
or tests
folder.
Q: Why tests are placed into a separate folder, as opposed to having them closer to the code under test?
A: Because you don't want to test the code, you want to test the program.
.
├── ...
├── test # Test files (alternatively `spec` or `tests`)
│ ├── benchmarks # Load and stress tests
│ ├── integration # End-to-end, integration tests (alternatively `e2e`)
│ └── unit # Unit tests
└── ...
Samples: jQuery, Node.js, D3.js, AngularJS, Adobe Brackets, three.js, Express, Socket.IO, Less.js, Bower, Mozilla PDF.js, Grunt, Gulp, Semantic UI, Zepto.js, Jade, RethinkDB, Vagrant, Sails.js, GitHub Hubot, Facebook React, Ansible, ASP.NET, browserify, Paper.js, Julia, Karma
Often it is beneficial to include some reference data into the project, such as
Rich Text Format (RTF) documentation, which is usually stored into the docs
or, less commonly, into the doc
folder.
.
├── ...
├── docs # Documentation files (alternatively `doc`)
│ ├── TOC.md # Table of contents
│ ├── faq.md # Frequently asked questions
│ ├── misc.md # Miscellaneous information
│ ├── usage.md # Getting started guide
│ └── ... # etc.
└── ...
Samples: HTML5 Boilerplate
doc
, Backbonedocs
, three.jsdocs
, GitLabdoc
, Underscore.jsdocs
, Discoursedocs
, Gruntdocs
, Emscriptendocs
, RethinkDBdocs
, RequireJSdocs
, GitHub Hubotdocs
, Twitter Flightdoc
, Video.jsdocs
, Bitcoindoc
, MongoDBdocs
, Facebook Reactdocs
, libgit2docs
, Stylusdocs
, Gulpdocs
, Brunchdocs
...
...
...
...
Kriasoft, Konstantin Tarkus, Joshua Mabina, aaaxx, et al., Folder Structure Conventions, Nov 2016, Folder-Structure-Conventions, GitHub repository, https://github.com/kriasoft/Folder-Structure-Conventions, commit 3ee91d1319818f731dcc15f1318b5bbe80283c15
Ryan Florence, et al. Folder Structure, Feb 6, 2015, GitHub Gist, https://gist.github.com/ryanflorence/daafb1e3cb8ad740b346#file-folder-structure-md, commit 0f27176c59046d534476353679ffcb248bbac4c1
TechEmpower, Nate Brady, et al., Codebase File Structure, Mar 2019, FrameworkBenchmarks, GitHub repository wiki, https://github.com/TechEmpower/FrameworkBenchmarks/wiki/Codebase-File-Structure, commit c48f1ee
Julian Builes, et al., My iOS Project File Structure, Nov 2017, file-structure, GitHub repository, https://github.com/jlnbuiles/file-structure, commit 67f5380a04132440ee714c8ff35ed979cf03d02e
Paŭlo Ebermann, Alan Haggai Alavi, Peter Coulton, et al., How should I structure the files/directories in my Git repository?, Nov 2010, Stack Overflow, https://stackoverflow.com/questions/4172516/how-should-i-structure-the-files-directories-in-my-git-repository
project conventions, folder structure, file structure, folder directories, repository structure, project structure, project architecture