Drupal Recipes

Drupal Recipes provide a way to package and share reusable features across Drupal sites. They feature prominently in Drupal CMS and are quickly being adopted as a powerful way to increase efficiency and consistency in Drupal site builds.

Recipes are authored primarily in YAML and consist of ready-to-use configuration, along with configuration actions. In this series, we’ll explore what Recipes are, the problems they solve, how to apply existing Recipes, how to author custom Recipes, and more. We’ll walk through discovering and using configuration actions, as well as how module developers can define new custom configuration actions when necessary. We’ll also cover common approaches to exporting existing configuration into a Recipe, and workflows for deploying and applying Recipes.

This series includes content for site builders who want to download and use existing Recipes, as well as developers who want to define reusable features to speed up and standardize future site builds.

Tutorials in this course
More information

Drupal recipes provide a new way to package and share reusable features across Drupal sites. Unlike traditional install profiles or distributions, recipes are applied once to add functionality and then step out of the way, leaving you with a standard Drupal site that you can customize freely.

In this tutorial, we will:

  • Understand what Drupal recipes are and how they differ from install profiles and distributions
  • Learn the four core properties that make recipes powerful: applied (not installed), shareable, non-locking, and composable
  • Explore real-world scenarios where recipes solve common platform and agency challenges

By the end of this tutorial you'll be able to explain what Drupal recipes are, identify features in your projects that are good candidates for recipes, and articulate the value of recipes to stakeholders.

More information

The Configuration Actions API is a powerful feature of Drupal recipes that allows you to modify existing configuration without replacing it entirely. While configuration exports let you add new configuration, config actions let you update what's already there—like granting permissions to an existing role or adjusting display settings. Effectively, config actions are a way for a recipe to declare a PHP method to run on a configuration object during recipe application and any arguments that method needs to run.

In this tutorial, we will:

  • Understand what config actions are
  • Learn how to read and write config actions in a recipe's YAML file
  • Explore common patterns like granting permissions and modifying displays
  • Understand the difference between generic and type-specific actions

By the end of this tutorial, you'll be able to read config actions in recipes, understand when to use them versus configuration exports, and recognize common config action patterns.

More information

Recipes transform your Drupal site by adding features and configuration. After downloading (or authoring) a recipe it needs to be applied to your Drupal project. This is analogous to following the step-by-step instructions in a recipe to make a dish. Only, we're not performing the steps on our own, but instead we're using Drupal's tools to apply the recipe. Applying the recipe adds its features to your Drupal project. This requires establishing safe workflows to apply recipes, verify their effects, and roll back changes if needed.

In this tutorial, we will:

  • Apply a recipe in a non-production environment using a feature branch workflow.
  • Review configuration changes using Git and verify functionality in the UI.
  • Understand how to roll back recipe changes if needed.
  • Learn safe workflows for both developers and non-developers.

By the end of this tutorial, you'll be able to safely apply recipes to your projects, review their impact, and decide whether to keep or roll back the changes.

More information

Creating your own recipes lets you package and reuse features across your projects. By building a simple SEO-focused recipe from scratch, you'll learn what goes into a recipe, how to declare dependencies, and how to test your work.

In this tutorial, we will:

  • Understand what belongs in a recipe versus what belongs in modules
  • Create a recipe structure with proper metadata and dependencies
  • Export and package configuration into a recipe
  • Test the recipe by applying it to a second site

By the end of this tutorial, you'll be able to create your own recipes, package them properly with dependencies, and apply them to other Drupal sites.

More information

The Configuration Actions API lets recipes modify existing configuration rather than just adding new configuration. By extending the SEO Article recipe created in a previous tutorial with config actions, you'll learn how to manipulate existing configuration objects in order to do things like grant permissions and modify entity display modes. This is necessary because sometimes a recipe needs to modify configuration that already exists on the site, not just add new configuration.

In this tutorial, we will:

  • Add config actions to grant permissions to existing roles
  • Modify entity displays using config actions
  • Reapply recipes and observe idempotent behavior
  • Experiment with new content types to understand recipe limitations

By the end of this tutorial, you'll be able to use common config actions in your recipes and understand how recipes behave when reapplied.

More information

The built-in config actions in Drupal core cover most common scenarios. But sometimes you need custom operations specific to your feature or the configuration your module relies on. You can create custom config actions by defining them as plugins or by adding PHP attributes to a configuration entity class's methods. Let's implement a custom config action to toggle an SEO strict mode setting to learn how to extend recipes with domain-specific configuration operations and make them reusable across your projects.

In this tutorial, we will:

  • Identify scenarios where custom config actions are warranted.
  • Understand the two implementation patterns: plugins and attributed methods.
  • Implement a custom config action in a module.

By the end of this tutorial, you'll be able to implement custom config actions that extend the configuration API provided to your recipes, making platform-specific operations reusable and declarative.

This course appears in the following guides:
Site Building
Site building is the core Drupal competency for site creation.

Build Drupal Sites

Site Administration
Learn how to manage configuration, search, content workflows, performance, and more.

Drupal Site Administration