Drupal Recipes: A Smarter Way to Assemble Site Features

4 months ago
DrupalRecipe
Drupal Recipes let you assemble site features quickly, predictably, and without the usual configuration grind, offering a cleaner and more efficient way to build.
Drupal Recipes Explained Graphic

Anyone who has worked with Drupal knows the usual flow. Install a handful of modules, adjust their settings, configure content types, fix permissions, tweak displays, and then realize you have spent half the day trying to recreate something you built last month. It is efficient only in the sense that you get a lot of practice.

Drupal Recipes aim to streamline all of that. Instead of manually recreating features or maintaining a fragile installation profile, you can apply predictable, reusable configuration bundles at any point in a project. Recipes sit neatly between “let me build everything by hand” and “give me a full distribution whether I need all of it or not.”


What Is a Drupal Recipe?

A Recipe is a set of clear instructions that describe how to configure a specific feature in Drupal. It installs modules, imports configuration, updates existing settings, provides content when needed, and then steps aside once the setup is complete. The configuration becomes part of your site with no ongoing dependency on the Recipe itself.

A Recipe consists of:

  • A required recipe.yml file
  • Optional configuration files
  • Optional default content
  • Optional Composer metadata for discoverability

Think of it as a portable definition of a feature that you can apply repeatedly without the usual manual effort.


Why Recipes Matter

1. No Permanent Installation Profiles

Legacy installation profiles lock you in from the moment you pick one. Recipes, on the other hand, can be applied at any point in the lifecycle of a project. Start minimal, stay flexible, and apply features only when you need them.

2. Modular and Composable

Need an Event content type? Apply a Recipe.
Need an editorial workflow? Apply another.
Need several features at once? Combine them.
Recipes let you build your site as a collection of discrete, predictable components.

3. No Hidden Logic

Recipes cannot ship PHP or custom logic. That limitation keeps them clean and prevents the unexpected behavior that often comes with custom-coded distributions.

4. Easy to Reuse

Because Recipes can depend on other Recipes, you can create reliable building blocks and bundle them into larger starter kits. They can be versioned, shared, and used across multiple projects.


How Recipes Work Internally

Drupal now includes APIs to support the full lifecycle of applying a Recipe. These handle:

  • Module or theme installation
  • Simple configuration import
  • Selective configuration import from modules
  • Targeted updates to the existing configuration using actions
  • YAML-based content creation
  • Configuration checkpoints to allow safe rollback

Each of these steps ensures that Recipes apply cleanly and predictably.


What Recipes Can Do

  • Install modules and themes
  • Import configuration from modules or the recipe folder
  • Apply configuration updates to existing entities
  • Create optional demo content
  • Compose other Recipes to build larger features

What Recipes Cannot Do

  • Provide PHP code, services, or custom logic
  • Include custom plugins or forms
  • Act as a deployment mechanism
  • Offer an upgrade path once applied

If your feature requires custom code, that code belongs in a module, and the Recipe should install the module and handle configuration.


Applying a Recipe

Once a Recipe is available in your project's recipes directory, you can apply it with:

drush recipe ../recipes/my_recipe

Rebuild the cache after running it, and the configuration changes should appear immediately.


Distributing Recipes

A Recipe can include a composer.json file, making it publishable like any other Composer package. With the correct installer configuration, Composer places these packages into your recipes directory automatically.

This makes it simple to maintain a shared library of Recipes across projects or teams.


Practical Use Cases

  • Add new content types with fields, displays, permissions, and example content
  • Create starter kits that represent your organization’s preferred Drupal setup
  • Apply SEO settings consistently across the site
  • Enable editorial workflows with minimal effort
  • Spin up demo sites quickly for training or previews

Recipes excel when you need repeatable, standardized site features without the overhead of a full distribution.


A More Efficient Future for Site Building

Drupal has always been powerful, but often required a significant time investment to configure even common features. Recipes bring a more systematic approach to site assembly. They make Drupal more accessible for new builders and more efficient for seasoned developers, all without compromising flexibility.

Related Content