# spryker-feature/spryker-core-e-commerce architecture

> Architecture diagram of the GitHub repository spryker-feature/spryker-core-e-commerce, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-11-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/spryker-feature/spryker-core-e-commerce
- Repository: https://github.com/spryker-feature/spryker-core-e-commerce

## Overview

##### Project Type and Purpose
- This is a Composer-packaged Spryker “feature” library named “spryker-core-e-commerce.” It provides a set of self-contained modules (e.g., Catalog, Cart, Prices, Product) that plug into a larger Spryker application to deliver core e-commerce functionality.
- It is not a standalone application but an extension package meant to be installed into the Spryker Commerce OS. Its purpose is to supply reusable business modules.

##### File Structure
- Top-level files:
- .travis.yml – CI configuration
- LICENSE – license terms
- README.md – high-level description
- composer.json – package metadata & dependencies
- No src/ or modules/ directory is shown here, but by Spryker convention each feature ships its modules under a `src` directory following the pattern:
src/SprykerFeature/SprykerCoreECommerce/*Module*/
- Each module will typically have sub-directories for Communication, Business, Persistence, Shared, etc.

##### README for Additional Insights
- The README confirms the package delivers “main modules providing E-commerce functionality like Catalog, Cart, Prices, Product.”
- Installation via `composer require spryker-feature/spryker-core-e-commerce` implies it plugs into the standard Spryker dependency injection and module registration mechanism.

a. Main Components
- Spryker Application Shell (host application)
- Core E-commerce Feature Package
- Catalog Module
- Cart Module
- Prices Module
- Product Module
- (Any additional modules shipped in the feature)
- Shared Infrastructure
- Database (e.g., MySQL)
- Search Engine (e.g., Elasticsearch)
- Message Broker or Event Bus (optional)
- External Integrations (e.g., Payment Providers, Tax Services)

b. Relationships & Interactions
- Modules communicate via Spryker facades and transfer objects.
- Frontend (Yves) layer calls the Cart and Product facades.
- Zed (back-office) layer uses Persistence repositories.
- Business logic modules invoke each other (e.g., Cart calls Prices to calculate totals, Catalog calls Product to retrieve details).
- Persistence modules read/write from the shared database.
- Search modules index to and query from Elasticsearch.

c. Architectural Patterns & Design Principles
- Modular Monolith: each feature module encapsulates its own Business, Persistence, Communication layers.
- Layered Architecture:
- Communication Layer (Controllers, Plugins)
- Business Layer (Facade, Model)
- Persistence Layer (Repositories, Entities)
- Shared Layer (Transfer Objects, Constants)
- Dependency Inversion: modules depend on facades or interfaces rather than concrete implementations.

d. Key Technologies & Frameworks
- PHP 7.x/8.x, Composer
- Spryker Commerce OS (Yves + Zed applications)
- Symfony HTTP Foundation (under the hood)
- Doctrine DBAL or Propel for persistence
- Elasticsearch client (for search)

## Diagram (Mermaid)

```mermaid
flowchart TD
  classDef feature fill:#D0E4F5,stroke:#333,stroke-width:1px
  classDef infra fill:#D5F5E3,stroke:#333,stroke-width:1px
  classDef host fill:#E8E8E8,stroke:#333,stroke-width:1px
  classDef external fill:#FCF3CF,stroke:#333,stroke-width:1px

  subgraph "Host Spryker Application"
    direction TB
    subgraph "Spryker Core E-commerce Feature"
      direction TB

      subgraph "Catalog Module"
        direction TB
        CataComm["Catalog Communication"]:::feature
        CataBus["Catalog Business"]:::feature
        CataPers["Catalog Persistence"]:::feature
        CataShared["Catalog Shared"]:::feature
      end

      subgraph "Product Module"
        direction TB
        ProdComm["Product Communication"]:::feature
        ProdBus["Product Business"]:::feature
        ProdPers["Product Persistence"]:::feature
        ProdShared["Product Shared"]:::feature
      end

      subgraph "Cart Module"
        direction TB
        CartComm["Cart Communication"]:::feature
        CartBus["Cart Business"]:::feature
        CartPers["Cart Persistence"]:::feature
        CartShared["Cart Shared"]:::feature
      end

      subgraph "Prices Module"
        direction TB
        PriceComm["Prices Communication"]:::feature
        PriceBus["Prices Business"]:::feature
        PricePers["Prices Persistence"]:::feature
        PriceShared["Prices Shared"]:::feature
      end

      ComposerJson["composer.json"]:::host
      Readme["README.md"]:::host
      Travis[".travis.yml"]:::host
      License["LICENSE"]:::host
    end
  end

  Database[(Database MySQL)]:::infra
  Elasticsearch[(Elasticsearch)]:::infra
  MessageBus[(Message Broker)]:::infra

  Payment["Payment Providers"]:::external
  Tax["Tax Services"]:::external

  subgraph "Yves Layer"
    direction TB
    Yves["HTTP Request"]:::host
  end

  subgraph "Zed Layer"
    direction TB
    Zed["Back-office Processes"]:::host
  end

  Yves -->|"calls Cart Facade"| CartComm
  Yves -->|"calls Product Facade"| ProdComm
  Zed --> CartComm
  Zed --> PriceComm
  Zed --> ProdComm
  Zed --> CataComm

  CataComm --> CataBus
  CataBus --> CataPers
  CataBus --> CataShared
  ProdComm --> ProdBus
  ProdBus --> ProdPers
  ProdBus --> ProdShared
  CartComm --> CartBus
  CartBus --> CartPers
  CartBus --> CartShared
  PriceComm --> PriceBus
  PriceBus --> PricePers
  PriceBus --> PriceShared

  CartBus -->|"CalculateTotal"| PriceBus
  PriceBus -->|"GetPrice"| ProdBus
  ProdBus -->|"GetDetails"| CataBus

  CataPers --> Database
  ProdPers --> Database
  CartPers --> Database
  PricePers --> Database

  CataBus -->|"Index/Search"| Elasticsearch
  ProdBus -->|"Index/Search"| Elasticsearch

  CartBus -->|"ProcessPayment"| Payment
  CartBus -->|"CalculateTax"| Tax

  click ComposerJson "https://github.com/spryker-feature/spryker-core-e-commerce/blob/master/composer.json"
  click Readme "https://github.com/spryker-feature/spryker-core-e-commerce/blob/master/README.md"
  click Travis "https://github.com/spryker-feature/spryker-core-e-commerce/blob/master/.travis.yml"
  click License "https://github.com/spryker-feature/spryker-core-e-commerce/tree/master/LICENSE"

  class CataComm,CataBus,CataPers,CataShared,ProdComm,ProdBus,ProdPers,ProdShared,CartComm,CartBus,CartPers,CartShared,PriceComm,PriceBus,PricePers,PriceShared feature
  class Database,Elasticsearch,MessageBus infra
  class Yves,Zed,ComposerJson,Readme,Travis,License host
  class Payment,Tax external
```
