Giter VIP home page Giter VIP logo

catalyst-algolia-guide's Introduction

How to Integrate Algolia SearchBox into Catalyst

Demo Site

https://catalyst-algolia.vercel.app/

Introduction

Developers can quickly integrate Algolia search into the BigCommerce frontend Catalyst to enable search across all products. This guide walks through the basic integration and provides files that can be copy and pasted into Catalyst CORE app.

Prerequisites

To complete the guide, you will need the following:

Requirements

  • Node.js 18+
  • npm (or pnpm/yarn)

Steps

  1. Set up and have a Catalyst storefront running - instructions available here
  2. Add the following Algolia keys, which you can find in your Algolia account, to the existing .env.local file in your Catalyst storefront repository. IF this is your first time using a new Algolia account, be sure to “regenerate” your Search Only API key before using it:
    • NEXT_PUBLIC_ALGOLIA_APP_ID=YOUR_APP_ID
    • NEXT_PUBLIC_ALGOLIA_API_KEY=YOUR_SEARCH_ONLY_API_KEY
  3. Install the following dependencies in your repository:
    • npm i react-instantsearch
    • npm i -S algoliasearch
  4. Add the files algoliaSearchBox.tsx and algoliaSearchHits.tsx to the quick-search component folder
  5. Update the code in index.tsx to use the code found here
  6. Update the algoliaClient in index.tsx to use your correct indexName. By default, the Algolia <> BigCommerce app names the index BigCommerce
  7. You can then delete the _actions directory so your file structure mirrors the screenshot below
Screenshot 2024-02-26 at 3 37 57 PM
  1. Run the app by running pnpm run dev, and check the QuickSearch box to see the data returned from Algolia

Resources

catalyst-algolia-guide's People

Contributors

gje4 avatar katiehoesley avatar

Watchers

 avatar

Forkers

slsriehl

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.