Modules and areas

An area is a logical component that organizes code for optimized request processing. The Adobe Commerce and Magento Open Source framework (Commerce framework) uses areas to streamline web service calls by loading only the dependent code for the specified area. Each of the default areas defined by the Commerce framework can contain completely different code on how to process URLs and requests.

For example, if you are invoking a REST web service call, rather than load all the code related to generating user HTML pages, you can specify a separate area that loads code whose scope is limited to answering REST calls.

Area types

The Commerce framework is organized into these main areas:

You can also send requests to the Commerce framework using the SOAP, REST and GraphQL APIs. These three areas

How areas work with modules

Modules define which resources are visible and accessible in an area, as well as an area's behavior. The same module can influence several areas. For instance, the RMA module is represented partly in the adminhtml area and partly in the frontend area.

If your extension works in several different areas, ensure it has separate behavior and view components for each area.

Each area declares itself within a module. All resources specific for an area are located within the same module as well.

You can enable or disable an area within a module. If this module is enabled, it injects an area's routers into the general application's routing process. If this module is disabled, the Commerce framework will not load an area's routers and, as a result, an area's resources and specific functionality are not available.

Module/area interaction guidelines

Note about request processing

The Commerce framework processes a URL request by first stripping off the base URL. The first path segment of the remaining URL identifies the request area.

After the area name, the URI segment specifies the frontname. When an HTTP request arrives, the Commerce framework extracts the handle from the URL and interprets it as follows:

[frontName]/[controller folder]/[controller class]

The frontName is a value defined in the module. Using catalog/product/view as an example:

For deeper directory structures, the controller folders are separated with an underscore (_). For example:

catalog/product_compare/add = Magento/Catalog/Controller/Product/Compare/Add.php

Note that only the execute() method of any given controller is executed.