@particular./import-moltin-to-algolia

1.1.8 • Public • Published

@particular./import-moltin-to-algolia

npm version semantic-release code style: prettier CircleCI

Import Moltin data to Algolia

This example demonstrates how you can import products, brands, categories, collections, orders and/or customers to Algolia from Moltin through a Command Line Interface (CLI).

How to use locally

When running this example locally you'll want to be careful not to exceed you Algolia limits for catalog size.

1. Download the example

Clone the repository:

git clone git@github.com:uniquelyparticular/import-moltin-to-algolia.git

Install dependencies with Yarn (or NPM)

cd import-moltin-to-algolia
yarn

2. Configure Algolia

In this example we will import data to Algolia. You will need an account an account to continue.

Once you've signed up to Algolia, create a new app and give it a name.

Next head to the API keys section and make a note of your Application ID and Admin API Key, we will need these next.

3. Configure your ENV variables

You will want to create an .env inside the directory /import-moltin-to-algolia containing all the keys for the below:

MOLTIN_CLIENT_ID=
MOLTIN_CLIENT_SECRET=
MOLTIN_AGOLIA_INDICES=
ALGOLIA_APP_ID=
ALGOLIA_API_KEY=

MOLTIN_AGOLIA_INDICES is optional as they can also be passed and/or overriden on the command line but it is used to restrict which Moltin objects to generate Algolia indices for (ie. products,brands,categories,collections,orders,customers).

MOLTIN_CLIENT_ID and MOLTIN_CLIENT_SECRET are available in your Moltin Dashboard.

4. Run the application

NOTE: make sure that you've installed the dependencies in Step 1.

Ensure that the executable has proper permissions to run from the command line.

chmod +x ./bin/moltin-to-algolia

Execute the import command to import ALL of your products, brands, categories, collections, orders and customers into Algolia

NOTE: you can also run the import command with any subset of those entities to limit what is imported

Full import (run the following command):

./bin/moltin-to-algolia import

Partial import (run the following command specifying a comma seperated list w/o spaces of entities to index):

./bin/moltin-to-algolia import products,brands

NOTE: available entities to import: products,brands,categories,collections,orders,customers

5. Check your app in Algolia

Go to the app you've set up in Algolia's Dashboard (https://www.algolia.com/apps/[ALGOLIA_APP_ID]) and check the new indexes created. There should be one index created for each entity type imported.

You can then configure any specific Configuration data for that Index in Algolia to help further optimize search.

NOTE: it is reccomended that you adjust the Searchable Attribute Configuration for each index to only seach on specific fields.

That's it...have fun and take a look at Alogolia's InstantSearch from here to build an amazing front end for your indices!

6. Set up automated ongoing index updates from Moltin to Algolia

There is separate repository/package you can use to set up automated ongoing index updates from Moltin to Algolia using Moltin's Observable WebHooks and is fully compatible with the indices generated above. To set up the webhooks to automate create/update/delete entries in your index, please follow the instructions at the following:

https://github.com/uniquelyparticular/sync-moltin-to-algolia

Contact Adam Grohs @ Particular. for any questions.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.1.8
    1
    • latest

Version History

Package Sidebar

Install

npm i @particular./import-moltin-to-algolia

Weekly Downloads

1

Version

1.1.8

License

MIT

Unpacked Size

14.2 kB

Total Files

16

Last publish

Collaborators

  • agrohs