Skip to content
⚡️ A fully-featured and blazing-fast JavaScript API client to interact with Algolia.
TypeScript JavaScript Other
Branch: master
Clone or download

Latest commit

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci chore(tests): tests against node 14 (#1165) Jun 9, 2020
config chore: adds testing against lite build Jan 24, 2020
packages fix(requester-node-http): fix handling chunked responses fix #1161 (#… Jun 9, 2020
playground chore: adds testing against lite build Jan 24, 2020
scripts chore(release): small tweaks (#1144) Apr 21, 2020
specs chore: uses polyfills scripts specified on docs Jan 28, 2020
.editorconfig chore(lint): add linting (#766) Jul 1, 2019
.eslintignore chore: increase deps Jan 3, 2020
.eslintrc.js chore(eslint): us prettierrc for better editor integration Apr 21, 2020
.gitignore chore(gitignore): adds yarn error log Apr 16, 2020
.npmrc chore: adds npm token for secure publish Nov 28, 2019
.nvmrc chore(deps-and-node-lts): locks node lts and revert bump deps (#1140) Apr 17, 2020
.prettierrc chore(eslint): us prettierrc for better editor integration Apr 21, 2020
.travis.yml chore: adds empty travis config to get green status on required check Dec 3, 2019
CHANGELOG.md docs: update changelog Jun 9, 2020
CONTRIBUTING.md chore(release): small tweaks (#1144) Apr 21, 2020
LICENSE.md chore: adds license Dec 3, 2019
README.md chore: adds migration note on readme Feb 21, 2020
SECURITY.md chore: adds security.md Feb 21, 2020
api-extractor.json chore(release): small tweaks (#1144) Apr 21, 2020
global.d.ts chore: adds testing against lite build Jan 24, 2020
jest.config.js fix: header field x-algolia-user-id is not allowed by access-control-… Feb 21, 2020
lerna.json release: 4.2.0 Apr 21, 2020
package.json fix(requester-node-http): fix handling chunked responses fix #1161 (#… Jun 9, 2020
rollup.config.js chore: do not use cache on builds Jan 7, 2020
serve.json core: improves build process Oct 17, 2019
tsconfig.json chore: fixes tsconfig path algoliasearch entry point Jan 10, 2020
wdio.base.conf.js chore: improves integration tests Nov 27, 2019
wdio.local.conf.js chore(browser-testing): improves saucelabs config Sep 16, 2019
wdio.saucelabs.conf.js chore: improves specs tests Dec 19, 2019
yarn.lock fix(requester-node-http): fix handling chunked responses fix #1161 (#… Jun 9, 2020

README.md

Algolia for JavaScript

The perfect starting point to integrate Algolia within your JavaScript project

NPM version NPM downloads jsDelivr Downloads License

DocumentationInstantSearchCommunity ForumStack OverflowReport a bugSupport

Migration note from v3.x to v4.x

In February 2020, we released v4 of our JavaScript client. If you are using version 3.x of the client, read the migration guide to version 4.x. Version 3.x will no longer be under active development.

Features

  • Thin & minimal low-level HTTP client to interact with Algolia's API
  • Works both on the browser and node.js
  • UMD compatible, you can use it with any module loader
  • Built with TypeScript

💡 Getting Started

First, install Algolia JavaScript API Client via the npm package manager:

npm install algoliasearch

Then, create objects on your index:

const algoliasearch = require("algoliasearch");

const client = algoliasearch("YourApplicationID", "YourAdminAPIKey");
const index = client.initIndex("your_index_name");

const objects = [
  {
    objectID: 1,
    name: "Foo"
  }
];

index
  .saveObjects(objects)
  .then(({ objectIDs }) => {
    console.log(objectIDs);
  })
  .catch(err => {
    console.log(err);
  });

Finally, let's actually search using the search method:

index
  .search("Fo")
  .then(({ hits }) => {
    console.log(hits);
  })
  .catch(err => {
    console.log(err);
  });

For full documentation, visit the online documentation.

📄 License

Algolia JavaScript API Client is an open-sourced software licensed under the MIT license.

You can’t perform that action at this time.