In praise of Drupal 8’s new file structure

There is a lot of excitement in the Drupal world right now around Drupal 8 – and for good reason. There are some huge advances being made on the project – Views in Core! A new template engine! Symfony! Mobile administration! Config management! The list goes on.

However, today, I wanted to praise something that may not really get mentioned a lot, but I think will be appreciated by almost everyone who builds Drupal sites (ESPECIALLY those new to Drupal): the file structure!

Here is what it looks like currently in Drupal 7, when downloaded:

Drupal 7 Default File Structure

And here is what it looks like in Drupal 8 (as of the writing of this post):

Drupal 8 File Structure - yay!

And for the truly hardcore, you can prune the files down yourself to:

Drupal 8 File Structure - Hardcore edition

(Assuming you don’t want to keep profiles around after installation)

This isn’t to say a lot of the stuff in D7 has gone away – it’s just been neatly wrapped in the “core” directory. Guess what folder you should never mess with? “core”. That’s it. My guess is that if you need to do a Drupal core update, it will simply be a matter of replacing the /core folder, and running an update script.

Guess what else is new? If you’re building a theme for your site, where would you think it should go? How about the /themes folder! What if you need to add a module? Why, put it in the /modules folder!

This will be a semi-revolution for longtime Drupal users. In D7 and before, themes would go in sites > all > themes, and modules would go in sites > all > modules. Not the hardest concept to wrap one’s head around, but the new way is a lot more straightforward. I think someone new to Drupal will also appreciate the intuitive file structure a lot.

Long time Drupal users will then say “but what about multisite”? I don’t know for sure, but my intuition tells me that themes and modules that are placed in /themes and /modules will be available to all sites. They essentially replace sites > all. However, site-specific themes can be placed in the /sites/ directory.

Drupal folks, let’s be real: 99.9% of any work in Drupal 7 and before was done in sites > all. It only makes sense that those files would be at the root of a Drupal site.

So, I’m stoked about the new Drupal file structure. It’ll be one of many, many new things to look forward to in Drupal 8. Maybe, just maybe, another CMS out there might be able to follow Drupal’s lead:


  • This will also make it a lot easier to upgrade Drupal Core. From the sounds of this, when a new version of Drupal 8 comes out, we can download it and replace the /core directory with the new /core directory, assuming there are no changes to index.php, which would be unlikely. Updating Drupal 6 and 7 involves a bit more moving of files and directories around for a core update.

    I wonder how updating will happen, I’m seeing that update.php is no longer at the root and I’m hopeful that means that we will no longer have to manually run update.php every time we download a new module or version of core!

    • Chip Cullen

      I’d imagine update.php will probably have to be kept around somewhere, if only to facilitate making database changes. But otherwise, yes – updating core should be much, much easier!

  • John Brandenburg

    That is pretty sweet, I’m looking forward to saving that 1 step 15 million times.

    Drupal 7 is actually pretty smart when it comes to figuring out where modules are located, even if you move the directories after a module has been installed and enabled. Modules can also be installed in /profiles/myProfile. Just visit the admin module admin page, or “drush pml” if you’re into that sort of thing, and Drupal will rebuild the module registry.

  • Hayden

    “Maybe, just maybe, another CMS out there might be able to follow Drupal’s lead:”

    WordPress posted this several years ago how to completely separate the wordpress core files from the theme and plugins.

    • Chip Cullen

      The difference is that Drupal 8 will have a clean file structure out of the box. You might be able to hack WP in the manner you link to, but it’s not the default. I’ve been using WordPress for years, and didn’t know that was possible. I suspect the majority of of WP users out there are in the same boat.