Install the JavaScript API Client
From the back end
Node.js / React Native / Browserify / Webpack
We are Browserifyable and Webpack friendly:
1
npm install --save algoliasearch
TypeScript typings
The TypeScript typings are maintained by the community on DefinitelyTyped:
1
npm install --save-dev @types/algoliasearch
Bower
1
bower install algoliasearch -S
From the front end
You can either use a package manager like npm
or include a script
tag.
script
tag using CDNs
Recommended: jsDelivr
jsDelivr is a global CDN delivery for JavaScript libraries.
To include the latest releases and all upcoming features and patches, use this:
1
<script src="https://cdn.jsdelivr.net/algoliasearch/3/algoliasearch.min.js"></script>
Other CDNs
We recommend using jsDelivr
, but algoliasearch
is also available at:
jsDelivr is a third-party CDN. We are not able to provide support regarding third party services.
Search-only/lite client
We have a lightweight build available that can only perform searches. Use it when file size is important to you or if you want to include only what you need.
Find it on jsDelivr:
1
<script src="https://cdn.jsdelivr.net/algoliasearch/3/algoliasearchLite.min.js"></script>
Source on GitHub
All our API clients are open source and available on Github.
Language-specific notes
The JavaScript client works both on the frontend (browsers) or on the backend (Node.js) with the same API.
The backend (Node.js) API can be used to index your data using your Algolia admin API keys.
Our JavaScript library is UMD compatible, you can use it with any module loader.
When not using any module loader, it will export an algoliasearch
function in the window
object.
Our JavaScript snippets use the ES6 syntax. While most modern browsers natively support ES6, make sure you adapt your code so it properly works your end users’ environment. To transpile ES6 code into ES5, we recommend using Babel.