# Data flow

## Synchronization start

This phase is optional based on [events](https://docs.ergonode.com/apps2/manifest#events) the App subscribes to.

Status: Preparing

## Data preparation

This is the internal phase.

Status: Preparing

Apps engine gathers the data required for the synchronization process.

{% hint style="info" %}
This process can take some time. Its length depends on the amount of data to process and the cache size needed to be built.

Most usually it'll be the longest on the first run of the synchronization and significantly shorter on the following one, even if it is the same full synchronization.
{% endhint %}

## Planning

This is the internal phase.

Status: Preparing

In this phase synchronization plan is created resulting in entries in the history created and put in `Planned` status.

## Attributes synchronization

This phase is optional based on [events](https://docs.ergonode.com/apps2/manifest#events) the App subscribes to.

Status: Execution

Firstly, as Attributes are the base of the Ergonode data model, their data is synchronized.

## Categories synchronization

This phase is optional based on [events](https://docs.ergonode.com/apps2/manifest#events) the App subscribes to.

Status: Execution

As a second Categories data is delivered to an App.

## Products synchronization

This phase is optional based on [events](https://docs.ergonode.com/apps2/manifest#events) the App subscribes to.

Status: Execution

As products utilize all of the previously synchronized resources they are the last ones to be sent.

## Products relations synchronization

This phase is optional based on [events](https://docs.ergonode.com/apps2/manifest#events) the App subscribes to.

Status: Execution

Lastly, relation data is being sent - variants, children assignment, and product relation attribute values.

This is to avoid circular reference problems where product A depends on B and B on A - all the products should exist in this phase already.

Relations payloads are always provided with `product_updated` events.

## Synchronization end

This phase is optional based on [events](https://docs.ergonode.com/apps2/manifest#events) the App subscribes to.

Status: Finished
