The directory structure within Magento 2 has changed compared to earlier versions of Magento.
Learning the locations of the files and folders in Magento 2 might take some time, however there are similarities with the Magento 1 structure.
If you have downloaded Magento from the Magento website, the root directory will look like the following.
app directory consists the following directories and files.
codedirectory where you will place any third party code not installed via Composer, or your own custom modules. The Magento core code has been moved into the
designdirectory that contains an
adminhtmldirectory is used for creating adminhtml themes.
frontenddirectory is used for creating frontend themes
etcdirectory that contains two important files:
env.phpthat contains environment configuration such as database, cache and session information.
config.phpthat contains a PHP array of active and inactive modules.
bin directory contains:
magentoexecutable that is used to run common commands such as clearing the cache, running the database upgrade and deploying static content.
lib similar to Magento 1 contains library files.
internaldirectory that contains the Libertine font files.
router.phpfile for the php built-in web server.
pub folder is the preferred document root for the Magento application.
index.phpfile within this directory rather than within the root directory.
mediadirectory contains generated static files and media images uploaded.
var directory, similar to Magento 1:
And lastly, the
vendor directory is created via the use of
Composer. Any third party libraries such as Zend Framework that are installed this way are also present in this directory. Code edits should not be made in any files within the
vendordirectory as they will get overridden when installing or updating packages.
That covers an overview of the directory structure within Magento 2. With this information you’ll be able to create a module and custom theme to help you get started with using the application.
Note: This article is based on Magento version 2.1.