AI-Powered Search for Modern React Applications
Add AI-powered search to your Next.js app in minutes. Works with App Router, Server Components, and static export.
Building search in Next.js means choosing between client-only libraries that don't scale, or complex Elasticsearch setups that hurt performance.
Next.js has no built-in search solution. You're left building custom Elasticsearch setups or piecing together client-only libraries that don't scale.
Client-only search libraries cause hydration mismatches. Getting server-rendered search results with proper SEO requires complex workarounds.
Large datasets kill client-side search performance. Filtering thousands of records in the browser blocks the main thread and hurts Core Web Vitals.
Drop-in React components with full App Router, SSR, and TypeScript support. Built for the modern Next.js stack.
Works with React Server Components out of the box. No hydration issues, no use client directives needed for basic search.
getServerSideProps helpers and RSC-compatible APIs for SEO-critical pages. Pre-render search results at build or request time.
Full type definitions included. Autocomplete everywhere - from SearchProvider props to hit objects and filter types.
Works with React 18 streaming and Suspense boundaries. Show search skeleton while results stream from the edge.
Client-side search with CDN-cached indexes works perfectly with next export. No server required for search.
Lightweight SDK works on Vercel Edge Runtime and Cloudflare Workers. Sub-50ms search from the edge globally.
| Metric | Default Next.js | Algolia | SearchJet |
|---|---|---|---|
| Time to First Result | 1.5s+ | 200ms | <50ms |
| Typo Tolerance | None | Yes | AI-Powered |
| Monthly Cost (100K searches) | Free | $50/mo | Free |
| SSR / SEO Support | Manual | Partial | Full |
// app/search/page.tsx
import { SearchProvider, SearchBox, Hits, Highlight } from '@searchjet/react';
export default function SearchPage() {
return (
<SearchProvider
indexName="your_index"
searchApiKey="your_search_api_key"
>
<SearchBox placeholder="Search docs..." />
<Hits>
{({ hit }) => (
<article className="p-4 border-b">
<h3><Highlight attribute="title" hit={hit} /></h3>
<p><Highlight attribute="content" hit={hit} /></p>
</article>
)}
</Hits>
</SearchProvider>
);
}// pages/search.tsx
import { GetServerSideProps } from 'next';
import { SearchProvider, SearchBox, Hits, searchServerSide } from '@searchjet/react';
export const getServerSideProps: GetServerSideProps = async (context) => {
const { query } = context;
const searchResults = await searchServerSide({
indexName: 'your_index',
searchApiKey: 'your_search_api_key',
query: query.q as string,
hitsPerPage: 10,
});
return { props: { initialResults: searchResults } };
};
export default function SearchPage({ initialResults }) {
return (
<SearchProvider
indexName="your_index"
searchApiKey="your_search_api_key"
initialResults={initialResults}
>
<SearchBox placeholder="Search docs..." />
<Hits>
{({ hit }) => (
<article className="p-4 border-b">
<h3>{hit.title}</h3>
<p>{hit.content}</p>
</article>
)}
</Hits>
</SearchProvider>
);
}Need a complete starter project?
View GitHub Examples| Metric | Before | After | Impact |
|---|---|---|---|
| Setup Time | 2-3 weeks | 1-2 hours | 95% faster to launch |
| Bundle Size | 80KB+ (Algolia) | <12KB gzipped | 85% smaller |
| Search Speed | 200-400ms | <50ms | 4-8x faster |
| Monthly Costs | $100-500 (Algolia) | $0-29 | 95% savings |
Everything you need to know about SearchJet for Next.js
Join developers building exceptional search experiences with SearchJet
Already have an account? Log in