PrestaShop is a powerful and flexible open-source platform for creating online stores. Understanding PrestaShop's architecture helps you better comprehend how the various components work together, ensuring seamless store operation. In this article, we’ll explore PrestaShop's structure in detail, focusing on both the Front Office (FO) and Back Office (BO), as well as the backend system.
Overview
PrestaShop’s architecture can be divided into two main logical sections, as depicted in the diagram below:
- Front Office (FO) – The public-facing part of the store that customers interact with.
- Back Office (BO) – The administrative panel where store owners manage every aspect of their business.
Each of these sections is further divided into two parts, which is common in most web applications:
- Front-end – The part that runs in the user’s browser.
- Back-end – The part that runs on the server.
This separation is represented by a dotted horizontal line in the diagram.
Backend
If we examine how the backend is structured, we find several key elements common to both BO and FO:
- Database
- Business Logic
- Modules
PrestaShop is heavily database-driven, as with most traditional web applications. All the store's data is stored in the database, and it acts as the single source of truth, regardless of whether it's used in FO or BO.
On the diagram, the database is shown outside the main structure to indicate that it can be a separate system, hosted on another server or in a cluster setup.
The purple cloud above the database represents Core Business – the main body of code that handles the business logic of PrestaShop. It includes models, controllers, and helper classes.
PrestaShop controllers generally output HTML pages but can sometimes output data in JSON or XML formats. The layout of these pages is determined by themes, which transform the controller-provided data into HTML. This applies to both FO and BO, with FO supporting third-party themes.
PrestaShop offers two API interfaces:
- BO API – Used to serve information to VueJS-based BO pages (such as Stock management and Translations).
- Web services – Used to integrate third-party services, supporting both XML and JSON outputs.
Modules are independent packages that extend PrestaShop’s functionality, interacting with the core either by hooking into extension points or replacing core components with custom implementations.
Frontend
On the front side, implementation depends on the theme. Some themes rely on basic HTML with minimal scripting, while others are more advanced, utilizing heavy JavaScript usage. FO themes can be customized, while BO themes are more restricted.
Core Business Stack
PrestaShop’s code is divided into four logical subsystems:
- Legacy code – The old, non-namespaced code.
- Core code – The modern codebase based on SOLID principles.
- Adapter code – Bridges legacy classes to interact with modern core classes.
- Symfony code – Contains Symfony-specific functionalities like controllers and forms.
This setup allows PrestaShop to gradually evolve while still supporting older code, ensuring smooth updates over time.
Controllers
PrestaShop follows the Model-View-Controller (MVC) pattern, where controllers handle requests and return responses, delegating the heavier tasks to dedicated services. Controllers are categorized into two families:
- FO controllers – Handle requests for the Front Office.
- BO controllers – Handle requests for the Back Office and can be either legacy or Symfony-based.
Themes
PrestaShop supports two types of themes: FO themes and BO themes. FO themes use the Smarty templating engine, while BO themes use Twig, aligning with the Symfony transition. The default FO theme is called “Classic,” based on Bootstrap 4, while the BO uses its own UI kit based on Bootstrap 4.
Modules
Modules play a central role in extending PrestaShop’s functionality. They can add new features, modify interfaces, and integrate with external services through hooks. Modules can interact deeply with the core system by adding their own controllers, styles, scripts, and even overriding classes.
PrestaShop is a complex yet flexible system, allowing store owners to customize and adapt the platform to their specific needs. Understanding its architecture is a crucial step toward unlocking the full potential of the platform.