Razoyo reacts to Alan Kent's Headless Magento

January 9, 2017 by Paul Byrne

Magento 2

Alan Kent, Chief Architect of Magento, wrote an article on the trend towards ‘headless’ ecommerce development. I agree with the trend, but wanted to add my thoughts on extension development:

Extension developers need to think whether their extensions are suitable for supporting headless Magento deployments. Some extensions may simply not be suitable for that purpose.

Some extensions sit behind the scenes of Magento. If an extension only adjusts the Admin panel, then that extension may “just work” in headless scenarios. (Headless scenarios generally only make sense with the consumer experience – the cost of reworking the Admin panel would probably never be worth the investment.)

If an extension does affect the consumer experience but the extension developer wants to make the extension useful in headless environments, consider supporting a set of REST APIs in your extension. To maximize benefit, design the APIs to be friendly for both access from both JavaScript and from other applications. The benefit of the extension “just working” won’t be realized because it cannot plug itself automatically into the presentation tier, but providing a well-defined (and stable!) API will greatly reduce the effort for headless applications making use of that extension functionality. Remembering that headless applications will typically require more effort anyway, this is not such a burden.

My Thoughts

Would it not be possible to have extension developers add methods to the API that serve up the required injections to the front end (e.g., a JSON object that provides the appropriate endpoints, even the script tag) for the front end designer to work with? In addition, they could provide snippets or SDKs for various front-end languages (e.g., Angular 2 components or jQuery libraries)?

Of course, this requires more work on the part of the developer to adapt the code/SDKs, as you mentioned. However, many extension developers' tools are available on other ecommerce platforms, so, it may be worth the effort for them.

In addition, I’m not 100% convinced that headless development really requires that much more effort. It definitely requires a different tool set, but, at a certain point in Magento template development and theming, you can arrive at a level of customization where the Magento templates become more of a hindrance than help. Most Magento UI developers can tell you stories about fitting a square peg into a round hole to fulfill UI requirements. Also, Magento has to design for the broadest set of potential user requirements. A headless designer simply has to consider the site at hand. In addition, UI designers are not without tools and libraries of their own (bower, npm, etc.). Finally, Magento developers have to be familiar with the intricacies and particularities (and bugs) in Magento. Headless developers are using more of a standardized web development tool kit.

Just thoughts… would love your comments!

Subscribe to our newsletter for regular community updates, case studies, and more.