Spryker Directory Structure Explained: Complete Guide to Root Files, Folders, and Layers

Spryker is a modular commerce framework designed for complex B2B/B2C use cases. Its file structure may seem daunting at first, but each folder serves a specific purpose in the development lifecycle.

This guide explains the entire root directory and gives you clarity on where and how to write your custom logic.

Root Folder Structure Overview

project-root/
├── config/
├── data/
├── docker/
├── frontend/
├── public/
├── src/
│ └── Pyz/
│ ├── Zed/
│ ├── Yves/
│ ├── Shared/
│ ├── Client/
│ └── Glue/
├── tests/
├── vendor/
├── deployment/
├── composer.json
├── package.json
└── ...

/src/ – Application Source Code

This is where all application code lives. Inside /src/, you’ll mostly work with the /Pyz/ directory for your custom modules. Spryker follows a modular + layered structure here.

/Pyz/Zed/

  • What it is: Backend logic for business rules, data processing, persistence (DB).
  • Examples: Order management, product import, custom forms.
  • Common components: Business, Communication, Persistence layers.

Zed = Admin + Backend Logic.

/Pyz/Yves/

  • What it is: Frontend (storefront) application, Twig templates, controllers, and JS integration.
  • Used for: Rendering customer-facing pages like product lists, cart, checkout.
  • Common components: Controller, Page, Widget, Theme.

Yves = Frontend Storefront.

/Pyz/Client/

  • What it is: The bridge between frontend (Yves) and backend (Zed).
  • Used for:
    • Storing session-level data (e.g. cart, customer info)
    • Lightweight logic (e.g. data transformation, client-side caching)
    • Fetching data from Zed using ZedRequests

Common folders inside a Client module:

Client/
└── MyModule/
├── MyModuleDependencyProvider.php
├── MyModuleFactory.php
├── MyModuleClient.php
├── Zed/
│ └── MyModuleStub.php # ZedRequest bridge
└── ...

ZedRequest is used here to communicate from Yves/Client → Zed.

Client = Light logic + Zed communication for Yves.

/Pyz/Shared/

  • Purpose: Reusable code shared across Yves, Zed, Client, and Glue.
  • Contains:
    • Constants (used in configs)
    • Transfer objects (data contracts)
    • Helper classes

Shared = Common code + data models.

/Pyz/Glue/

  • Purpose: Glue API layer for building REST APIs.
  • Contains: Controllers, formatters, plugins for external API communication.

Glue = Headless API.

/config/

  • Used for: Environment-specific configuration.
  • Structure:
    • Shared/, Zed/, Yves/, Glue/
    • stores.php — Store-specific config
    • config_default.php — Default values for all environments

Keep DB creds, Redis, RabbitMQ configs, etc., here.

/vendor/

  • Contains: Spryker core modules (e.g., spryker/cart, spryker/product)
  • Managed by: composer.json
  • DO NOT MODIFY directly — override in /Pyz/

This is your framework’s engine.

/public/

  • Entry point for:
    • Yves/index.php → Storefront
    • Zed/index.php → Admin/Backoffice
  • Also holds: Assets like compiled CSS/JS, media

This folder is publicly exposed via the web server.

/docker/

  • Purpose: Contains the full Docker setup.
  • Includes:
    • Services: MySQL, Redis, RabbitMQ, Jenkins, etc.
    • docker-compose.yml
    • Environment templates (.env)

Used for local dev and CI.

/frontend/ (Optional but common)

  • Contains: SCSS, JavaScript, templates for Zed and Yves
  • Built with: Webpack, Symfony Encore, NPM/Yarn

Raw frontend assets before they’re compiled and moved to /public.

/tests/

  • Contains: Unit, functional, and integration tests
  • Structure: Mirrors /src/Pyz/

Use to maintain test coverage of your modules.

/data/

  • Purpose: Temporary runtime storage
  • Examples: Cache, logs, Redis queues, Jenkins build data

This folder is usually excluded from version control.

/deployment/

  • Contains: Deployment scripts and environment-specific files
  • Includes:
    • deploy.dev.yml
    • Jenkins pipeline files
    • Installation and CI configuration

For automation and infrastructure setup.

Root-Level Files

FileDescription
composer.jsonPHP dependencies and autoload rules
composer.lockExact versions of dependencies
package.jsonFrontend dependencies
webpack.config.jsWebpack build configuration
.gitignoreGit exclusion rules
.envLocal environment variables (if used)

Data Flow Summary

Here’s how data typically flows across layers:

Yves → Client → Zed → Database
↑ ↓
Cache Business Logic
  • Yves: Fetches data and renders UI
  • Client: Fetches from cache or calls Zed (via ZedRequest)
  • Zed: Executes business logic, interacts with DB
  • Shared: Supplies constants and transfer objects

Understanding Spryker’s root structure is your first step toward mastering the platform. Each folder has a well-defined purpose. At first glance, Spryker’s architecture may seem complex, but once you grasp the purpose of each folder, it becomes a powerful and flexible development environment. Keep this guide handy as you build and customize your Spryker projects.

Leave a Comment

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

Scroll to Top