As an open-source platform, extensibility is key to a great developer experience and flexibility for the merchant. Not just on the frontend but also in our Administration area where the retailers and marketers add products and build their Shopping Experiences. This extensibility allows plugins to add functionality and developers to tailor Shopware to the client's needs.
There are however a few things we need to be mindful of in this push for extensibility. Keeping complexity down, ensuring maintainability and compatibility both between different integrations and platform versions. A good approach here is the open-closed principle - software entities should be open for extension, but closed for modification.
In the past, we have ensured that the administration of Shopware 6 can be extended at any time. Extensions were developed with the help of TwigJs blocks. In the meantime, we discovered better solutions that we would like to switch to in the future, allowing us better __scalability, stability, and fewer break__s. We want to take you on our journey to explore this cool new feature.
When you build an application as complex as a shop system, such blocks have the disadvantage that there are suddenly very many of them. In the case of the Shopware 6 Administration, more than 8000 TwigJs blocks were added. The sheer amount of blocks raises the problem of maintainability and hinders further development. Additionally, everything in the Administration is public API and therefore needs to consider breaks.
That's why we decided to try something new: new templates or template additions will not contain TwigJs blocks anymore, and every new bit of public code will become private. Existing functionality will not change, and all existing extensions will work as they did before.
Instead, we want to use the __administration __(Extension SDK) from now on, for extending the administration. The SDK is a Javascript NPM package that allows you, as a developer, to extend the administration interface and functionality, without modifying it at its core ensuring compatibility.
Why do we believe you’ll love this way of working?
- It works with both Shopware 6 Apps and Plugins.
- Easy to learn. the SDK abstracts away Shopware specific logic
- Extensible. Easily access functionalities such as notifications, add UI elements and access the context.
- Rely on a stable API that is backward compatible.
- It’s all written in TypeScript ensuring type safety and autocompletion in your favorite IDE.
- Lightweight. the whole library is completely tree-shakable and dependency-free
Is this the end of TwigJs and public code API? For now, this is an experiment. We want to see if Extension SDK in perspective can fully replace the mechanisms we used until now to extend the Administration in a field trial. Extension SDK should become the first choice to extend the Administration for internal and external features.
We’d love to get your feedback when you take it for a spin! Suggestions, missing functionality, or the occasional, ehm… unexpected “feature” is welcome! Talk with us via the issue tracker or head over to our Shopware Slack to talk to fellow community members about your experience.