Core concepts
The Magento documentation and code keep using the same words: store view, area, module, theme, mode. The following lessons are hard to read without them, so they are explained up front. There is almost no code here — only the meaning.
Website, store, store view
One Magento installation can serve several shops. Three levels exist for that:
| Level | In code | What differs |
|---|---|---|
| Website | website | Domain, prices, customers, payment methods |
| Store | store (group) | The root catalog category |
| Store view | store view | Language and design |
Example: a company sells clothes on example.com and electronics on tech.example.com — these are two websites. The clothes website has an English and a German version — these are two store views.
Right after installation there is one item of each level. They are managed in the admin panel: Stores → All Stores.
These levels matter to a developer: a module setting or a product name can be set separately for each store view. In code the current store view comes from Magento\Store\Model\StoreManagerInterface.
Areas
An area is a part of the application with its own configuration and pages. The same module can behave differently in each of them.
| Area | What it is |
|---|---|
frontend | The storefront a customer sees |
adminhtml | The admin panel |
webapi_rest | The REST API |
graphql | The GraphQL API |
crontab | Scheduled jobs |
The area is visible in file paths. Configuration from etc/frontend/routes.xml applies only to the storefront, from etc/adminhtml/routes.xml only to the admin panel, and a file directly in etc applies everywhere. Storefront templates live in view/frontend, admin templates in view/adminhtml.
Module
A module is a folder with code and configuration that solves one task: the catalog, the cart, reviews. A module name consists of a vendor and a name: Magento_Catalog, Acme_Hello. A module can be enabled and disabled with a command.
Theme
A theme is responsible for the look: templates, styles, images. Two storefront themes are shipped — Magento/blank and Magento/luma. Your own theme inherits from one of them and changes only the files it needs.
Application modes
| Mode | What it is for |
|---|---|
default | Active after installation; suitable only for the first run |
developer | Development: errors on screen, files are built on the fly |
production | A live server: everything is built in advance, errors go only to the log |
The current mode is shown by a command:
bin/magento deploy:mode:showIt prints a line like Current application mode: default.
Common mistake
The words "store" and "store view" are easy to mix up: in code store usually means the store view, not the group. For example, the default store code and the ScopeInterface::SCOPE_STORE constant refer to the store view level. When the documentation says "store ID", it almost always means the store view number.