I want to know if there are some best practices to use Magento 2 as a headless E-commerce solution.
A typical E-commerce in 2017 is to have an omni-channel solution which includes
- E-commerce
- CMS
- Multiplatform
- Tier system integration (ERP, ...)
I want to know how involve Magento 2 API with this kind of solution.
My approach:
Use a different frontend framework (such as angular) for desktop/mobile webapp and mobile app
Only use Magento 2 API in order to retrieve or interact with E-commerce data/action
Only use CMS API in order to retrieve CMS data.
Pro: Only API's, omnichannel
Cons: Limitation for performance/features/formatting
Some questions for this approach :
- Who is responsible for formatting data, for example prices. Magento API and frontend framework?
- Who is responsible for resizing product images and cache them? Because in the native Magento 2 API there is no resize or cache system.
- Do I need to create new custom isolated API or extend native for future upgrade purpose?
- Do you recommend to use an extra layer in order to combine CMS and Magento API?
I appreciate you to share your return in experience.
Moreover, I found this approach: http://fbrnc.net/blog/2015/10/super-scaling-magento
Usefull links :
http://www.magetitans.it/headless-new-buzzword-magento-2-sander-mangel/
https://pantheon.io/blog/headless-websites-whats-big-deal-decoupled-architecture
https://creately.com/diagram/example-v2/ihbyjjkf/Example%20Headless%20Architecture
https://alankent.me/2016/12/14/headless-magento-and-extensions/
EDIT :
I found a good bootstrap in order to create your own cache logic for your Magento 2 API : https://github.com/magespecialist/m2-MSP_APIEnhancer
EDIT : A nice open source project in order to use Magento 2 as a headless E-commerce with VueJS PWA : https://github.com/DivanteLtd/vue-storefront
EDIT : The official Magento 2 PWA tools based on React : https://github.com/magento-research/pwa-studio