SearchJetEngine
Astro Integration

Instant Search for Astro — Islands, Static & Edge Ready

AI-Powered Search for Static and Edge Sites

Add AI-powered search to Astro sites. Works with island hydration, static builds, and edge deployment.

Island Compatible
Static Export
Edge Ready
No Credit Card Required
Zero-JS by Default
Free Forever Plan
The Problem

Static Sites Need Search Too

Astro\'s zero-JS philosophy makes search tricky. You need something that respects static performance while delivering instant results.

Common Astro Pain Point

Algolia = Overkill for Static

Algolia pricing and complexity are designed for large apps. For a static Astro site, it's expensive overhead you don't need.

Common Astro Pain Point

Lunr.js = Client-Side Only + Slow

Lunr.js downloads the entire index to the client. Large content sites see multi-second load times with no typo tolerance.

Common Astro Pain Point

Custom Indexing = Complex

Build-time indexing requires complex scripts, and there's no real-time updates when content changes in your CMS.

The Solution

SearchJet + Astro

Drop-in search that respects Astro\'s island architecture. Hydrate only what you need, keep the rest static.

Island Architecture

Search hydrates only the search UI island. The rest of your page stays static with zero JavaScript.

Static Export Native

CDN-cached indexes + client-side search = zero server required. Works perfectly with astro build.

Edge Runtime

Deploys to Cloudflare Pages, Vercel Edge, and Netlify Edge. Sub-50ms search from the edge globally.

Content Collections

Auto-index .md and .mdx files from Astro content collections. No manual indexing scripts needed.

Framework Agnostic Core

@searchjet/connect works anywhere JavaScript runs. Use it in Astro islands, vanilla scripts, or any component.

Tiny Footprint

<10KB gzipped, only loads when the island hydrates. Your pages stay fast and lightweight.

Copy-Paste Integration

Two approaches — Astro island or content collection indexing

Astro Island Component with client:load

src/pages/search.astro
---
// src/pages/search.astro
import SearchIsland from '../components/SearchIsland.tsx';
import BaseLayout from '../layouts/BaseLayout.astro';

// Pre-fetch content for SSR (optional)
const allPosts = await Astro.glob('../content/blog/*.md');
---

<BaseLayout title="Search">
  <h1>Search Our Content</h1>

  {/* SearchJet hydrates as an island — rest stays static */}
  <SearchIsland
    client:load
    indexName="blog"
    searchApiKey="your_search_api_key"
  />
</BaseLayout>

Content Collection Indexing Script

scripts/index-content.ts
// src/components/SearchIsland.tsx
import { SearchProvider, SearchBox, Hits, Highlight } from '@searchjet/react';

export default function SearchIsland({ indexName, searchApiKey }) {
  return (
    <SearchProvider indexName={indexName} searchApiKey={searchApiKey}>
      <SearchBox placeholder="Search articles..." />
      <Hits>
        {({ hit }) => (
          <article class="p-4 border-b">
            <h3>
              <Highlight attribute="title" hit={hit} />
            </h3>
            <p>
              <Highlight attribute="description" hit={hit} />
            </p>
            <time>{hit.date}</time>
          </article>
        )}
      </Hits>
    </SearchProvider>
  );
}

// Content Collection Indexing Script
// scripts/index-content.ts
import { defineConfig } from 'astro/config';

async function indexContent() {
  const posts = await getCollection('blog');
  
  const documents = posts.map(post => ({
    objectID: post.slug,
    title: post.data.title,
    description: post.data.description,
    content: post.body,
    date: post.data.date.toISOString(),
    tags: post.data.tags || [],
  }));

  await searchjet.index(documents);
  console.log(`Indexed ${documents.length} posts`);
}

Need a complete starter project?

View GitHub Examples

Frequently Asked Questions

Everything you need to know about SearchJet for Astro

Does SearchJet work with Astro Islands?
Yes, SearchJet components work as interactive islands in Astro's partial hydration model. Only the search UI hydrates — the rest of the page stays static.
Can I use it with static output (SSG)?
Yes, client-side search with CDN-cached indexes works perfectly with static Astro builds. Zero server required.
Does it work with Astro SSR?
Yes, server-side search helpers are available for hybrid and SSR modes. Pre-fetch results on the server for SEO-critical pages.
Is there an Astro integration package?
Use @searchjet/astro wrapper or @searchjet/connect directly in framework-agnostic mode. Both work seamlessly with Astro.
How does it handle zero-JS by default?
SearchJet loads as an island — it only hydrates the search UI component. The rest of your Astro page remains completely static with no JavaScript.
Does it work with Astro DB / Content Collections?
Yes, you can index any content collection or Astro DB data. Use the indexing script to sync content to your search index.

Still have questions?

Contact our support team

Ready to Add Search to Your Astro Site?

Join developers building exceptional search experiences with SearchJet

Free Forever Plan
No Credit Card
5-Min Setup

Already have an account? Log in

Related Use Cases