Giter VIP home page Giter VIP logo

swellalgolia-lambda's Introduction

Swell (Ecommerce) / Algolia Integration

This Module is a deep integration with Swell and Algolia allowing you to rank, facet and replicate

This module deploys to AWS Lambda

alt text

alt text

Install

You'll need serverless to run this and a AWS account or other provider

npm install -g serverless

Config

set a .env file

SWELL_STORE_ID=***
SWELL_SECRET_KEY=***
ALGOLIA_INDEX=swell_products
ALGOLIA_APP_ID=***
ALGOLIA_ADMIN_API_KEY=***

Algolia Config

Update the Algolia config (algolia.config.json) to what you need for your project.

Field Description
defaultRanking The ranking of your default index ALGOLIA_INDEX
rankings The individual rankings for using sort, will create a seperate replica per ranking
searchableAttributes Algolia searchable Attributes
attributesForFaceting Algolia Facetable Attributes
{
  "defaultRanking": ["desc(name)"],
  "rankings": [
    {
      "suffix": "price_desc",
      "ranking": [
        "desc(price)"
      ]
    },
    {
      "suffix": "price_asc",
      "ranking": [
        "desc(price)"
      ]
    }
  ],
  "searchableAttributes": ["name"],
  "attributesForFaceting": ["attribute.brand", "categories"]
}

Quick Start

The commands below will deploy the serverless function to AWS then create the indexes

sls deploy
sls invoke --function init
sls invoke --function reindex

sls invoke --function init will create the replicas based on your algolia.config.json sls invoke --function reindex will pull all the products into Algolia

Install webhooks on Swell

Developer > Webhooks > Add Webhook

And create a webhook as so:

Screen Shot 2021-12-04 at 8 26 20 pm

Replace my-serverless-domain with your cloudfront, or route53 domain generated from serverless on deploy

Replace stage with your environment stage so something like dev or prod

swellalgolia-lambda's People

Contributors

achadee avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.