Notes: Magento 2 Directory Structure

Posted in Magento on 22 April 2021

Magento 1

A brief reminder of the Magento 1 folder structure:

  • app/code followed by either
    • /core for core files
    • /community for third party extensions
    • /local for custom development
  • Modules in the above areas were declared via an XML file in app/etc/module
  • Layouts and templates were located in app/design/frontend
  • Style and JS files were stored in the skin and js subdirectories.

The Changes

Magento 2 replaces the core/communitys module groupings and everything is now directly stored in app/code or vendor composer modules.
Modules are Declared inside each module in the /etc directory. Layouts and templates are moved a new /view directory. Style and JS files are moved inside modules.

Magento 2

  • All core, third party, custom and theme modules go in either vendor (composer) or app/code.
  • Core modules are include in the same way local or community modules are. Each module is listed under a vendor-name/module-name directory inside either vendor or app/code For core modules, the vendor is “magento”.
  • Module front-end code is now stored with the module rather than with the front-end theme. For example the Luma theme is stored as a module in vendor/magento/theme-frontend-luma

Magento 2 Modules

Each module, once installed either manually or via composer will create the following inside the app/code directory:

  • /etc - the main configuration folder and module xml
  • /Setup - database table related file which run in the first instance/during updates
  • /Controller - controller classes and implementation
  • /Model - model classes/business logic
  • /Helper - miscellaneous data
  • /Block - view classes
  • /view - phtml, CSS and JS required to display the module
  • /i18n - internationalisation/languages

Related Magento Posts

October 2023

Magento database structure

The database structure of Magento is designed to store and manage various aspects of an e-commerce website, including products, orders, customers, and more. Understanding the...

Continue reading

August 2023

Accessibility in ecommerce websites

In the digital age, where online shopping has become an integral part of our lives, ecommerce websites hold the key to business success. Amidst the...

Continue reading

August 2023

Using Magento to get small businesses online

For small businesses aiming to establish a formidable online presence and drive sales, Magento emerges as a powerful e-commerce platform offering a suite of features...

Continue reading

July 2023

How can I speed-up my Magento website?

Speed optimisation is crucial for a Magento website as it directly impacts user experience, conversions, and search engine rankings. You should prepare your server so...

Continue reading

June 2023

.htaccess: Enable GZIP Compression for Magento

Enable Gzip compression on your server to compress your website's files before sending them to the visitor's browser. This significantly reduces the file size, resulting...

Continue reading

April 2023

Popular Payment Gateways

Ecommerce payment gateways are critical components of any online store, as they enable merchants to accept payments from customers securely and conveniently. There are many...

Continue reading

More Magento Posts