Organizing Drupal Modules

When setting up a new Drupal project it’s important to organize your code, especially when working with teams. In Drupal, most or your core code will be in the form of modules. We typically organize our modules into 3 folders:


Modules go in the sites folder

First, it’s important to put any Drupal modules that are not in core into the sites/ directory. This will make any Drupal core upgrades much easier and since you shouldn’t be modifying any Drupal core files, all your coding will be in the sites/all/ folder.

Separate contributed, custom and development modules

You’ll also notice that we separate contributed modules (those found on, custom modules (written specifically for this project), and development modules (contrib modules not used in a production enviornment).

It is highly unlikely that you will ever modify a contributed module, so keeping custom modules in their own folder makes searching for code to edit much easier. If you do make changes to a contributed module, I would suggest putting it in the custom/ folder so you know not to upgrade that module without extracting your patches.

Why a separate folder for development modules

Development modules like devel, simpletest, trace and update_status should not be used on production or staging servers. These modules are typically only used in each developers individual working copy. This being the case, we do not want to include them in our SVN repository. In SVN you can mark folder or files to be ignored by the SVN client. I used to put all development modules in the contrib/ folder and set an ignore property on each individually, then realized if I grouped them all in a single folder, I could simply ignore that one folder making SVN management much easier.