This website uses cookies

Our website, platform and/or any sub domains use cookies to understand how you use our services, and to improve both your experience and our marketing relevance.

[Cyber Week Savings] Unleash the power of managed cloud hosting at 40% OFF for 4 months. GET THE DEAL

Overview of Magento Folder Structure Directories and Libraries

Updated on June 16, 2022

4 Min Read

Magento is based on Object-Oriented Programming (OOP) structure concept, made with MVC design pattern in PHP scripting language. It has a robust, flexible, and well-defined directory structure that makes it an efficient ecommerce platform for technical users.

Magento Folder Structure

In this guide, we will focus on Magento folder structure, learning its details and finding out how the folder structure works.

We will also discuss the top-layer of Magento folder structure and explore the depth of necessary sub-directories. Let’s start by naming “RootDirectory” as the installation directory of the Magento platform.

Scalable Hosting to Launch & Manage Magento Store

Set up your Magento store on the cloud solution of your choice. Get one migration completely FREE.

Magento Folder Structure

In Magento 1.x, the default files and folders included in the main directories are as follows:

        /app – This is where all the php code for the Magento platform resides. It contains the configuration files related to Magento application like the database, core, modules, themes, and files related to programming languages.

          /dev – The Magento directory structure includes the Magento Test Framework (MTF) files as well. The MTF is a tool that can run automated functional tests, to assist in the development and implementation of Magento modules. These test files can be found in this /dev directory.

          /downloader – It is used to download and install the extension from Magento connect. It is also used for the installation and upgrading of Magento through the web browser.

          /errors – This directory contains different error processor and template files like 404 error. Usually, people do not touch this directory.

          /includes – It includes some middleware code files. All model files parsed and moved into this folder. Once you make any changes in a model file of the module, first it is parsed and then moved into the /includes directory.

          /js – This directory contains the pre-compiled libraries of the JavaScript codes included in Magento.

          /lib – The external PHP code library used in Magento.

          /media – This is storage directory of the Magento media files like generated thumbnails, uploaded product images, etc. It is also used as the container for importing images through CSV or other import/export tools.

How To Add Magento 2 Bundle Products on Your Store

          /shell – This is the dedicated folder where Magento scripts are stored. Some scripts like indexer.php or log.php can be found in the shell directory, allowing you to perform actions using Command-line Interface (CLI).

          /skin – This is where images, javascript files, CSS files, and flash files reside. It also includes the skin files for installation of skins and administration templates including media files related to the design of the frontend and backend.

          /var – The var directory plays an essential role in Magento directory structure. It mainly contains temporary files and data like cache, error, log, session, and locks.

Magento 2 Folder Structure

Magento 2 folder structure has been changed a lot from the previous version of Magento platform. If you navigate through the root directory of Magento 2, you’ll see the following folder structure:

           /app – This folder contains the core files of Magento 2 including configuration, modules and themes files.

          /bin – It contains the Magento 2 CLI feature. Using CLI would require SSH access to the server. The Magento 2 CLI can help you in installing modules, upgrading the application core, reindexing, compiling, etc.

          /dev – This directory contains various tools for developers such as Magento Test Framework (MTF).

          /lib – This directory contains libraries packed separately from the Magento 2 core libraries.

          /phpserver – The phpserver folder contains Router.php file.

          /pub – This directory contains generated static files and site media. It should be set as your web root on the server side. As the name of the folder says, it contains all the publicly accessible files.

          /setup – Several important packages such as the performance toolkit are available in this setup directory.

          /var – Same as Magento 1, the var folder contains raw cache files, logs, sessions, and reports.

          /vendor – Vendor directory is generated by composer using composer.json file. This folder includes various packages that have been defined under composer.json file.


What is Magento generated folder?

Magento generated folders are automatically generated by default by Magento application. It contains all the subdirectories and folders that are needed by the system.

What is use of generated folder in Magento 2?

Generated folder in Magento 2 contains numerous content in their subdirectories which includes classes, sessions, cache and much more like generated code, to make sure all methods are correct and properly called.

Where are Magento files stored?

All Magento files and folder are stored in /RootDirectory

Share your opinion in the comment section. COMMENT NOW

Share This Article

Customer Review at

“Great speed, features, knowledgebase, dashboard, UX and fast, expert support. Very happy!”

Stefan [Management Consultant]

Fayyaz Khattak

Fayyaz, a passionate Motorbike tourist, works as a Team Lead — Magento Community at Cloudways - A Managed Magento Hosting Platform. His objective is to learn & share about PHP & Magento Development in Community. You can contact him at [email protected]


Get Our Newsletter
Be the first to get the latest updates and tutorials.

Thankyou for Subscribing Us!


Webinar: How to Get 100% Scores on Core Web Vitals

Join Joe Williams & Aleksandar Savkovic on 29th of March, 2021.

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

Unleash The Cloud.
Not Budgets.

For 4 Months +
Up To 30 Free Migrations

Cyber Week

Time Left In Offer
  • 0


  • 0


  • 0


  • 0


40% OFF

On All Plans