From the back end
Node.js / React Native / Browserify / Webpack
npm install algoliasearch --save
For TypeScript typings, we provide the definition file via Typings:
npm install --save @types/algoliasearch
bower install algoliasearch -S
From the front end
You can either use a package manager like
npm or include a
script tag using CDNs
To include the latest releases and all upcoming features and patches, use this:
We recommend using
algoliasearch is also available at:
We recommend using jsDelivr only for prototyping, not for production applications. Whenever possible, you should host your assets yourself or use a premium CDN service. jsDelivr is a free service and isn’t operated by Algolia, so we won’t be able to provide support if it fails.
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:
The backend (Node.js) API can be used to index your data using your Algolia admin API keys.
When not using any module loader, it will export an
algoliasearch function in the
To begin, you will need to initialize the client. In order to do this you will need your Application ID and API Key. You can find both on your Algolia account.
// var algoliasearch = require('algoliasearch'); // var algoliasearch = require('algoliasearch/reactnative'); // var algoliasearch = require('algoliasearch/lite'); // import * as algoliasearch from 'algoliasearch'; // When using TypeScript // or just use algoliasearch if you are using a <script> tag // if you are using AMD module loader, algoliasearch will not be defined in window, // but in the AMD modules of the page var client = algoliasearch('YourApplicationID', 'YourAPIKey'); var index = client.initIndex('your_index_name');
You need to replace
your_index_name by the name of the index you want to use. If you want to target an existing index you can find the name from the dashboard. If the index does not exist you can choose any name and it will be created when you perform an add objects or a set settings operation.
If an api key is displayed in the previous snippet it is your ADMIN API Key. To maintain security, never use your ADMIN API Key on your frontend or share it with anyone. In your frontend, use the SEARCH ONLY API Key or any other key that has search only rights.
Make sure you don’t use any sensitive or personally identifiable information (PII) as your index name, including customer names, user IDs, or email addresses. Index names appear in network requests and should be considered publicly available.
Did you find this page helpful?
We're always looking for advice to help improve our documentation!
Please let us know what's working (or what's not!).
We're constantly iterating thanks to the feedback we receive.