Directory Structure

Last updated on
21 August 2020

This page has not yet been reviewed by Understanding Drupal maintainer(s) and added to the menu.

Base-Level Directories

The following detail the directories provided with every Drupal 8 installation. Thanks to StackExchange for the original discussion.

  • /core - All files required by Drupal's out-of-the-box usage (core), except for files that have an explicit reason to be included in the base (/) directory.
  • /libraries - All third party external libraries leveraged by Drupal, such as a WYSIWYG editor. This folder is not included by core, but used with many contributed modules.
  • /modules - The directory into which all custom (created by you) and contributed (created by community) modules go.
    • Splitting this up into the sub-directories contrib and custom can make it easier to keep track of the modules. You can create subfolders for organization to match your development, storage, usage standards.
  • /profile - All contributed and custom installation profiles.
  • sites/[domain OR default]/{modules,themes} - Site specific modules and themes can be moved into these directories to avoid them showing up on every site. Identical to Drupal 7.
  • sites/[domain OR default]/files - The storage of site-specific files. This includes files uploaded by users (such as images) and site configuration (active and staged). 
  • /themes - All contributed and custom themes and subthemes. Please note that subthemes do require the base theme to be installed here as well.
    • Splitting this up into the sub-directories contrib and custom can make it easier to keep track of the themes. You can create subfolders for organization to match your development, storage, usage standards.
  • /vendor - Backend external libraries that Drupal core depends on (examples being Symfony, Twig).

Core Folder Directories

In addition, the folder structure in the /core directory has changed as well.

  • /core/assets - Various external libraries used by core (includes jQuery, underscore, modernizer, etc.).
  • /core/includes - Base-level functionality that Drupal uses through other /core folders.
  • /core/lib - Drupal core classes.
  • /core/misc - Frontend code that Drupal core depends on.
  • /core/modules - Drupal's core modules.
  • /core/profiles - Drupal's core installation profiles. These are Minimal, Standard, Testing and Testing multilingual installation profiles.
  • /core/scripts - Various command line interface (CLI) scripts, mostly used by developers.
  • /core/tests - Drupal core tests.
  • /core/themes - Drupal core themes.

Composer Build Directories 

When using composer to download and manage your Drupal project, Drupal core and base level directories will be adjacent to a vendor directory.

  • /vendor - Various external composer php packages
  • /web - parent directory for the above base-level and core directories

Help improve this page

Page status: No known problems

You can: