Storefront Mode Setup

Run Scandi as an separate app

Summary

  • Ensure you have Node v12 or newer on your development machine

  • npx create-scandipwa-app my-app to create a new app

  • cd my-app to enter your app's directory

  • npm start to run the app

These commands will create a new Scandi app, start it up, and open it in your browser.

Creating a ScandiPWA App

You’ll need to have Node >= 12 on your local development machine (but it’s not required on the server). You can use n (macOS, Linux) or nvm-windows to switch Node versions between different projects.

To create a new app, you may choose one of the following methods:

NPX
NPM
Yarn
NPX
npx create-scandipwa-app my-app
NPM
npm init scandipwa-app my-app
Yarn
yarn create scandipwa-app my-app

Output

Running any of these commands will create a directory called my-app inside the current folder. Inside that directory, it will generate the initial project structure and install the transitive dependencies. More details:

Available Commands

Inside the newly created project, you can run some built-in commands:

npm start or yarn start

Runs the app in development mode. Will open the http://localhost:3000 to preview changes in your default browser. The page will automatically reload if you make changes to the code. You will see the build errors and lint warnings in the console.

npm run build or yarn build

Builds the app for production to the build folder. It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.Your app is ready to be deployed.

Connecting to a Magento server

By default, your new application will be fetching data from a remote store. If you want to use your own Magento instance, you can either create a new CMA (by following this guide) or set up a Magento instance manually. After that, you must configure it to include ScandiPWA-specific modules (as described here).

Configuring the Magento server

To use Magento 2 as a data source for ScandiPWA, you are required to make sure that it is using the correct Composer dependencies. The list of your application Composer dependencies can be found in your ScandiPWA application's composer.json file.

You can copy the dependencies defined in require field of your application's composer.json to your Magento server's root composer.json and execute the composer update command.