Skip to content
SearchJet
Vanilla JS Site Search

Add Search to Any Static Site — No Framework Required

One CDN script tag. Zero build step. Zero backend. If you can write an <input>, you can ship search.

No build step
Free forever plan
Any static host

The CDN Experience, Live

This is the exact behaviour your static site gets from the script tag below.

Static Sites Deserve Good Search Too

One <script> tag

Drop the CDN script into any page. No npm, no bundler, no framework. Works on GitHub Pages, Netlify, WordPress, or a plain HTML file.

No key exposed, no CORS pain

Call through a tiny proxy route (or serverless function) and your API key never leaves the server. Same endpoint as the SDK.

Typo-tolerant & edge-cached

Sub-second, typo-tolerant results served from the CDN edge. Static sites get the same search UX as app stores.

Copy-Paste Code

One HTML File. That's the Whole Setup.

Pick the pattern you need — each snippet renders a working search UI out of the box.

https://your-static-site.devLive preview
Try:

The UI this snippet produces — search box + results list, plain DOM.

search.html
<!doctype html>
<html lang="en">
  <body>
    <input id="search" placeholder="Search this site…" />
    <ul id="results"></ul>

    <!-- 1. One CDN tag — the whole install -->
    <script src="https://cdn.searchjet.io/connect/v1/searchjet.min.js"></script>

    <script>
      const searchjet = new SearchJet({
        apiKey: '',
        indexName: 'YOUR_INDEX'
      });

      // 2. Render results — plain DOM, zero dependencies
      function renderResults(results) {
        const list = document.getElementById('results');
        list.innerHTML = results.length
          ? results.map(h => `<li><a href="${h.url}">${h.title}</a></li>`).join('')
          : '<li>No results — try another term</li>';
      }

      // 3. Search as the user types
      document.getElementById('search').addEventListener('input', async (e) => {
        const { results } = await searchjet.search(e.target.value);
        renderResults(results);
      });
    </script>
  </body>
</html>

Click YOUR_API_KEY in the code to generate your free key — it's injected instantly.

How It Works in 3 Steps

1

Add the script tag

Drop one CDN script into your page. No npm install, no bundler, no build step.

2

Initialize with your key

Create the SearchJet client with your free API key and index name — then search.

3

Render results

Build your own list UI with plain DOM, or drop in our drop-in search components.

Frequently Asked Questions

Can I add search to a plain HTML file?
Yes. Include the CDN script, create the SearchJet client, and wire an input listener. No framework or build tooling required — the code example below works in a single .html file.
Will I hit CORS errors calling the SearchJet API from the browser?
The SearchJet API allows browser requests with the public search key. For production sites we recommend proxying through a tiny route so the key stays server-side — the example below includes both approaches.
How do I debounce input without a library?
Use a setTimeout/clearTimeout wrapper (included below). It is about five lines of plain JavaScript.
Do I need a backend for vanilla JS search?
No. SearchJet hosts the search engine and index. Your static site only needs to make a fetch call. Most static hosts (GitHub Pages, Netlify, Cloudflare Pages) support serverless functions for key protection.
Does it support search-as-you-type?
Yes — combine the API with an input debounce and render suggestions on every keystroke, exactly like the demo on this page.
Does it work on GitHub Pages, Netlify, or Cloudflare Pages?
Yes. Search is just a CDN script plus a fetch call, so it works on any static host. For key protection you can add a tiny serverless function (all three platforms support them) using the proxy example above.
Is there a free plan for vanilla JS site search?
Yes — the free plan gives you 10,000 searches/month and up to 1,000 indexed pages with no credit card. Generate a free key right on this page in about a minute.

Search Your Static Site. Ship It Today.

Free forever plan — 10,000 searches/month, no credit card.

More Search Recipes