# 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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ergonode.com/apps2/detailed-reference/synchronization/data-flow.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
