Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: OpenID Connect / OAuth client 3.0.0-alpha9 New alpha version released for module openid_connect (3.0.0-alpha9). Release: Timelinr 1.0.1 Minor update available for module timelinr (1.0.1). Usage Milestone: Simplify Module simplify crossed 10,000 active installs. Usage Milestone: Views Reference Filter Module entityreference_filter crossed 10,000 active installs. Usage Milestone: Dropdown Language Module dropdown_language crossed 10,000 active installs. Usage Milestone: Paragraphs Browser Module paragraphs_browser crossed 10,000 active installs. Usage Milestone: OpenAPI Module openapi crossed 10,000 active installs. Usage Milestone: Decoupled Router Module decoupled_router crossed 10,000 active installs. Usage Milestone: Time Field for Drupal 8+ Module time_field crossed 10,000 active installs. Module Revived: Entityqueue Buttons 1.1.2 Module entityqueue_buttons updated after 8 months of inactivity (1.1.2).

Drupal AI code generation

25 sites Security covered Drupal 10–11 AI ecosystem
View on drupal.org

This module uses AI to generate Drupal modules, themes, and configuration like content types and views based on your prompts. It's intended for local development and prototyping only, and all generated code should be reviewed before use.

Generate Drupal modules, themes, configuration (content types, views, vocabularies, webforms, etc.) and recipes using AI. ⚠️ Development-only, do not use in production.

Features

  • AI-assisted scaffolding for modules and themes (from minimal starters to complex custom implementations).
  • Generates configuration: content types, fields, displays, views, vocabularies, webforms, Search API/Solr, permissions, roles, and other config entities.
  • Generates recipes (drupal-recipe packages) that bundle configuration, module installs, and optional actions.
  • Writes Drupal-ready files so you can enable modules, import config with drush cim, or apply recipes.
  • Includes a Drush command to run prompts from the CLI (drush aigen).

Note: This module is experimental, intended for local development only. Review all generated code before enabling or importing, especially configuration files.

Post-Installation

  1. Configure the AI module first:
    • Install and enable the AI module.
    • Create an API Key using the Key module.
    • Configure your authentication with your AI provider module (e.g., OpenAI).
    • Select your preferred model in the "Chat" feature in AI Settings. Note: Results depend on the chosen model — more powerful models generally produce more accurate code.
  2. Once the AI provider is configured, go to Configuration → AI → AI Generation (/admin/config/ai/ai-generation).
  3. Enter a prompt (e.g., “Create a content type called Event with a date field”).
  4. The module calls your configured AI provider and generates files.
  5. Configuration is written to your config/sync directory → import with drush cim.
  6. Modules and themes are written under modules/custom or themes/custom.
  7. Recipes are written under recipes/{package}.
  8. Alternatively, use drush aigen "{prompt}" from the CLI.
  9. ⚠️ AI makes mistakes: always review the generated code before enabling or importing.

Additional Requirements

  • Drupal Core 10 or 11
  • drupal/ai (AI provider integration)
  • drupal/key (store API keys)
  • An AI provider account (e.g., OpenAI)
  • Drush – recommended for CLI usage.

Similar projects

Related modules include:

  • AI module – provides the base API and connection to AI providers.
  • AI Agents – allows building agents that interact with AI.

What makes AI Generation different?
While AI and AI Agents focus on providing an API and orchestration layer for prompts and agents,
AI Generation not only asks the AI what code or configuration should look like, but also creates the actual files on disk with a simple prompt, ready to be enabled, imported, or applied in your Drupal site.

Supporting this Module

This project is experimental and intended only for local development. Do not use on production sites.
Contributions are welcome! Please open issues, provide feedback, or contribute code/tests.

Community Documentation

Warning: This module is experimental and should never be used on production environments. It is designed exclusively for development and prototyping.

Depends on

Dependencies of the latest stable release

  • ai Drupal core
  • key Drupal core

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
4
Tracked since
Sep 2025
Latest release
11 months ago
Releases (12 mo)
4 ▲ from 0
Maintenance
Slowing

Release Timeline

Releases

Version Type Core Release date
1.2.0-alpha1 Pre-release 10–11 Sep 29, 2025
1.1.0-alpha1 Pre-release 10–11 Sep 24, 2025
1.0.0-alpha1 Pre-release 10–11 Sep 19, 2025
0.0.1 Stable 10–11 Sep 17, 2025