Vue Storefront is rather a complex solution with a lot of possibilities. Learning all of them can take some time. In this article, I’ll try to explain all its crucial concepts in a few minutes to prove that it’s all you need to start playing with Vue Storefront.

What is Vue Storefront?

Vue Storefront logo

Vue Storefront is a headless and backend-agnostic eCommerce Progressive Web App written in Vue.js. The fact that it uses headless architecture allows Vue Storefront to be connected with any eCommerce platform, so it can be a frontend PWA for Magento, Shopify, BigCommerce, WooCommerce, etc.

It’s a very popular Open Source project with a strong and growing community.

Key features of Vue Storefront:

Here you can find Vue Storefront landing page and here is a GitHub repository.

How does Vue Storefront connect with backend platforms?

Vue Storefront manages to be platform agnostic thanks to the vue-storefront-api and dedicated API connectors for eCommerce backend platforms. The data format in vue-storefront-api is always the same for any platform, which means no matter which eCommerce backend you use, your frontend remains the same — without any changes.

It’s a great strategy for migrations since you can easily migrate from one platform to another (or from one version to another, e.g. Magento 1 -> 2) without touching your frontend.

strategy for migrations with Vue Storefront

The API connector works in two phases:

While managing these two phases of integration, Vue Storefront can work with your backend platform.

Some of the most popular backend platforms already have their integrations (Magento 2, Magento 1, CoreShop, BigCommerce, WooCommerce) but you can easily make your own with the integration boilerplate.

The blue parts on the diagram are responsible for offline cache and will be explained later in the article.

How does it work?

There are 3 concepts you need to be familiar with while working with Vue Storefront.

To summarize: your shop is basically a Vue storefront theme that uses features provided by modules. Vue Storefront core glues it all together.

Knowing these three concepts allows you to confidentially work with Vue Storefront and make your own shops.

Useful materials: Vue Storefront project structure.

Installing Vue Storefront

When you want to play with Vue Storefront there are three options:

Installing Vue Storefront
This is everything you need to have VS working with our demo backend.

To do any of this, simply type "yarn installer" in the root directory of the project and answer the questions in the console. Once the installation is done, type "yarn dev" to run your project (by default on port 3000). No matter what option you choose, you can change the settings in config file later.

Vue Storefront config file

Most of the Vue Storefront configuration (like the active theme, backend API addresses, multi store setup, etc.) is done through its config file which can be found under the "config" folder. The default.json file contains all the default setup.

For your own implementation, you should create a local.json file and include the fields from default.json that you want to override. These two files will be merged in favour of local.json during the build process. If you use the installer to set up your Vue Storefront instance, it’ll generate the proper config files.

Building themes in Vue Storefront

Building themes in Vue Storefront

While making themes in Vue Storefront in most cases, all you need to take care of is creating your own HTML and CSS markup. All the required business logic is exposed by the core with its core modules and can be easily injected into any of the theme components.

The mechanism of injecting core business logic into themes with Vue Storefront
The business logic from the core component can be easily injected into any theme component as a Vue.js mixin.

The mechanism of injecting core business logic into themes is very simple. We use Vue.js mixins to keep upgradable business logic in the core. So assuming we have a core Microcart component with business logic like this (left side), we can easily inject it into any of our theme components (right side) just by importing it and adding as a mixin mixins: [Microcart]. This is all you need to make use of core business logic inside your theme. With this approach, we can easily ship updates to all core components without breaking your shop.

The easiest way to create your own theme is to create a copy of the default one, change its name in its package.json file, change the active theme in config/local.json and run yarnto make Lerna linking (which we use for monorepos).

Offline mode and cache

Vue Storefront still works even while the user is offline. We managed to do this by making heavy use of the browser cache.

cached static assets
Here you can find cached static assets. Please notice that Service Worker works only in production mode.

We use some of the cached data even while the user is online, to display the content instantly. This is why Vue Storefront is so fast.

What else

You may not believe me but this is all you need to know to start working with Vue Storefront! After learning the basics just visit our docs and community slack to dig deeper into the project.

Useful links

Video with training

You can also watch a video recording from the 4th Vue Storefront hackathon with free introduction training:

https://www.youtube.com/watch?v=IL2HMtvf_hw&feature=emb_logo