For years, reusing functionality between Drupal sites meant install profiles, distributions or a lot of manual clicking. Recipes, introduced in core in Drupal 10.3 and central to Drupal 11, change that: they package a feature as configuration and modules that you can apply to any site, at any time.
Recipes vs. install profiles and distributions
| Install profile / distribution | Recipe | |
|---|---|---|
| When applied | Only at installation | Any time, on existing sites |
| Ongoing dependency | Site stays tied to it | None; the site owns the result |
| Composition | One per site | Combine many; recipes can include recipes |
A recipe is applied once and then gets out of the way. The configuration it creates belongs to your site.
Anatomy of a recipe
recipes/event_content_type/
recipe.yml # what to install and which config actions to run
config/ # config files to import (content type, fields, displays)
content/ # optional default content
A simple recipe.yml for an Event content type:
name: 'Event content type'
description: 'Adds an Event content type with date and link fields.'
type: 'Content type'
install:
- node
- datetime
- link
config:
actions:
user.role.content_editor:
grantPermissions:
- 'create event content'
- 'edit own event content'
The files in config/ (for example node.type.event.yml and the field storage and field definitions) are imported when the recipe runs. Config actions are what make recipes special: instead of overwriting configuration, they make targeted changes to config that already exists, like granting permissions to an existing role.
Applying a recipe
# from the web root, with core's script
php core/scripts/drupal recipe ../recipes/event_content_type
# or with Drush
drush recipe ../recipes/event_content_type
Apply recipes on a development environment, review the result, then export configuration and deploy it like any other change.
Where recipes shine in organizations
- Multi-site estates: ministries or universities with many sites can roll out a standard "news", "events" or "FAQ" feature consistently.
- Agency accelerators: package proven features once and apply them on new projects in minutes.
- Compliance baselines: SEO, accessibility or privacy settings packaged as recipes and applied everywhere.
- Drupal CMS: the new Drupal CMS is itself built from recipes.
Good practices
- Keep recipes small and focused; compose bigger features from smaller recipes.
- Prefer config actions over shipping full copies of shared configuration.
- Store recipes in version control and test them on a fresh site in CI.
- Document what each recipe does and what it expects to exist.
Want a library of reusable recipes for your organization's sites? Our Drupal team can design it with you.