How to structure your Drupal repository

  • Last updated
  • 0 minute read


Learn how to properly structure your Drupal repository according to Acquia’s best practices.

  1. The Acquia Way™ to structure your Drupal repository

    There are many ways to organize your Drupal repository. At Acquia, we have a preferred structure that will make your development efficient and your application easy to maintain (e.g., with Composer). It will also ensure that your application is fully compatible with all Acquia products.

    If you’re starting a new project, we recommend using one of our starting templates. Our best practices (e.g., Composer configuration, .gitignore values, etc.) are already baked-in.

    Otherwise, follow the guidelines listed below to ensure that your existing application is structured according to our recommendations.

  2. To be hostable on Acquia Cloud Platform

    There are a few “bare minimum” requirements for your Drupal application to function on the Acquia Cloud Platform:

    • Your Drupal root (where Drupal Core’s index.php is located) must be located in a directory named docroot.
    • Your settings.php file must include an Acquia require line

    [info block] if you’re using Acquia BLT, this is done for you automatically.

  3. To be manageable with Composer

    When Drupal 8 was released in 2015, Composer became the way to manage dependencies for your Drupal applications (or any PHP application for that matter).

    As with any framework, there are some framework-specific conventions that should be followed. Drupal is no different in that regard. In the Drupal community, we sometimes call those “Drupalisms.”

    In order to make your application easy to manage via Composer, you should follow these conventions:

  4. To be compatible with Acquia Code Studio

    Acquia Code Studio is a Drupal optimized version of GitLab hosted by Acquia. One of its most powerful features is AutoDevOps—a “Zero configuration required” CI/CD pipeline that is optimized specifically for Drupal.

    To take advantage of AutoDevOps:

    For long-time Drupal developers, this may seem like a strange convention. But, it’s a well established best practice for Composer and for software more generally.

    For a deeper discussion of this concept, see Tutorial: Deploying a Composer Managed Drupal application.

  5. Related Resources