-
Notifications
You must be signed in to change notification settings - Fork 304
shopware architecture - additional content #2147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| --- | ||
| nav: | ||
| title: Core | ||
| position: 25 | ||
| --- | ||
|
|
||
| # Core | ||
|
|
||
| The Core component represents the central backend foundation of Shopware. It provides the domain logic, data handling, APIs, and extensibility mechanisms that power both the Storefront and Administration components. | ||
|
|
||
| Conceptually, the Core sits at the center of the platform architecture. While the Storefront and Administration provide user interfaces, the Core exposes functionality through structured APIs and services. All business logic, domain modeling, and system integrations are implemented within the Core to ensure consistency across different presentation layers. | ||
|
|
||
| The Core is built on Symfony and follows modern backend design principles such as dependency injection, domain-driven organization, and event-based extensibility. | ||
|
|
||
| ## Main concerns | ||
|
|
||
| The Core component is responsible for: | ||
|
|
||
| * Managing business logic and domain services | ||
| * Providing API interfaces (Store API and Admin API) | ||
| * Handling data persistence and abstraction | ||
| * Managing plugins and extensions | ||
| * Supporting asynchronous processing | ||
| * Providing integration points for external systems | ||
|
|
||
| ## Domain-driven architecture | ||
|
|
||
| Shopware organizes the Core around commerce-related domains rather than technical layers. Examples include: | ||
|
|
||
| * Products | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. those are not the real domains like we have them in the code 🤔 more like: |
||
| * Orders | ||
| * Customers | ||
| * Checkout | ||
| * Pricing | ||
| * Inventory | ||
|
|
||
| Each domain encapsulates its own services, entities, and business rules. This structure helps maintain clear boundaries and improves extensibility. | ||
|
|
||
| ## Data abstraction layer (DAL) | ||
|
|
||
| The Data Abstraction Layer (DAL) provides a consistent way to access and manipulate database entities. Instead of working directly with database queries, developers interact with repositories and entity definitions. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This does not always apply. There are integration points like indexers where DBAL or SQL usage is explicitly advised because DAL events might cause an infinite loop there. There are other examples where DBAL or SQL usage is fine. I think one of the more interesting points is that we do not use an ORM which is more common (debatable but ORM is definitly more established than DAL).
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. while this is true, I am not sure, if we should put that into the docs 🙂 the way to go for 3rd party devs is using the DAL.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
It is in the official documentation as a recommendation and also in the example there.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, and it is okay to have that in the docs for that specific use-case. but I would not suggest to put into such general architectural overview |
||
|
|
||
| Key responsibilities of the DAL include: | ||
|
|
||
| * Entity definitions and associations | ||
| * Validation and schema abstraction | ||
| * Versioning and inheritance handling | ||
| * Context-aware data access | ||
| * Event dispatching during entity lifecycle changes | ||
|
|
||
| The DAL ensures that all components access data consistently and enables powerful extension capabilities. | ||
|
|
||
| ## APIs and communication | ||
|
|
||
| The Core exposes functionality through two primary APIs: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That is only partially true. These are the HTTP APIs. API is a much broader term and describes the overall interaction surface with any system via any communication method. A plugin or an app is also using the Shopware Core API with events or service decoration. No web request involved. |
||
|
|
||
| * **Store API** — Public-facing API used by storefront applications and headless frontends. It supports anonymous access and customer-authenticated requests depending on the endpoint. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Frontends arent headless. "Headless" is refering to the sytem which does not have a pre-defined representation layer for human interaction. As far as I know it originated from "headless computers", so computers without monitor, mouse and keyboard. So "headless frontends" is somewhat contradictory. It may be used because of colloquial sloppiness but it's not accurate. |
||
| * **Administration API** — OAuth 2.0 secured API used by the Administration SPA and external management integrations. | ||
|
|
||
| Both APIs communicate over HTTP and exchange structured JSON payloads, allowing decoupled frontend implementations. | ||
|
|
||
| ## Plugin and extension system | ||
|
|
||
| Extensibility is a fundamental design principle of Shopware. The Core provides multiple extension mechanisms: | ||
|
|
||
| * Symfony event system | ||
| * Service decoration | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Service decoration is done via DI configuration. So this is partially redundant with "Dependency injection configuration". Without the DI configuration, the decorator would just be a child class. |
||
| * Entity extensions | ||
| * Custom API routes | ||
| * Dependency injection configuration | ||
|
|
||
| Plugins integrate into the system without modifying core code, enabling safe upgrades and customization. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
We wish it would be like this, but it isn't. Otherwise there would be way less issues on GitHub. |
||
|
|
||
| ## Messaging and asynchronous processing | ||
|
|
||
| Certain operations are executed asynchronously to improve performance and scalability. The Core uses Symfony Messenger for background processing tasks such as: | ||
|
|
||
| * Indexing and search updates | ||
| * Scheduled tasks | ||
| * Email sending | ||
| * Integration workflows | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this refering to the flow building? |
||
|
|
||
| Message queues allow heavy operations to run outside the request lifecycle. | ||
|
|
||
| ## Interaction with other components | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. was kinda already said above 🤔 |
||
|
|
||
| The Core serves as the foundation for: | ||
|
|
||
| * **Storefront** — Uses the Store API and domain services to render customer-facing pages. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Storefront doesn't use the Store API (there might be edge cases, but at least I can't remember any). https://github.com/shopware/frontends uses the Store API. The Storefront accesses the PHP API of the core. It's basically a plugin.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the Storefront uses the store-api route classes as services. the storefront is not a plugin, but more a "bundle" in Symfony terms speaking |
||
| * **Administration** — Communicates via the Admin API to manage entities and configurations. | ||
|
|
||
| By centralizing logic in the Core, Shopware ensures consistent behavior regardless of how functionality is accessed. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,3 +8,73 @@ | |
| # Architecture | ||
|
|
||
| On a high level, Shopware consists of multiple modules that separate the entire code base into logical units. Some modules are independent, and some depend on others. | ||
|
|
||
| ## Architectural overview | ||
|
|
||
| High-level architectural overview of Shopware’s core system layers and supporting infrastructure. | ||
|
|
||
| ```mermaid | ||
| flowchart TB | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. unfortunately this does not render, so I could not verify this |
||
| %% Entry | ||
| U[User (Customer / Admin)] -->|HTTPS| RP[Reverse Proxy / Load Balancer] | ||
|
|
||
| %% Application boundary | ||
| subgraph SW[Shopware 6 Application] | ||
| direction TB | ||
|
|
||
| %% Top-level modules | ||
| subgraph CORE[Core] | ||
| direction TB | ||
| DAL[Data Abstraction Layer (DAL)] | ||
| BL[Business Logic / Services] | ||
| API[Sales Channel API + Store API] | ||
| PLUG[Plugin System + Events] | ||
| SCHED[Scheduled Tasks] | ||
| MESSAGE[Symfony Messenger (Async)] | ||
| end | ||
|
|
||
| subgraph ADMIN[Administration] | ||
| direction TB | ||
| ADMUI[Admin UI (Vue)] | ||
| ADMAPI[Admin API (ACL / AuthZ)] | ||
| BUILDADM[Build Tooling (npm/webpack)] | ||
| ADMUI --> ADMAPI | ||
| end | ||
|
|
||
| subgraph STOREFRONT[Storefront] | ||
| direction TB | ||
| SFSSR[Storefront (Twig / Symfony Controllers)] | ||
| SFAPI[Store API / Sales Channel API Client] | ||
| BUILDSF[Build Tooling (npm/webpack)] | ||
| SFSSR --> SFAPI | ||
| end | ||
|
|
||
| %% Internal interactions | ||
| ADMIN --> API | ||
| STOREFRONT --> API | ||
|
Check warning on line 54 in concepts/framework/architecture/index.md
|
||
| API --> DAL | ||
| BL --> DAL | ||
| PLUG --> BL | ||
| SCHED --> MESSAGE | ||
| BL --> MESSAGE | ||
| end | ||
|
|
||
| %% Infrastructure dependencies | ||
| DB[(MySQL / MariaDB)] <--> DAL | ||
| CACHE[(Redis: Cache / Sessions / Locks)] <--> SW | ||
| SEARCH[(Elasticsearch / OpenSearch)] <--> SW | ||
| FS[(Media Storage: Local FS / NFS / S3)] <--> SW | ||
|
|
||
| %% Async processing | ||
| MQ[(Async Transport: Redis / RabbitMQ / DB)] <--> MESSAGE | ||
|
Check warning on line 69 in concepts/framework/architecture/index.md
|
||
| MESSAGE --> W[Workers / Consumers] | ||
| W --> DB | ||
| W --> SEARCH | ||
| W --> FS | ||
|
|
||
| %% External integrations | ||
| EXT[External Services\nPayment / Shipping / ERP / PIM / Tax / Email] <--> API | ||
| EXT <--> W | ||
|
|
||
| RP --> SW | ||
| ``` | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Modern" is an arbitrary and ambigious term in Software Engineering. Like "legacy".