Create your component file structure

In this section, we go over the different file structures for component types. The Adobe Commerce or Magento Open Source application looks for the files that make up a component including configuration files in particular places inside the component file structure. Follow the predefined file structures for the component type you are developing to ensure that it works as expected.

Root directory location

data-src=/includes/component-root.md

Module file structure

A typical file structure for a module can look like the following:

Module File Structure

Common directories

Following are some common module directories:

Model file structure

The directory structure for the ORM follows the MVC pattern:

├── Model
│   ├── ResourceModel
│     └──  ModelName/Collection

Model directories include:

Additional directories

Additional folders can be added for configuration and other ancillary functions for items like plugin-ins, localization, and layout files.

Theme file structure

A typical theme file structure can look like the following:

├── composer.json
├── etc
│   └── view.xml
├── i18n
│   └── en_US.csv
├── LICENSE_AFL.txt
├── LICENSE.txt
├── media
│   └── preview.jpg
├── registration.php
└── web
    ├── css
    │   ├── email.less
    │   ├── print.less
    │   ├── source
    │   │   ├── _actions-toolbar.less
    │   │   ├── _breadcrumbs.less
    │   │   ├── _buttons.less
    │   │   ├── components
    │   │   │   └── _modals_extend.less
    │   │   ├── _icons.less
    │   │   ├── _layout.less
    │   │   ├── _theme.less
    │   │   ├── _tooltips.less
    │   │   ├── _typography.less
    │   │   └── _variables.less
    │   ├── _styles.less
    │   ├── styles-l.less
    │   └── styles-m.less
    ├── images
    │   └── logo.svg
    └── js
        ├── navigation-menu.js
        └── theme.js

Common directories

Typical theme directories are:

For more details on the theme folder structure, see theme structure.

Language package file structure

A typical directory structure for three language packages follows:

├── de_DE
│   ├── composer.json
│   ├── language.xml
│   ├── LICENSE_AFL.txt
│   ├── LICENSE.txt
│   └── registration.php
├── en_US
│   ├── composer.json
│   ├── language.xml
│   ├── LICENSE_AFL.txt
│   ├── LICENSE.txt
│   └── registration.php
├── pt_BR
│   ├── composer.json
│   ├── language.xml
│   ├── LICENSE_AFL.txt
│   ├── LICENSE.txt
│   └── registration.php

The only required directory for a language package is the top-level directory. Although not required, we recommend that the directory name match the ISO code to identify the locale.

For more information about language packages, see Translation dictionaries and language packages.