Skip to main content
Install InstantSearch.js with a packaging system, with a direct link in your web page, or with create-instantsearch-app.

With a packaging system

If you have a JavaScript build tool, you can install InstantSearch.js from npm:
Command line
npm install algoliasearch instantsearch.js
Then in your module, you can load the main package:
JavaScript
// Import InstantSearch.js
import { liteClient as algoliasearch } from "algoliasearch/lite";
import instantsearch from "instantsearch.js";
import { searchBox, hits } from "instantsearch.js/es/widgets";

const appID = "ALGOLIA_APPLICATION_ID";
const apiKey = "ALGOLIA_SEARCH_API_KEY";
const indexName = "INDEX_NAME";

const searchClient = algoliasearch(appID, apiKey);

const search = instantsearch({
  indexName,
  searchClient,
});

search.addWidgets([
  searchBox({
    container: "#searchbox",
  }),

  hits({
    container: "#hits",
  }),
]);

search.start();
instantsearch is the root InstantSearch.js component. All widgets must be wrapped within it
In a production environment, secure your API keys as environment variables.

Directly in your page

This method uses the version of InstantSearch.js from the jsDelivr CDN:
HTML
<script
  src="https://cdn.jsdelivr.net/npm/algoliasearch@5.51.0/dist/lite/builds/browser.umd.js"
  integrity="sha256-5uMZHdsgIy7S9OzfkqgvwxG7pO3UgUV8/jQGtfIPtIw="
  crossorigin="anonymous"
></script>
HTML
<script src="https://cdn.jsdelivr.net/npm/instantsearch.js@4.94.0/dist/instantsearch.production.min.js" integrity="sha256-wvORgo7tXIBVWlhNLuxufAi2a45iYjesc5X0ihBDiSM=" crossorigin="anonymous"></script>
You then have access to the instantsearch function in the global scope (window).
JavaScript
const { liteClient: algoliasearch } = window["algoliasearch/lite"];

const appID = "ALGOLIA_APPLICATION_ID";
const apiKey = "ALGOLIA_SEARCH_API_KEY";
const indexName = "INDEX_NAME";

const searchClient = algoliasearch(appID, apiKey);

const search = instantsearch({
  indexName,
  searchClient,
});

search.addWidgets([
  instantsearch.widgets.searchBox({
    container: "#searchbox",
  }),

  instantsearch.widgets.hits({
    container: "#hits",
  }),
]);

search.start();
instantsearch is the root InstantSearch.js component. All widgets must be wrapped within it.
In a production environment, secure your API keys as environment variables.

Load the styles

You need to manually load the companion CSS file into your page:
HTML
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/instantsearch.css@8.14.0/themes/reset-min.css" integrity="sha256-EAl77ze7n/MVq89CL+u8J/V6Pc2cBqWpNNkoB+H3i6Y=" crossorigin="anonymous">
Or you can load the satellite theme widget styles into your page.
HTML
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/instantsearch.css@8.14.0/themes/satellite-min.css" integrity="sha256-BiAmiJrZAfGNoql3SglCEi+cgJLZlrFwp/5aZ/HO7og=" crossorigin="anonymous">
You can customize the themes using CSS variables. For a complete reference of customization options, see Styling and theming.

With create-instantsearch-app

Use create-instantsearch-app to create a working InstantSearch app. Similar to other interactive command-line apps, run it with npm or yarn:
npx create-instantsearch-app@latest 'getting-started'
To launch the app, type inside your terminal:
Command line
cd getting-started
npm start # or yarn start

Send click and conversion events

Capturing real-time user interactions as events gives you actionable insights with click and conversion metrics, and they help you increase your customer engagement and conversions. Events are used to activate Algolia features and products like NeuralSearch, Dynamic Re-Ranking, Query Categorization, Recommend, and Personalization. To send click and conversion events when users interact with your search UI, set the insights option to true.

Browser support

Algolia supports the last two versions of the major browsers: Chrome, Edge, Firefox, Safari. To support Internet Explorer 11 you need polyfills for: Array.prototype.find, Array.prototype.includes, Promise, Object.entries, and Object.assign.
The code samples in this documentation use a JavaScript syntax that isn’t natively supported by older browsers like Internet Explorer 11. If your site needs to support older browsers, use a tool like Babel to make your code work in the browsers you target.
Last modified on April 23, 2026