Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've looked into many open source software repositories, and I've found some common elements and somethings people do in different fashion from one another.

For example, every repository has a README file, a INSTALL file, a COPYING file and stuff like that.

Other things differ:

  • Some projects, like git, have their source code in the root level, while others have the source code in a src/ folder and others, like the Linux kernel, have the source code spread in different folders in root level, that divide code by areas;
  • Some have their tests in a t/ folder, while others in a tests/ folder, or named otherwise;
  • Some have files about submitting patches and who the maintainers are, and those might be inside some Documentation/ or in the root level.

Are there recommendations? A best practice?

For example: personally, I don't like the code in the root level, git-fashion. It looks messy and confuses one trying to start as a contributor (especially because they have some code inside folders, and scripts in the root level as well, it's really messy).

If I were to start a project of my own and wanted to start right from the start, are there recommendations? Best practices? How can I make a clean and clear structure?

Thank you!

share|improve this question

Reserve your root for misc bits (so you have a place for misc related directories and files which may be valuable to store in your repository), start your source tree one level down. To accommodate a place for multiple components perhaps add a second level for your first component.

If your are using git you can always reshape later, don't worry about it too much.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.