3 min. read
Categories: Technical
New Sylius API For Modern eCommerce Web Apps (SPA/PWA)
We have a really strong belief that the next-generation eCommerce platform is not the one with all possible features, but the one that integrates with the best tools in the category. Read our latest blog post and find out why Sylius ShopApiPlugin is our another step in the direction of modern eCommerce projects with separate frontend applications.
New Sylius API For Modern eCommerce Web Apps (SPA/PWA)

Fellow Sylius developers, please welcome ShopApiPlugin – an API based shop implementation which will make any integration with front-end framework much easier. And it is one of the first official plugins for Sylius that can serve as an example of our extendability.

Apart from the stable release, recently we have been working on one of the most exciting additions to Sylius core platform. And I couldn’t be more happy to finally share this with the Community and improve based on your feedback.

With the ShopApiPlugin, Sylius provides a new way of building eCommerce apps. It doesn’t matter if it is a mobile app, PWA (Progressive Web App) or just a simple Angular/React/VUE.js based website – it’s never been easier.

If you are working on a project or starting a new one with the “classic” Symfony & Twig approach, don’t worry. This new plugin is just one more way to build modern apps and we are still exploring this.

Why API based approach is the next big thing for building eCommerce websites?

Our recent projects, questions raised on our Slack channels or even the discussions we’ve been part of at various meetups and conferences – all this tells us that we are going in the right direction. **Modern & easy to integrate eCommerce platform with powerful APIs is the future. **

Feature requirements of modern eCommerce websites are constantly growing and it is impossible to satisfy all of them in a single platform. It is much more effective to integrate with the best technologies in category. For example, Akeneo provides an excellent PIM solution. Drupal, eZ or Contentful are all great and fully functional CMSes. Whole companies stand behind these projects and they are very good at what they do. We are the best at handling eCommerce and building developer tools. Let’s integrate all these instead of reinventing the wheel!

What’s inside of the Sylius ShopApiPlugin?

We have used the CQS pattern instead of CRUD and handle our logic with command bus. This solution will make it easy to understand and extend. Do you need custom logic? Just override the CommandHandler. The command doesn’t have enough information? You can override the whole controller. But it’s also not a problem because our controllers are mostly less than 100 lines long. Internally we are using same Sylius objects and state machine so nothing changes from the internals perspective. The API shop interface works exactly the same as our standard, Twig-based shop UI.

It is also important to mention about view handling. Each time you would like to query a database to retrieve the data it will go through a set of factories which will build a frontend-developer friendly output. No need to implement too much business logic inside of your front app. Responses will contain calculated prices and translated fields to make its as easy as it is possible to integrate this data into your app.

Let’s have a look at some example requests & responses:

Add To Cart

Adding to the cart is as easy as sending a simple POST request:

POST /shop-api/carts/X4325DASD/items/

    "productCode": "sylius_tshirt",
    "quantity": 3,
    "options": {
        "tshirt_size": "tshirt_size_s",
        "tshirt_color": "tshirt_color_black"

Getting a Single Product

You can get a detailed product information via its slug:

GET /shop-api/products/logan-mug/

  "code": "LOGAN_MUG_CODE",
  "name": "Logan Mug",
  "slug": "logan-mug",
  "averageRating": 4.5,
  "taxons": {
    "main": "MAIN_TAXON_CODE",
    "others": [


Did I mention, that it is totally fine to run ShopApiPlugin with ShopBundle in parallel?

Frontend Developers – We Need Your Help!

This blog post is not only an overview of ShopApiPlugin. It is also a request for help. We are very grateful of our community. Without you, we couldn’t be in the place that we are right now. But with ShopApiPlugin we need you one more time. Your feedback about how does it work for you or what should be improved is invaluable. PRs are also more than welcome. So please, help us redefine how eCommerce applications are built. Especially if you are a frontend developer.

If you wonder how does ShopApiPlugin really look like you can check the project’s README and API endpoints documentation.

Keep in mind that unless you are an experienced frontend developer and have built PWA/SPA apps before, the standard Sylius setup is still the recommended way to develop your projects. The plugin will evolve and we are considering introducing GraphQL API variant in the future.


We have a really strong belief that the next-generation eCommerce platform will not be the one with all possible features, but the one that integrates with the best tools in category. And SyliusShopApi plugin is a big step in this direction.

Łukasz Chruściel
Łukasz is currently solely focused on development of Sylius products. His main area of interests are solving development problems and increasing knowledge of less experienced fellow software engineers. He is cooperating with our Product Owner in terms of technical features. You may spot him on Github, answering your issues and reviewing your PR’s.
More from our blog
Business News Technical 3 min read 28.09.2020
Get ready for global sales & operations with the most advanced payment solution from the famous fintech giant, now available in Sylius out of the box. Read More
Business News 3 min read 14.09.2020
We proudly present to you the latest version of the Sylius eCommerce Platform – 1.8, which comes with a brand new, unified API powered by API Platform, Loyalty points system for Sylius Plus, and as you can probably see, a brand new sylius.com website! Numbers This new release is a… Read More
Business Ecosystem News 3 min read 13.08.2020
Read why the French market leader trusted Sylius in a strategic re-platforming process to get a competitive eCommerce advantage. Read More