How to Install PWA Studio in Magento 2.4

How to Install PWA Studio in Magento 2.4

Magento has introduced PWA studio for Magento 2.3 and above versions.

Progressive Web Applications are designed to act like native applications for a fast user experience.

We cover the steps for installing PWA Studio in Magento 2.4

Best Magento Hosting now

Steps to Install PWA Studio in Magento 2.4

1. Install Magento 2.4 Using Composer

PWA Studio Installation Process

Complete guide to installing PWA Studio on your system in 7 simple steps

1

Check System Requirements

Ensure Node.js 14.x or higher, Yarn 1.22.18+, and Magento 2.4 are installed and compatible.

node --version && yarn --version
2

Install Magento 2.4 with Composer

Set up a fresh Magento 2.4 installation using Composer with proper configuration.

composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition magento2
3

Clone PWA Studio Repository

Get the latest PWA Studio source code and prepare for installation.

git clone https://github.com/magento/pwa-studio.git
4

Install Dependencies

Install all required packages and dependencies using Yarn package manager.

cd pwa-studio && yarn install
5

Create Project Configuration

Set up environment variables and configuration files for your project.

yarn create @magento/pwa
6

Build and Configure

Build the project and configure connection to your Magento backend.

yarn buildpack create-project ./my-pwa
7

Start Development Server

Launch the development server and begin building your PWA storefront.

cd my-pwa && yarn watch

SUCCESS: PWA Studio is now running on localhost

Installation Complete

PWA Studio is now installed and ready for development. Start building your progressive web app experience.

7
Steps Completed
30
Minutes Total
100%
Ready to Use

Composer allows you to manage all Magento 2 components and dependencies.

To install Magento 2.4 version, you may have to perform the following steps -

  • Check the prerequisites.
  • Install the webserver
  • Install PHP and other packages.
  • Configure Elasticsearch
  • Install MySQL
  • Generate Access Keys for Magento 2.4
  • Configure the webserver for Magento 2.4

You can get in-depth steps to install Magento 2.4.4 here -

After finishing the installation of Magento 2.4, you can continue the next steps.

2. Requirements to Set Up Venia PWA Storefront

System Requirements

Essential requirements for PWA Studio installation and optimal performance

REQUIRED

Node.js 14.x+

JavaScript runtime environment required for PWA Studio build processes and development server.

v14.18 minimum version
REQUIRED

Yarn 1.22.18+

Package manager for installing dependencies and managing workspace configurations efficiently.

v1.22.18 minimum version
BACKEND

Magento 2.4

E-commerce platform backend providing GraphQL API endpoints for storefront data and functionality.

v2.4.x compatible versions
RECOMMENDED

System Resources

Adequate CPU, memory, and disk space for smooth development experience and build processes.

4GB
RAM
2GHz
CPU
5GB
Storage

You have to fulfill the following requirements to install the Venia PWA storefront.

  • Yarn > Version 1.22.18
  • NodeJs > Version v14.x+
  • Functioning Magento 2.4 Setup

Installing Node.js

You can install Node.js with Apt and use NodeSource PPA. Use the following commands -

curl -fsSL https://deb.nodesource.com/setup_lts.x | bash -
apt-get install -y nodejs

Yarn Install

You can install Yarn using the npm package manager. Run the command shown below -

npm install --global yarn

Check nodejs and yarn version run the following commands -

nodejs -v
yarn -v

3. Steps to Install Venia Storefront

Venia Storefront Setup

Three essential steps to launch your PWA Studio Venia storefront

1

Clone PWA Studio

Get the complete PWA Studio repository with Venia storefront

git clone https://github.com/magento/pwa-studio.git
2

Install Dependencies

Install all required packages using Yarn package manager

cd pwa-studio && yarn install
3

Start Venia Development

Launch the Venia storefront development server

yarn watch:venia
✓

Venia storefront is ready for development

Your PWA Studio development environment is running on localhost:10000

Now that you have the prerequisites completed, you can install the Venia storefront.

  • Clone PWA-Studio Repository

Firstly, you have to clone the PWA-Studio repository in Magento 2.4 development environment.

You can perform the task with the following command.

git clone https://github.com/magento-research/pwa-studio.git
  • Install Project Dependencies

Run the following command in the Magento PWA root directory. It is used for PWA installation project dependencies.

yarn install
  • Get SSL Certificate

Now, we generate a secure SSL certificate for the Venia storefront. Use the command below to install the SSL certificate -

yarn buildpack create-custom-origin packages/venia-concept
  • Create & Update .env file in PWA

To create .env file, execute create-env-file subcommand with the CLI tool.

The subcommand will create packages/venia-concept/.env

We can now set the value for Magento 2 backend: MAGENTO_BACKEND_URL. Run the following command -

MAGENTO_BACKEND_URL="https://master-7rqtwti-mfwmkrjfqvbjk.us-4.magentosite.cloud/" yarn buildpack create-env-file packages/venia-concept

4. Start The Server

  • Build Artifacts

Use the command to generate build artifacts for the Venia storefront.

yarn run build
  • Run The Server

You can run the server in many ways. See the command options to run the server below-

yarn run watch:venia

The command shown above will start the Venia storefront development environment.

yarn run watch:all

The above commands will run the PWA developer experience. It will also run hot-reloading, and concurrent build pack rebuilds.

yarn run build && yarn run stage:venia

The command shown above will generate build artifacts and run the staging environment.

5. Setup Apache Reverse Proxy

To enable the mod_proxy module to setup reverse proxy, use the commands below -

sudo a2enmod proxy
sudo a2enmod proxy_http
<VirtualHost *:80>
    ProxyPreserveHost On

    ProxyPass / http://127.0.0.1:8080/
    ProxyPassReverse / http://127.0.0.1:8080/
</VirtualHost>

Restart the Apache webserver with the following command -

sudo systemctl restart apache2

Benefits of PWA Studio in Magento 2.4

PWA Studio Benefits

Measurable improvements in performance, user experience, and business metrics

Performance
3 x

Faster Page Loads

Significantly reduced loading times with optimized caching and service workers

Business
25 %

Higher Conversions

Improved user experience leads to better conversion rates and customer engagement

Mobile
50 %

Better Mobile UX

Native app-like experience with offline capabilities and smooth interactions

These improvements represent typical results from PWA Studio implementations, showcasing the power of progressive web app technology for modern e-commerce experiences.

Some of the primary benefits of Magento PWA include -

  • Enhance User Experience

PWA Studio will allow you to deliver an exceptional user experience on mobile devices.

For example, the UI has a full-screen mode and can hide the browser URL bar on top and the navigation tools below.

  • Increase Conversion Rates

PWA offers fast page loading and optimization on all devices. You also get offline support and push notifications.

It lets you create seamless purchase funnels and increase conversions.

  • Built-in SEO

Magento PWA has native SEO features to optimize the pages and rank high on search engines.

  • Low Cost

The PWA application works well on desktop and mobile devices. You save costs on building and maintaining additional native applications.

EndNote

Magento 2 PWA solution offers a reliable, fast, responsive user experience.

Installing the Magento PWA Studio project allows you to develop and maintain a PWA storefront on Magento 2.

You get modern tools and libraries to create a framework that works well with the Magento system.

The tutorial has covered step-by-step how to install PWA studio in Magento 2.

For more information on the Magento platform, check out MGT Commerce Tutorials.

Nikita S.
Nikita S.
Lead Technical Writer

As a lead technical writer, Nikita S. is experienced in crafting well-researched articles that simplify complex information and promote technical communication. She has expertise in cloud computing and holds a specialization in SEO and digital marketing.


Get the fastest Magento Hosting! Get Started