Drupal Recipes: Reusable Configuration Without the Overhead

6 months ago
DrupalRecipe
Build Drupal sites faster with Recipes: reusable configuration bundles for content types, workflows, and features without manual configuration work.
Drupal Recipes - Reusable Configuration without Overhead Hero

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've spent half the day recreating something you built last month. You get efficient at it, but that's not the same as being productive.

Drupal Recipes streamline this. Instead of manually recreating features or maintaining a fragile installation profile, you apply predictable, reusable configuration bundles at any point in a project. Recipes sit between "build everything by hand" and "use a full distribution, whether you need all of it or not."

What Is a Drupal Recipe?

A Recipe is a set of instructions that describes how to configure a specific feature in Drupal. It installs modules, imports configuration, updates existing settings, provides content when needed, and then steps aside. 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 you can apply repeatedly without the manual work.

Why Recipes Matter

No permanent installation profiles. Legacy installation profiles lock you in from the moment you pick one. Recipes can be applied at any point in a project's lifecycle. Start with the minimum, stay flexible, and apply features only when you need them.

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.

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.

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

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

  • 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 step ensures Recipes apply cleanly and predictably.

What Recipes Can and Cannot Do

Recipes can:

  • 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

Recipes cannot:

  • 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 should be placed in a module. The Recipe should install the module and handle configuration.

Applying a Recipe

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

drush recipe ../recipes/my_recipe

Rebuild the cache, 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 automatically places these packages into your recipes directory. This makes it simple to maintain a shared library of Recipes across projects or teams.

Practical Use Cases

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

  • 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 sites
  • Enable editorial workflows with minimal effort
  • Spin up demo sites quickly for training or previews

A More Efficient Approach to Site Building

Drupal has always been powerful. Sites grow, requirements shift, and features accumulate. Recipes bring a more systematic approach to managing that growth. They make Drupal more accessible for new builders and more efficient for seasoned developers, all without compromising flexibility.

Additional Reading

Related Content