An Introduction to Magento 2 Directory Structure


Magento 2 is a brand new E-Commerece CMS, yes it is, because it doesn’t share much with its predecessor Magento v1 except for its name.
Magento 2 uses jQuery and Backbonejs instead of Prototype, it also got support for the composer too.
Here is a quick overview of Magento 2 directory/folder structure.


This is somehow similar to that of magento 1’s app directory but it doesn’t have the code and design directories by default (Magento core modules are located in vender directory). All custom modules and theme are to be placed inside code and design sub-directories to app directory.


Magento 2 comes with the trendy built-in command line tool just like laravel and symfony2, and bin folder hosts binaries for that tool


dev folder contains tools for developer like testing tool and migrations


‘generated’ directory used to be in /var folder in previous versions of M2, but after version 2.2, it is moved to root directory. This directory contains files that are missing from magento 2 code base but magento thinks they are legitimate files. (details later)


Just like lib directory in version 1 this directory hosts thrid party libraries but not like m1 where it used to have all framework code, now it has limited number of libraries in there as most of libraries are now loaded from composer and is placed in vendor directory.


This directory contains the core router.php file, which routes the whole system


Just like laravel or in symfony2 where server points at a public (web )folder, magento 2 comes up with pub folder which should be the default folder on your server (your domain should point to this folder as this contains the index.php file). This directory contains the media and error folders and also hosts the skin and js directories under static sub-directory


setup directory is for installation process


update directory is similar to the downloader directory from Magento 1 and contains upgrade files.


var directory is same as in magento 1, it includes raw cache files,logs, and reports


this directory is for packages included through composer. magento core modules are all comes in it.

Leave a Reply

Your email address will not be published. Required fields are marked *