DEV Community

Alex Spinov
Alex Spinov

Posted on

Algolia Has a Free API — Here's How to Build Instant Search in 5 Minutes

Remember the last time you used a search bar that actually worked? Lightning-fast results appearing as you typed, typo-tolerant, always relevant? That was probably Algolia.

A friend of mine spent 3 weeks building Elasticsearch for his e-commerce site. Then he discovered Algolia's free tier. He replaced everything in an afternoon.

What Algolia Offers for Free

Algolia's free tier includes:

  • 10,000 records and 10,000 search requests/month
  • Full-text search with typo tolerance
  • Faceted search and filtering
  • Analytics dashboard
  • InstantSearch UI libraries

Quick Start: Get Your API Key

# Sign up at algolia.com, then grab your keys from the dashboard
# You'll need: Application ID, Search-Only API Key, Admin API Key
Enter fullscreen mode Exit fullscreen mode

Index Your Data (Node.js)

const algoliasearch = require('algoliasearch');

const client = algoliasearch('YOUR_APP_ID', 'YOUR_ADMIN_API_KEY');
const index = client.initIndex('products');

const products = [
  { objectID: '1', name: 'Wireless Headphones', brand: 'Sony', price: 199 },
  { objectID: '2', name: 'Bluetooth Speaker', brand: 'JBL', price: 89 },
  { objectID: '3', name: 'Noise Cancelling Earbuds', brand: 'Bose', price: 279 },
];

index.saveObjects(products).then(({ objectIDs }) => {
  console.log(`Indexed ${objectIDs.length} products`);
});
Enter fullscreen mode Exit fullscreen mode

Search with Typo Tolerance

const searchClient = algoliasearch('YOUR_APP_ID', 'YOUR_SEARCH_API_KEY');
const index = searchClient.initIndex('products');

// Even 'wireles headphnes' finds 'Wireless Headphones'
index.search('wireles headphnes').then(({ hits }) => {
  console.log(hits);
});

// Faceted search
index.search('', {
  facetFilters: ['brand:Sony'],
  hitsPerPage: 10
}).then(({ hits }) => {
  console.log(hits);
});
Enter fullscreen mode Exit fullscreen mode

Build InstantSearch UI in React

import algoliasearch from 'algoliasearch/lite';
import { InstantSearch, SearchBox, Hits, RefinementList } from 'react-instantsearch';

const searchClient = algoliasearch('YOUR_APP_ID', 'YOUR_SEARCH_API_KEY');

function App() {
  return (
    <InstantSearch searchClient={searchClient} indexName="products">
      <SearchBox placeholder="Search products..." />
      <RefinementList attribute="brand" />
      <Hits hitComponent={Hit} />
    </InstantSearch>
  );
}

function Hit({ hit }) {
  return (
    <div>
      <h3>{hit.name}</h3>
      <p>{hit.brand} — ${hit.price}</p>
    </div>
  );
}
Enter fullscreen mode Exit fullscreen mode

Analytics Out of the Box

Algolia tracks:

  • Top searches — what users look for most
  • No-result searches — gaps in your data
  • Click-through rate — which results get clicked
  • Conversion rate — searches that lead to action

Access it all from the dashboard — no extra code needed.

When to Use Algolia vs. Build Your Own

Use Algolia Build Custom
Need search in < 1 day 100M+ records
E-commerce, docs, SaaS Complex NLP requirements
Want typo tolerance free Need full infrastructure control
Small-medium dataset Regulatory data residency

Real-World Use Cases

  • Documentation sites: Algolia DocSearch powers React, Vue, Stripe docs
  • E-commerce: Product search with facets, filters, price ranges
  • SaaS apps: In-app search across user data
  • Media sites: Article and content discovery

Need to scrape search results or product data at scale? Check out my web scraping tools on Apify — pre-built actors for Google, Amazon, Reddit and more. No coding required.

Building something custom? Email me at spinov001@gmail.com — I help companies set up data pipelines and search infrastructure.

Top comments (0)