ScandiPWA theme is capable of being bundled into the storefront.

Storefront - a stand-alone deployment of your e-commerce platform front-end. The storefront main goal is to display the data coming from e-commerce platform API. The storefront is not the data-source, rather data-presentation.

Creating a storefront build is simple. It works out-of-the-box with any application created using Create ScandiPWA App. All you need to do is to bundle it using the production build command.

Deploying the Storefront

The main challange of deploying ScandiPWA as a storefront is to properly configure the proxy to existing Magento 2 instance. This is automatically done in development, however in production, you must configure it yourself.

Using the CLI

To deploy an application to the FREE ScandiPWA static-hosting, you can use ScandiPWA CLI. In order to do it, simply type-in following command from your theme's root:

scandipwa deploy

This will return you a link to your instance and update the package.json file with the scandipwa.staticDeploy field. This field makes you application deployment persistent. Next time you run this command, the changes will be reflected on the same instance.

The application will proxy all requests to the Magento server you defined in the proxy field of your package.json.

Using the express server

This approach is a little-bit more complex. In order to do it you will need to install the express server and http-proxy-middleware as your theme's dependency. To do it, run:

npm i express http-proxy-middleware # for NPM
yarn add express http-proxy-middleware # for Yarn

Then create a new file server.js in the application root. Inside, paste following:

const express = require('express');
const path = require('path');
const { createProxyMiddleware } = require('http-proxy-middleware');

const app = express();

app.use(express.static(path.join(__dirname, 'build')));

app.use(['/graphql', '/media'], createProxyMiddleware({
    target: require('package.json').proxy,
    changeOrigin: true

app.get('/*', function (req, res) {
  res.sendFile(path.join(__dirname, 'build', 'index.html'));


Now, create a production build. Then, start the server:

node server.js

The application will proxy all requests to the Magento server you defined in the proxy field of your package.json.

Last updated