In today's competitive online market, a fast-loading e-commerce website is crucial for business success. One significant factor that impacts an e-commerce's performance is the Google PageSpeed score, which directly affects your website's search engine rankings.

Magento 2 PWA (Progressive Web App and headless Magento) theme Venia offers an excellent starting point for e-commerce businesses and a great user experience. However, the Google Pagespeed score in the theme is really bad, and it looks like it will take time before Magento fixes it. 

But don't worry, in this article; we will show a guide through increasing your Magento 2 official PWA Studio theme Venia's Google PageSpeed from 9 to above 90 scores using a third-party service called

Magento 2 PWA Venia theme pagespeed score before and after installing

Like most Magento PWA themes like Venia or scandipwa , Magento Venia  relies on JavaScript to deliver app-like functionality, dynamic content, and offline capabilities. While this can provide a better user experience, it will also increase the amount of JavaScript that needs to be parsed, compiled, and executed by the browser which leads to longer load times and a lower PageSpeed score.

For one of our clients the magento 2 venia theme pagespeed score looked like this before using



After we have installed our google page speed score went up to 91 without adding any new code in Magento 2 Venia theme:


To understand this more in detail we need to understand how work.

How does work? is a service designed to improve the performance and SEO of web applications (using best practices), particularly single-page applications (SPAs) and Progressive Web Apps (PWAs), by generating static HTML snapshots of dynamic content. It works by rendering the JavaScript-driven content server-side, allowing search engine crawlers and social media bots to access and index the content more efficiently. Here's a breakdown of how works:

Middleware Integration: To use, you need to install and configure the middleware on your server. The middleware intercepts incoming requests from search engine crawlers or social media bots, which often struggle with JavaScript-heavy content.

Server-side Rendering: When the middleware detects a request from a crawler or bot, it forwards the request to the service. then renders the dynamic content on its server using a headless browser, such as Google Chrome with the Puppeteer library or another compatible browser engine. This process creates a static HTML snapshot of the page's content, including all the elements generated by JavaScript.

Caching: Once the static HTML snapshot is generated, caches it for a configurable period. This ensures that subsequent requests for the same page are served faster, as the content is already pre-rendered and stored in the cache.

Serving the Snapshot: After rendering and caching the HTML snapshot, returns the static content to your server's middleware. The middleware then serves the pre-rendered HTML to the requesting crawler or bot, making it easier for them to access, parse, and index the content.

Recrawling and Cache Updates: regularly recrawls your website to update the cached content, ensuring that search engines and social media bots receive the most up-to-date information. You can also configure your cache settings and request manual recrawling when needed.

How do you install together with Magento 2 venia theme on a ubuntu server?

Configuring for a Magento PWA theme Venia on an Ubuntu server involves several steps. Here's a step-by-step guide to help you set it up:

  1. Install Node.js on Ubuntu server: middleware is built with Node.js, so you'll need to have Node.js installed on your server. You can install Node.js using the following commands:

curl -fsSL | sudo -E bash - sudo apt-get install -y nodejs

  1. Install middleware: You can either use the official middleware or a community-supported middleware for Magento. To install the official middleware, run:

npm install -g prerender

  1. Set up a reverse proxy: Configure your web server (e.g., Nginx or Apache) to act as a reverse proxy, forwarding requests to middleware when needed. Here's an example of how to configure Nginx:

location / { proxy_set_header X-Prerender-Token YOUR_PRERENDER_TOKEN; set $prerender 0; if ($http_user_agent ~* "googlebot|bingbot|yandex|baiduspider|twitterbot|facebookexternalhit|rogerbot|linkedinbot|embedly|quora link preview|showyoubot|outbrain|pinterest\/0\.|pinterestbot|slackbot|vkShare|W3C_Validator") { set $prerender 1; } if ($args ~ "_escaped_fragment_") { set $prerender 1; } if ($http_user_agent ~ "Prerender") { set $prerender 0; } if ($uri ~* "\.(js|css|xml|less|png|jpg|jpeg|gif|pdf|doc|txt|ico|rss|zip|mp3|rar|exe|wmv|doc|avi|ppt|mpg|mpeg|tif|wav|
mov|psd|ai|xls|mp4|m4a|swf|dat|dmg|iso|flv|m4v|torrent|ttf|woff|svg|eot)") { set $prerender 0; } if ($prerender = 1) { rewrite .* /$scheme://$host$request_uri? break; proxy_pass http://localhost:3000; } if ($prerender = 0) { proxy_pass @magento; } }

Replace your_prerender_token with your token. Adjust the proxy_pass directives to point to your Magento PWA and middleware.

  1. Start middleware: Run the following command to start the middleware:


By default, it will run on port 3000, but you can specify a different port using the --port flag.

  1. Configure account: Sign up for a account and add your website's URL. This will enable to crawl your website and generate static HTML pages.
  2. Test the configuration: To ensure that is working correctly with your Magento PWA theme Venia, access your website using a search engine crawler's user agent or using a tool like curl:

curl -A "Googlebot" -L

Check the output to verify that the static HTML content is being

Do you need help doing this or want help with any other Magento-related questions? We'd be happy to provide any assistance you need. Contact us anytime.


  • Magento

Share the post

29 November, 2023

After two+ years of experience with Go, there are some topics I'd like to share based on my practical knowledge.

In this article, you will learn what is gRPC-gateway, how it works, see real-life examples, and as bonus, we will…

24 October, 2023

You can have a great product and zero customers. 


In an interview for Amplifyre,…

23 October, 2023


In the vast and ever-evolving world of web development, Laravel has emerged as a framework that has gained immense popularity and enjoyment of use among developers. With its…

11 October, 2023

Exploring the Benefits and Challenges of Nearshoring

If you run a business, we are sure you are seeking ways to enhance operations while maintaining cost efficiency.

What are your options here?