Skip to main content

Drupal 8 - Directory Structure

Drupal 8 and that follow are more objected oriented and more structural.

Here are few of state-of-the-art drupal structure to order all parties files and code.

Base Level Directories

first level which also known as the Base Level directories contain the following folders:

  • /core - All files required by Drupal's out-of-the-box usage (core)
  • /libraries -  All third party external libraries leveraged by Drupal. This folder is not included by core, but used with many contributed modules.
  • /modules - The directory into which all modules go, divided into two sub folders: 
    • /custom - All modules created/customize for the current website
    • /contrib - All modules created by the community which system check if new release exist from time to time
  • /profile - All contributed and custom installation profiles
  • /sites - All files which defining the site and its services (backwards compatibility with drupal 7)
    • /default  or /domain
      • /files - The storage of site-specific files. This includes files uploaded by users (such as images) and site configuration
      • /modules
      • /themes
  • /themes - All themes installed, this folder also include two main folder groups:
    • /custom
    • /contrib
  • /vendor - Backend external libraries that Drupal core depends on

 

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 MinimalStandardTesting 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.

 

Multisite structure

on base level directories:

  • /site
    • /site1
      • /default  or /domain
        • /files
        • /modules
          • /custom
          • /contrib
        • /themes
          • /custom
          • /contrib
    • /site2
      • /default  or /domain
        • /files
        • /modules
          • /custom
          • /contrib
        • /themes
          • /custom
          • /contrib

 

 This model has the following advantages:

1. Front-end developers can make independent deployments from regular Drupal deployments.

2. Every site maintainers can make independent deployments (for example every site maintainer can have their own release dates).