Drupal 8 File Structure

Course: 

Course-Topic: 

Description: 

In this topic, we will learn about Drupal 8 File strucutre. This file structure defines the codebase of Drupal 8.
We will see how it is different from Drupal 7 and will take some insights about the way Drupal manages core, contributed & custom modules. themes. libraries & other files.

When you download and extract a Drupal 8 project, you will see following file structure:

Drupal 8 root directory
|_ Core: All the core modules, assets, themes, libraries that require to install and run Drupal. This directory is very important. Never alter any file(s) in this directory nor ever delete any of them
|
|_ Modules: This is where you install/copy contributed modules and create your custom modules
|
|_ Profiles: If you created a custom Drupal profile, it resides in this directory. Do not copy your custom Drupal installation profile to core -> profiles.
|
|_ Sites: In this directory, you can host the public files under default -> files. You can also configure multi sites by following instructions as listed in example.sites.php
|
|_ Themes: This is your contributed and custom theme directory where you can create your own custom theme or download and use any of those contributed themes available on drupal.org
|
|_ Vendor: This is a new directory in Drupal 8. This directory has libraries and codes that helps different features of the Drupal to work. Do not remove this directory.
|
|_ autoload.php: This file includes auto loader for composer, which in turn auto loads different dependencies which are required by Drupal 8 to initiate.
|
|_ Composer.json: This file lists different projects, their dependencies, paths, path to autoloader and repositories to fetch libraries/dependencies to fetch from
|
|_ Composer.lock: A lock to known state of dependencies. When you try to install a new module, library or theme and if it fails, this is the file composer.json will refer to revert back to a last working state. This is for dependencies only.
|
|_ web.config: This files lists some security rules and platform specific rules in XML form