Skip to content

About

Universal JavaScript search library for SearchJetEngine instant search functionality across multiple platforms.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

SearchJet Connect

npm version license bundle size

Universal JavaScript search library for instant, AI-powered search across any website or app. Built for speed. Designed for developers. Free forever.

Powered by SearchJet Engine — the fastest way to add intelligent search to your website.


Quick Start

CDN (websites)

<script src="https://cdn.jsdelivr.net/gh/maidulcu/searchjet-connect@latest/dist/searchjet-connect.min.js"></script>

<div id="searchjet-container"></div>
<script>
  SearchJet.initAuto({ apiKey: 'your-key' });
</script>

NPM (apps)

npm install @searchjet/connect
import SearchJet from '@searchjet/connect';

const sj = new SearchJet({ apiKey: 'your-key' });
sj.init('#search-container');

Features

  • Instant Results — Sub-50ms search powered by SearchJet Engine
  • Typo Tolerant — AI-powered fuzzy matching handles misspellings
  • Zero Config — Drop in a script tag and one line of JS
  • Framework Agnostic — Works with React, Vue, Angular, Svelte, or vanilla JS
  • Customizable — Full control over templates, styling, and behavior
  • Lightweight — <10KB gzipped, no dependencies

Usage

Simple API

Auto-generated search UI with a single line:

const sj = new SearchJet({ apiKey: 'your-key' });
sj.init('#search-container');

Advanced API

Full control with composable widgets:

const sj = new SearchJet({ apiKey: 'your-key' });
const search = sj.instantSearch();

search.addWidget(
  SearchJet.widgets.searchBox({
    container: '#searchbox',
    placeholder: 'Search products...',
    debounce: 300
  })
);

search.addWidget(
  SearchJet.widgets.hits({
    container: '#hits',
    templates: {
      item: (hit) => `
        <div class="product">
          <img src="${hit.thumbnail}" alt="${hit.title}" />
          <h3>${hit.title}</h3>
          <p>${hit.excerpt}</p>
          <span class="price">${hit.currency}${hit.price}</span>
        </div>
      `
    }
  })
);

search.addWidget(
  SearchJet.widgets.pagination({
    container: '#pagination'
  })
);

search.start();

Static Methods

// Auto-initialize (finds #searchjet-container automatically)
SearchJet.initAuto({ apiKey: 'your-key' });

// Create instance manually
const sj = SearchJet.init({ apiKey: 'your-key' });
sj.init('#my-search');

// Shopify integration
const sj = SearchJet.forShopify({ apiKey: 'your-key' });

Widgets

searchBox

Option Type Default Description
container string | HTMLElement required CSS selector or DOM element
placeholder string 'Search...' Input placeholder text
autofocus boolean false Auto-focus on page load
searchAsYouType boolean true Search on each keystroke
showReset boolean true Show clear button
showSubmit boolean false Show submit button
debounce number 300 Debounce delay in ms

hits

Option Type Default Description
container string | HTMLElement required CSS selector or DOM element
templates.item function — Custom hit template
templates.empty function — Empty state template
transformItems function items => items Transform results before render

pagination

Option Type Default Description
container string | HTMLElement required CSS selector or DOM element
maxPages number 10 Max visible page buttons
showFirst boolean true Show first page button
showLast boolean true Show last page button
showPrevious boolean true Show previous button
showNext boolean true Show next button

API Reference

new SearchJet(config)

Option Type Default Description
apiKey string required Your SearchJet API key
baseUrl string 'https://app.searchjetengine.com/api' API endpoint
maxCacheSize number 100 Max cached search results

Instance Methods

  • init(container) — Mount auto-generated search UI to a container
  • instantSearch(config) — Create an InstantSearch instance for custom widget layouts

Static Methods

  • SearchJet.init(config) — Create and return a new SearchJet instance
  • SearchJet.initAuto(config) — Auto-find #searchjet-container and initialize
  • SearchJet.forShopify(config) — Create a Shopify-optimized instance

TypeScript

Full TypeScript definitions included. Works out of the box with VS Code, WebStorm, and other editors.

import SearchJet, { SearchJetConfig, InstantSearch, Widget } from '@searchjet/connect';

Browser Support

  • Chrome 60+
  • Firefox 55+
  • Safari 11+
  • Edge 79+

Development

git clone https://github.com/maidulcu/searchjet-connect.git
cd searchjet-connect
npm install

npm run build        # Build all formats (ESM, UMD, minified)
npm run dev          # Watch mode
npm test             # Run tests
npm run lint         # Lint source files

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feat/amazing-feature)
  3. Commit your changes (git commit -m 'feat: add amazing feature')
  4. Push to the branch (git push origin feat/amazing-feature)
  5. Open a Pull Request

License

MIT © SearchJet

About

Universal JavaScript search library for SearchJetEngine instant search functionality across multiple platforms.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages