---
# System prepended metadata

title: Products Migration

---

# Products Migration

Migrate the products data from Shopify to Fabric services.

**Products Migration Contains Three Main Steps:**
1- Create attributes.
2- Create categories and assign the attributes to the categories items.
3- Create products with prices and inventories.

## Migration Setup
To ensure smooth migration please consider the following:

### Requirements:
You need to have [Node.js](https://nodejs.org/en/) installed on your device/server with version **14** or higher.

### Install The Dependencies
To run the scripts successfully you need to install the needed packages by running `npm install` in your terminal.

### Add The Environment Variables
You should add these environment variables in the `.env` file:
* FABRIC_CHANNEL
* FABRIC_STAGE
* FABRIC_SITE
* FABRIC_ACCOUNT
* FABRIC_SAND_URL
* FABRIC_PRICE_X_API_KEY
* FABRIC_INVENTORY_X_API_KEY
* FABRIC_CATEGORY_X_API_KEY

**Note:** You can get these variables from the Fabric team


### Add The Data Source
The data you want to migrate should be added in a JSON file named `brcc-full-catalog.json` and you should add it in this path `data/source/brcc-full-catalog.json`


## How to Migrate:
You need to run these scripts in the terminal in these order to migrate all the products data, each script should run individually and you will see logs in the terminal when the script is running and when the script finishes:
1- `npm run migrate-attributes`
2- `npm run migrate-categories`
3- `npm run migrate-product`

### Migration results
* The bad products logs will be stored in this path `data/abnormal-data`
* The logs of the scripts will be added to the `data/results-data` as following
    * `attributes-results.json` Contains all the created attributes results
    * `categories-results.json` Contains all the created categories results
    * `products-payload.json` Contains all the formated products, prices and inventories data that sent to the fabric.
    * `products-results.json` Contains all created products results
    *  `products-inventories-results.json` Contains all created inventories results
    *  `products-prices-results.json` Contains all created prices results