Deploying a React Store on Magento

Deliver a sub-second React website on Magento with Layer0

Created and developed by Facebook, React is one of the most popular open-source JavaScript libraries for building user interfaces or UI components quickly and easily, using a component-based approach. React offers great runtime performance and is fit to be the backbone of complex, revenue-generating websites with heavy traffic, such as eCommerce and Travel websites..

React offers some benefits compared to the other popular frontend frameworks out there, including:

  • Virtual DOM: Nodes are re-rendered only as needed. React compares new data to original DOM and updates the View automatically. This enhances the performance of all-sizes applications that need regular content updates.
  • One-way data binding: React uses one-way data binding with an application architecture called Flux controls. React helps update the View for the user and Flux controls the application workflow.
  • Support for bundling and tree-shaking: This helps minimize the end user’s resource load.
  • Built-in server-side rendering (SSR) support: SSR offers speed gains in specific implementations.

Magento 2 is a popular eCommerce platform based on PHP7 and supports HTML5, known for its rich, out-of-the-box features, third-party integrations, and customizations. In addition to its own proprietary frontend frameworks, the platform also supports multiple frameworks, including the Zend Framework 1 and 2 and MySQL Percona 5.6 or greater.

Key features which help performance include:

  • NGINX serves as a reverse proxy, HTTP cache, and load balancer.
  • Varnish is an HTTP accelerator built for content-heavy dynamic web pages, such as eCommerce websites on Magento 2.
  • Composer is a tool for dependency management in PHP which can allow you to reuse third-party libraries without bundling with source code and reduce extension conflicts.
  • Symfony is a PHP web application framework for controlling the content, functionality, and look and feel of your online store.
  • Redis is an open source, in-memory data structure store used as a database, cache and message broker.

While there are some promising features, including a built in caching module, the platform does little to help vendors in terms of site speed. In fact, the platform leaves most site speed optimization to its customers and their developers / implementors.

Regarding Magento 2's frontend compatibility, the platform offers a few proprietary frontends and robust APIs. Its frontends include: Base, Luma, and PWA Studio (available for M2.3 and up) and APIs include: REST, SOAP, and GraphQL. Please note that PWA Studio and GraphQL are both only supported on Magento 2.3 or later. Furthermore, PWA Studio is geared specifically toward the platform, so you remain locked into its ecosystem. You can connect your own portable frontend or headless endpoints to the platform via the GraphQL API, however, customization of  Magento's code and/or database schema can disrupt API compatibility.  

Layer0 lets you deliver React stores on Magento for sub-second speeds with every load. Although Magento 1 is no longer supported by the platform, it is still compatible with Layer0. The average website on Layer0 sees median page loads of 320ms, measured by Largest Contentful Paint (LCP). However, Layer0 is much more than a website accelerator. It is a Jamstack platform for eCommerce at scale. Layer0 makes websites faster for users and simpler for frontend developers to maintain. Built specifically for large-scale, database-driven websites (such as eCommerce and Travel), it brings the following benefits: 

  • Jamstack for eCommerce via both pre and just-in-time rendering
  • Zero latency networking via prefetching of data from your product catalog APIs
  • An edge that can be configured natively in your React app (CDN-as-JavaScript)
  • Edge rules that can run locally, in pre-production and production environments  
  • Automated, full-stack preview URLs from GitHub, GitLab, or Bitbucket with every new branch and push
  • Performant split tests at the edge and A/B tests that do not slow down the site, canary deploys, and personalization
  • Serverless JavaScript that is much easier and more reliable than AWS Lambda

With Layer0, your React Magento store will run in sub-second speeds and your developers will be empowered to control edge caching and reduce rework using the various developer productivity tools that come with the platform.

Check out AKIRA, a Magento website on Layer0. AKIRA went from 6 seconds to sub-second page loads and saw mobile transactions double on Layer0. Kate Spade, Planet Blue, and Shoe Carnival are more impressive examples, as these are React stores delivering sub-500ms page loads on Layer0.

Layer0 is also a contributor to React Storefront, an open source eCommerce framework which powers over billion dollars in eCommerce revenue a year. Check it out if you are looking to re-write your eCommerce site into a blazingly fast site. Or if you're currently using React for your frontend, use the this guide to deploy your React application on Layer0 and get sub-second loads in as little as 1 hour of work. 

Deploy in minutes

Moovweb XDN works with all frontends
Deploy freeTakes 2 minutes