Install
Install the optional @kelpclick/client JS SDK with npm, yarn, pnpm, or a CDN ESM script.
The JS SDK is optional. Magento, Liquid, PHP, and scripts can call the Kelp API with no npm. Use this page when you already have a JavaScript app, or when you want createKelpClient in a theme without a bundler.
You still need a tenant slug and a scoped API key from the tenant dashboard.
Package manager
npm install @kelpclick/client@latestReact 18 or later is a peer dependency, required only if you use the @kelpclick/client/react entry point. The core search and analytics modules have no React dependency.
CDN ESM
Load the SDK from a CDN when you want createKelpClient in a theme without a bundler:
<script type="module">
import { createKelpClient } from 'https://cdn.jsdelivr.net/npm/@kelpclick/client@latest/+esm';
const kelp = createKelpClient({
searchUrl: 'https://{TENANT_ID}-search.kelp.click',
analyticsUrl: 'https://{TENANT_ID}-events.kelp.click',
apiKey: 'kelp_...',
});
</script>Magento and Liquid storefronts can skip this and fetch the API instead.
Subpath exports
The package ships dual ESM and CJS builds with full TypeScript declarations and tree-shakeable subpath exports. Import only the capabilities your JS project needs.
| Import path | Contents |
|---|---|
@kelpclick/client | Everything - createKelpClient, createAnalytics, createIdentity, createKelpSearch, createKelpEmail, errors, types, VERSION. |
@kelpclick/client/search | createKelpSearch(config) - search and browse. |
@kelpclick/client/analytics | createAnalytics(options) and event taxonomy types. |
@kelpclick/client/email | createKelpEmail(options) - subscribe and unsubscribe. |
@kelpclick/client/react | KelpProvider, useSearch, useBrowse, and context hooks. |
// Root - re-exports everything
import { createKelpClient } from '@kelpclick/client';
// Capability subpaths - import only what you need
import { createKelpSearch } from '@kelpclick/client/search';
import { createAnalytics } from '@kelpclick/client/analytics';
import { createKelpEmail } from '@kelpclick/client/email';
import { KelpProvider, useSearch } from '@kelpclick/client/react';CommonJS
const { createKelpClient } = require('@kelpclick/client');Next steps
- Configuration - client options, retries, and observability
- SDK search -
search,browse, and the response shape - React hooks -
KelpProvider,useSearch, anduseBrowse - SDK API reference - functions and types
- Quick start - first search with curl and the SDK