Create a backend module with Extbase

See also the Backend module API.

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:

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

 final class MyController extends ActionController
     public function __construct(
         protected readonly ModuleTemplateFactory $moduleTemplateFactory,
     ) {

New in version 12.1/12.4.9

A backend controller can be tagged with the \TYPO3\CMS\Backend\Attribute\AsController attribute. This way, the registration of the controller in the Configuration/Services.yaml file is no longer necessary.

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

// use Psr\Http\Message\ResponseInterface
public function myAction(): ResponseInterface
    $this->view->assign('someVar', 'someContent');
    $moduleTemplate = $this->moduleTemplateFactory->create($this->request);
    // Adding title, menus, buttons, etc. using $moduleTemplate ...
    return $this->htmlResponse($moduleTemplate->renderContent());

Using this ModuleTemplate class, the Fluid templates for your module need only take care of the actual content of your module. As such, the Layout may be as simple as (again from "beuser"):

<f:render section="Content" />

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:


   <f:layout name="Default" />

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


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.