---
title: "Create a backend module with Extbase"
manual: "TYPO3 Explained"
version: "13.4"
permalink: "https://docs.typo3.org/permalink/t3coreapi:backend-modules-template@13.4"
source: "ExtensionArchitecture/HowTo/BackendModule/CreateModuleWithExtbase.rst"
rendered: "2026-09-29T12:03:22+00:00"
---

# Create a backend module with Extbase {#backend-modules-template}

> [!TIP]
> If you don't want to do extensive data modeling templates can be written
> [without Extbase.](https://docs.typo3.org/permalink/t3coreapi:backend-modules-template-without-extbase@13.4)

See also the [Backend module API](https://docs.typo3.org/permalink/t3coreapi:backend-modules@13.4).

Backend modules can be written using the Extbase/Fluid combination.

The factory `\TYPO3\CMS\Backend\Template\ModuleTemplateFactory` can be used
to retrieve the `\TYPO3\CMS\Backend\Template\ModuleTemplate`
class which is - more or less - the old backend module template,
cleaned up and refreshed. This class performs a number of basic
operations for backend modules, like loading base JS libraries,
loading stylesheets, managing a flash message queue and - in general -
performing all kind of necessary setups.

To access these resources, inject the
`\TYPO3\CMS\Backend\Template\ModuleTemplateFactory` into your backend module
controller:

```php
 use TYPO3\CMS\Backend\Attribute\AsController;
 use TYPO3\CMS\Backend\Template\ModuleTemplateFactory;
 use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;

 #[AsController]
 final class MyController extends ActionController
 {
     public function __construct(
         protected readonly ModuleTemplateFactory $moduleTemplateFactory,
     ) {
     }
}
```

> [!NOTE]
> A backend controller should be tagged with the
> `\TYPO3\CMS\Backend\Attribute\AsController` (php:`#[AsController]`) attribute.

After that you can add titles, menus and buttons using `ModuleTemplate`:

```php
// use Psr\Http\Message\ResponseInterface
public function myAction(): ResponseInterface
{
    $moduleTemplate = $this->moduleTemplateFactory->create($this->request);

    // Example of assignung variables to the view
    $moduleTemplate->assign('someVar', 'someContent');

    // Example of adding a page-shortcut button
    $routeIdentifier = 'web_examples'; // array-key of the module-configuration
    $buttonBar = $moduleTemplate->getDocHeaderComponent()->getButtonBar();
    $shortcutButton = $buttonBar->makeShortcutButton()->setDisplayName('Shortcut to my action')->setRouteIdentifier($routeIdentifier);
    $shortcutButton->setArguments(['controller' => 'MyController', 'action' => 'my']);
    $buttonBar->addButton($shortcutButton, ButtonBar::BUTTON_POSITION_RIGHT);
    // Adding title, menus and more buttons using $moduleTemplate ...

    return $moduleTemplate->renderResponse('MyController/MyAction');
}
```

Always pass the template name, relative to the `Templates/` folder, to
`renderResponse()`. Unlike `$this->view`, it does not derive the
name from the controller and action and throws an exception without one.

> [!NOTE]
> **See also**
>
> [Dropdown button components](https://docs.typo3.org/permalink/t3coreapi:dropdown-button-components@13.4)

Using this `ModuleTemplate` class, the Fluid templates for
your module need only take care of the actual content of your module.
TYPO3 even comes with a default Fluid layout, that can easily be used:

```html
<f:layout name="Module" />
```

and the actual Template needs to render the title and the content only.
For example, here is an extract of the "Index" action template of
the "beuser" extension:

**typo3/sysext/beuser/Resources/Private/Templates/BackendUser/List.html**

```html
<html
   xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
   xmlns:core="http://typo3.org/ns/TYPO3/CMS/Core/ViewHelpers"
   xmlns:be="http://typo3.org/ns/TYPO3/CMS/Backend/ViewHelpers"
   data-namespace-typo3-fluid="true">

   <f:layout name="Module" />

   <f:section name="Content">
       <h1><f:translate key="backendUserListing" /></h1>
       ...
   </f:section>

</html>
```

The best resources for learning is to look at existing modules
from TYPO3 CMS. With the information given here, you should be
able to find your way around the code.
