Core Architecture & Containers
Relevant source files
The following files were used as context for generating this wiki page:
The PrestaShop architecture utilizes a dual-kernel system to manage distinct application environments. This core structure separates the Front Office and Back Office logic into specific containers, ensuring modularity and environment-specific service loading. The system relies on Symfony-based kernels and custom adapter classes to build and manage these service containers.
Application Kernels
The application environment is split between two primary kernels: AppKernel and AdminKernel. These kernels define which bundles and services are available to specific parts of the shop.
AppKernel
AppKernel manages the general shop environment, including the Front Office. It initializes the core bundles required for the shop's operation and handles the basic container configuration.
Sources: [app/AppKernel.php](https://github.com/mattgoud-sandbox/PrestaShop/blob/a9e8f98a90dc6c32ecb7a82c567c16f0a892c444/app/AppKernel.php)
AdminKernel
AdminKernel handles the Back Office environment. It extends the standard application logic to include administrative-specific services and bundles necessary for the merchant interface.
Sources: [app/AdminKernel.php](https://github.com/mattgoud-sandbox/PrestaShop/blob/a9e8f98a90dc6c32ecb7a82c567c16f0a892c444/app/AdminKernel.php)
The following diagram illustrates the relationship between these kernels and the underlying Symfony Kernel:
The application uses specialized kernels for different execution contexts.
Sources: [app/AppKernel.php](https://github.com/mattgoud-sandbox/PrestaShop/blob/a9e8f98a90dc6c32ecb7a82c567c16f0a892c444/app/AppKernel.php), [app/AdminKernel.php](https://github.com/mattgoud-sandbox/PrestaShop/blob/a9e8f98a90dc6c32ecb7a82c567c16f0a892c444/app/AdminKernel.php)
Service Container Management
The ContainerBuilder class in the Adapter namespace manages the assembly of service containers. It bridges the gap between the legacy PrestaShop core and the modern Symfony service container.
Key Components
- Container Construction: The system builds containers dynamically based on the current environment (dev, prod, or test).
- Service Registration: Services are defined in XML or YAML and registered within the container for dependency injection.
The flow demonstrates how the service container is prepared during the application lifecycle.
Sources: [src/Adapter/ContainerBuilder.php](https://github.com/mattgoud-sandbox/PrestaShop/blob/a9e8f98a90dc6c32ecb7a82c567c16f0a892c444/src/Adapter/ContainerBuilder.php), [.ai/CONTAINERS.md](https://github.com/mattgoud-sandbox/PrestaShop/blob/a9e8f98a90dc6c32ecb7a82c567c16f0a892c444/.ai/CONTAINERS.md)
Infrastructure & Environments
PrestaShop requires specific server configurations and provides a Docker-based development environment to ensure architectural consistency across different setups.
Environment Requirements
| Component | Requirement |
|---|---|
| PHP | 8.1+ |
| Database | MySQL 5.6+ (or MariaDB/Percona) |
| Web Server | Apache or Nginx |
Sources: [README.md:46-52](https://github.com/mattgoud-sandbox/PrestaShop/blob/a9e8f98a90dc6c32ecb7a82c567c16f0a892c444/README.md#L46-L52) |
Docker Container Architecture
The project provides a Docker environment that encapsulates the necessary services for development. This includes the web server (PHP/Apache) and database services.
The Docker setup provides a standardized architectural stack for development.
Sources: [README.md:61-75](https://github.com/mattgoud-sandbox/PrestaShop/blob/a9e8f98a90dc6c32ecb7a82c567c16f0a892c444/README.md#L61-L75), [.ai/CONTAINERS.md](https://github.com/mattgoud-sandbox/PrestaShop/blob/a9e8f98a90dc6c32ecb7a82c567c16f0a892c444/.ai/CONTAINERS.md)
Testing Architecture
The project employs a structured testing hierarchy managed through Node.js scripts for User Interface (UI) testing. This architecture separates sanity, functional, and regression tests.
- Sanity Tests: Validate the most basic and critical paths.
- Functional Tests: Divided into Back Office (BO) and Front Office (FO) campaigns to ensure feature-level correctness.
- Audit Tests: Performance and structural checks.
Sources: [tests/UI/package.json:28-50](https://github.com/mattgoud-sandbox/PrestaShop/blob/a9e8f98a90dc6c32ecb7a82c567c16f0a892c444/tests/UI/package.json#L28-L50)
Summary
The core architecture of PrestaShop is defined by its dual-kernel approach and the use of a centralized ContainerBuilder. This structure allows the application to serve two distinct interfaces (Front and Back Office) while sharing a common foundation. By utilizing Symfony kernels and a Docker-supported infrastructure, the architecture maintains a balance between legacy support and modern service-oriented design.