Recipes

A Drupal recipe is a one-time set of setup instructions that adds a ready-made feature, such as an editor role or a media type, to a Drupal site.

Impara DrupalGlossario Drupal Last updated

A recipe is a folder with a recipe.yml file that tells Drupal what to set up. Applying it installs modules and themes, imports configuration, runs configuration actions such as granting a permission, and can create default content. The same recipe gives the same result on every site that applies it.

How recipes work in Drupal 11

The Recipe class in core validates the file. Only name is required. The other keys are description, type, recipes, install, input, config, content and extra. The recipes key lists other recipes that are applied first, which is how large recipes are assembled from small ones. Under config, import lists configuration to import, and actions runs config actions. Core ships recipes in core/recipes, among them administrator_role, content_editor_role and standard.

The apply command makes a configuration checkpoint before it starts, named "Backup before the 'recipe name' recipe", and rolls configuration back to it if a step throws an error. In the 11.4.10 code, config.strict defaults to true: if a configuration item already exists and differs from the recipe's version, applying stops with a "pre-existing config" exception.

To use a contributed recipe, add it with Composer. Its package type is drupal-recipe. The drupal.org guide says to add drupal/core-recipe-unpack and an installer path so recipes land in a recipes folder, and that projects started on Drupal 11.2 or later already have this.

Drush 13 and later apply recipes with recipe:apply (alias recipe), which runs the recipe command that ships with core. The guide also names php core/scripts/drupal recipe; Drupal 11.4.0 deprecates that script in favor of core/scripts/dr, according to change record 3584928.

Example

This small recipe lengthens the default summary of text fields. It follows the structure of the example recipe in core.

name: 'Summary length'
        description: 'Sets a longer default summary for text fields.'
        type: 'Content'
        install:
          - node
          - text
        config:
          actions:
            text.settings:
              simpleConfigUpdate:
                default_summary_length: 700
        

Save it as recipes/summary-length/recipe.yml, change into the web root and run drush recipe ../recipes/summary-length -v. The -v option lists the modules, themes, content and recipes it added.

Common mistakes

  • Testing on the live site. One run can install modules, change configuration and create content. Apply the recipe on a copy of the site first.
  • Fighting the strict check. If a recipe stops because your site already has different configuration under the same name, the cause is the strict comparison. Change your site or the recipe; do not expect an overwrite.
  • Expecting updates. The Drupal CMS 2.0.0 release notes state that recipes have no update paths. A new version of a recipe does not change a site that already applied the old one.

For marketing and content teams

When a developer says a feature "is a recipe", it is a bundle of settings that goes in once. Drupal CMS packages its site templates as recipes. The Project Browser can list the recipes already in the codebase next to modules. Before a recipe is applied, ask your developer for the list of modules it installs and the content it creates.

Sources

Questions about Recipes

A module adds code and stays installed. A recipe is a set of instructions that you apply once: it can install modules and themes, import configuration and create content, then it is done. The drupal.org guide says recipes are applied to a site, not installed or uninstalled like modules and themes.

From the web root, run drush recipe ../recipes/name with Drush 13 or later, where the path points to the recipe folder. Drush lists the command as recipe:apply with the alias recipe.

The drupal.org guide does not describe an undo. The apply command saves a configuration checkpoint first and restores it only when applying fails. Once a recipe has finished, restore your backup or revert the changes by hand.

Cite this definition

"Recipes." DXPR Drupal glossary, https://dxpr.com/hc/documentation/learn-drupal/drupal-glossary/recipes. Last updated October 26, 2026.

Related terms

All Drupal terms from A to Z