Home » Magento tutorial for developer » Magento architecture – structure of a Magento module

Magento architecture – structure of a Magento module

In the previous tutorial, we learned how to install Magento in localhost Xampp server. Today, we will continue the series of tutorial for beginners by exploring Magento’s Architecture

For those who’re new, Magento is really complicated platform. It’s a perfect combination of Zend Framework with MVC architecture (Model – View – Controller)

- Zend Framework: a framework implemented in PHP, Zend Framework is currently one of the most powerful framework and being used widely due to its strong&unique features that can’t be seen in other frameworks. By using Zend, we can easily extend many classes and integrate different libraries without having troubles in configuration.

- MVC:  Model–view–controller (MVC) is a software architectural pattern for implementing user interfaces. It divides a given software application into three interconnected parts, so as to separate internal representations of information from the ways that information is presented to or accepted from the user.

mvc architecture magento

Model: A model notifies its associated views and controllers when there has been a change in its state. This notification allows the views to produce updated output, and the controllers to change the available set of commands. In some cases an MVC implementation might instead be “passive,” so that other components must poll the model for updates rather than being notified.

View: A view requests information from the model that it uses to generate an output representation to the user.

Controller: A controller can send commands to the model to update the model’s state (e.g., editing a document). It can also send commands to its associated view to change the view’s presentation of the model (e.g., by scrolling through a document).

1. The directory structure in magento

/ app / etc - containing global configurations

/ app / code - containing different modules ( models, controllers, helpers, blocks… )

/ app / code / core - containing Magento module developed by Magento team

/ app / code / community - containing Modules developed by Magento community

/ app / code / local - containing Modules developed by other magento extension providers

/ app / code / core / Mage -  magento default namespace

/ app / code / core / Mage / {Module} - module root

/ app / code / core / Mage / {Module} / etc - module configuration

/ app / code / core / Mage / {Module} / controllers - controllers module

/ app / code / core / Mage / {Module} / Block - Block logic classes

/ app / code / core / Mage / {Module} / Model - Object Models provided by module

/ app / code / core / Mage / {Module} / Model / Mysql4 - Resource Models provided by module

/ app / code / core / Mage / {Module} / sql - sql installation and upgrade files between module versions

/ app / code / core / Mage / {Module} / sql / {resource} / - resource model specific upgrades

/ app / code / core / Mage / {Module} / sql / {resource} / {type}-{action}-{versions}.(sql|php) - resource update files. example: mysql4-upgrade-0.6.23-0.6.25.sql

/ app / design - is location of design packages (layouts, templates, translations)

/ app / design / frontend - frontend design

/ app / design / adminhtml - HTML admin panel design

/ app / design / {area} / {package} / {theme} - theme customizations

/ app / design / {area} / {package} / {theme} / layout - .xml files that define block structure for different cases in website flow

/ app / design / {area} / {package} / {theme} / template - .phtml (html with php tags) templates

/ app / design / {area} / {package} / {theme} / locale - Zend_Translate compatible translation files for package/theme

/ app / locale - locale files

/ app / locale / {locale (en_US)} - Zend_Translate compatible translation files for modules

/ skin / {area} / {package} / {theme} / - is where design package css and images are

/ lib - are libraries such as Zend and Varien

/ js - are javascripts smile

/ media - uploaded files (product images, pdf documents, etc)

/ tests - Unit tests (not done yet)

/ var - temporary files

/ includes - contains  config.php

2. Structure of a Magento module

module magento folder

A Magento module (extension) comprises the following components:

Block: Blocks load data, adjust data from database before showing data on template.

Controller: receive requests from users via Http and transfer requests to class to handle.

Etc:  Include xml files used to configure module. Every module has corresponding xml files.
- Config.xml: used to declare model,helper,block…

- System.xml: create fields to be showed on left menu when click on system/config.

- Adminhtml.xml: This file is where configuration related to he admin console is put, and was introduced to help reduce the memory footprint of Magento’s configuration object for frontend store access.

Helper: create functions that can be used at different places in the system. We can also call helper as:  Mage::helper(‘tenmodule/tenhelper’)->helperTenfunction();

Model: create direct queries to send to the database.

Sql: Create tables, update data table,  change database….


After researching this article, you will have an overview on basic structure of Magento, folders as well as models that built Magento.

If you have any questions regarding the article, feel free to leave a comment below.

Happy coding!

About Brian Wilson

Brian is a freelance Magento developer with 5 years of experience with customizing Magento extensions, magento themes. He's interested in sharing Magento Tutorials to the community


  1. avatar

    Hello Brian,

    I would like to learn Magento. I have found same issue in create simple after checking also your step by step module creation. I would like to also lean that how to extend core functionality of mangeto product and category. I would like to create simple add / edit /delete module in admin section and view in front.

    Looking for reply.


  2. avatar

    How do we hire Brian Wilson? We can not find his contact data.

    Thank you!


  3. avatar

    Hi Brian Wilson I am Mr.Balakrishna i want to learn step by step process for magento e-commerces site development. I can see some tutorials but i am not understanding where to starting magento development.

    please can you help me.

Leave a Reply to Bo Mon Cancel reply

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


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

Scroll To Top