1. Home
  2. Magento 2 Guides
  3. Magento 2 Directory Structure

Magento 2 Directory Structure

After installing Magento 2, you will not have any custom modifications to your site. If you are coming from Magento 1, knowing where to start adding your modules and editing themes can be daunting.

First, consider the web root for Magento 2 (2.1 as of this writing)

Some of this is familiar. The app,lib, and var directories were all part of Magento 1.  New in Magento 2 are bin, dev, phpserver, pub, setup, update, and vendor.

Directory Purpose
app contains the design folder for themes and the configuration file env.php
bin contains the Magento 2 command line tool named magento ,
dev contains testing files for the Magento 2 Functional Testing Framework
lib like Magento 1, various libraries and packages are in here
phpserver contains Router.php
pub contains generated static files and your site media
setup several important packages are in here, such as the performance toolkit
update this is similar to the downloader from Magento 1 and contains upgrade files
var like Magento 1, contains raw cache files,logs, and reports
vendor the closest to app/etc/modules you will get in Magento 2

That is the web root, but we don’t need to be concerned with all of it to work with Magento 2. Many of the core directories should be left alone, and until you really dig into Magento 2 development, you probably won’t be using the testing tools.  Only a few are directly used in managing the front and backends for your store.

Where are the themes stored?

Themes are all in app/design/frontend/ then in a vendor subfolder, which can have multiple themes under it.  Themes are fully detailed at the M2 devdocs.  From those docs a typical theme will look like this:

What happened to media?

Media files are no longer in the web root under an explicit media directory. Media is now under pub/ along with the static files. pub/ also contains the error pages that will be displayed if your site is showing a 404 or 503 or other report page, pub/errors is analogous to <webroot>/errors/ in Magento 1.  Image uploads and imports will appear somewhere within pub/media. 

Var is still around

Var is still the dumping ground for cache files, reports, and Magento logs. Now it includes the di, generation, and pre-processed views folders.   As with Magento 1, the contents of var/ should be treated as disposable.


Marketplace modules and the core modules are all under vendor. If you download something from the new Magento Marketplace, it will be in here.

Updated on July 22, 2017

Was this article helpful?

Related Articles