What is an application architecture?

An application architecture describes the patterns and techniques used to design and build an application. The architecture gives you a roadmap and best practices to follow when building an application so that you end up with a well-structured app.

What architecture is ScandiPWA built on top of?

It also shares other important features in the architecture patterns:

Untitled

What are the advantages of CSR and SPA?

In a conventional Magento, all of the pages are generated on the server. This means that the client needs to fetch the entire page every time the user clicks on a link, and even with caching enabled, the pages need to be fully re-generated whenever part of the relevant data is modified. Not only does this make Magento resource-hungry, but it results in slow load time.

Instead of rendering the pages on the server and fetching them every time, ScandiPWA only fetches the data from the server, and performs the rendering on the client-side, using React. The page is never actually reloaded - once the app’s JavaScript code has been loaded, the front-end magic happens without any help from a server. This provides several advantages:

How does ScandiPWA work?

First, review a schema that depicts the complete architecture of ScandiPWA:

Untitled

They can be grouped by:

How is the UI and business logic designed?

With orange, the path to a rendered React component is marked. Along the way, starting from React(What is React?), we encounter the initialization of Redux Provider(What is Redux provider?) and React Router (What is React Router?). There are a few other players in the orange line:

How to work with components?

<aside> ➡️ The Router component is responsible for what is rendered on a page.

How to work with Routes?

</aside>

What is the data flow of the application?

The data in the ScandiPWA application is always coming from the GraphQL API. There are two important players who help to construct this flow:

How to work with requests?

<aside> ⚠️ To make requests in ScandiPWA, it is necessary to have a valid query/mutation defined in Magento to return the necessary data.

How to work with Resolvers?

</aside>

Requests are generally made from Logic Container (What is Logic Container?) or Action Dispatchers (What are action dispatchers?).

How is the global state managed?

Updating or accessing a state, regardless of its location, can be as simple as calling a function. ScandiPWA uses Redux to make this possible.

How to Work with Redux?

Redux introduces:

ScandiPWA also uses dispatcher functions. Dispatchers are used when the data necessary to update the state is not available.

Untitled

The Redux state can be updated using either a dispatcher function or by dispatching an action directly. The method you choose depends on the specific update you want to perform:

<aside> ⚠️ Dispatch an action and dispatcher functions are different things!

</aside>

consolidating proxy logic