Skip to the main content

Starting a New Drupal Project

My favorite characteristic of Drupal as a CMS is its one-two punch of flexibility & extensibility. You can make Drupal do just about anything you want, and for many purposes, you might not even need to touch code. While the options available are effectively infinite, there are a few things I do every single time I start a new project.

Start with a standard environment

At Midnet, we are working primarily in Drupal 8 now. We still do maintenance on Drupal 7, 6, and even 5 sites, but new projects are almost exclusively in Drupal 8 now. To allow our entire development team to jump in and bang around on a project there are a few standards we’ve built upon.

  1. We’re all developing on Mac OSX. That’s how we do it, but nothing about our stack is exclusive to OSX. With little effort you could work on one of these projects on Windows or Linux as well.
  2. We’re using Docker and DDEV to manage our virtual server environments.
  3. We’re using a self-hosted Gitlab instance and assorted git clients for version control.

Create & manage the project files with Composer

Drupal now recommends managing projects with composer, and while it’s a bit of an adjustment to get rolling at first I wouldn’t go back at this point. It’s just so easy to add/remove/patch a module from the command line.

composer create-project drupal-composer/drupal-project:8.x-dev PROJECT-NAME --stability dev --no-interaction

composer require drupal/module_name

If you’d like a GUI approach to help you get comfortable with the composer steps, you can use the codepen I built when I was getting started.

Manage the site configuration with Drush

Again, the first time you start jumping into the command line things can be pretty intimidating, but with a few basic Drush commands you can:

Drush is there to make the tedious, repetitive tasks go quicker so you can get to the custom stuff faster. If you started your project with composer Drush should be bundled in and you can access it from the project root via vendor/bin/drush command

You can also install the Drush Launcher on your system to make the command just drush command

Modules to make life easier

Most of the developers I know have a set of go-to modules they install from the beginning of every project. These modules just become a part of your workflow and when you end up working on a project without them you feel like the new junior dev again. They just become that automatic that you treat them like a core module. Here are the modules/projects I use every single project:

Themes

Administration & Development

Configuration

Content & Layout

By default, Drupal’s menu items include a title field and a link. This module expands that to allow you to set up attributes for your menu links and their wrappers. By writing a little bit of YAML, you can create drop-downs, text fields, and other form elements to allow your end-users to pick the exact attribute combinations they want.

Misc