The perfect starting point to integrate Flapjack within your JavaScript project
Documentation • InstantSearch • Community Forum • Stack Overflow • Report a bug • Support
- Thin & minimal low-level HTTP client to interact with Flapjack's API
- Works both on the browser and node.js
- UMD and ESM compatible, you can use it with any module loader
- Built with TypeScript
To get started, you first need to install flapjack-search (or any other available API client package). All of our clients comes with type definition, and are available for both browser and node environments.
yarn add flapjack-search@0.1.0-beta.1
# or
npm install flapjack-search@0.1.0-beta.1
# or
pnpm add flapjack-search@0.1.0-beta.1Add the following JavaScript snippet to the of your website:
<script src="https://cdn.jsdelivr.net/npm/flapjack-search@0.1.0-beta.1/dist/flapjack-search.umd.js"></script>You can now import the Flapjack API client in your project and play with it.
import { flapjackSearch } from 'flapjack-search';
const client = flapjackSearch('YOUR_APP_ID', 'YOUR_API_KEY');const client = flapjackSearch('my-app', 'my-api-key', {
hosts: [{ url: 'search.example.com', protocol: 'https', accept: 'readWrite' }],
});Flapjack Search works with the entire Algolia InstantSearch ecosystem — no widget changes needed:
import { flapjackSearch } from 'flapjack-search';
import instantsearch from 'instantsearch.js';
import { searchBox, hits } from 'instantsearch.js/es/widgets';
const search = instantsearch({
searchClient: flapjackSearch('APP_ID', 'API_KEY'),
indexName: 'products',
});
search.addWidgets([searchBox({ container: '#search' }), hits({ container: '#hits' })]);
search.start();Works with React InstantSearch, Vue InstantSearch, and Autocomplete.js too. See the migration guide for details.
Switching takes about 5 minutes:
npm uninstall algoliasearch && npm install flapjack-search@0.1.0-beta.1- Replace
import algoliasearch from 'algoliasearch'withimport { flapjackSearch } from 'flapjack-search' - Replace
algoliasearch(withflapjackSearch( - Done — all methods, types, and widgets work identically.
Encountering an issue? Open a GitHub issue and we'll help.
The Flapjack JavaScript API Client is an open-sourced software licensed under the MIT license.