Algolia primer
Instant search that feels like magic — wire Algolia into your Meridian dashboard in under an hour.
What you'll build
A typeahead search bar that indexes your user-facing content — docs, products, or user profiles — and returns results in single-digit milliseconds. No backend search endpoints, no database full-text indexes.
Ingredients
- Algolia free tier account
- Your Meridian project with a data source
algoliasearchnpm package- One API route for the secured search key
Step 1 — Index your records
Push JSON objects to Algolia from a build script or webhook. Each record needs an objectID and the fields you want searchable. Keep payloads small — Algolia charges by record size and operation count.
Step 2 — Generate a secured API key
Never expose your admin key to the browser. Create an API route that returns a time-limited, index-restricted search key signed with your private API key. Pass it to the frontend on page load.
Step 3 — Wire the search UI
Instantiate the Algolia client with your app ID and the secured key. Attach it to an input. Debounce keystrokes by 150ms. Render hits in a dropdown positioned absolutely below the input. Highlight matching text with the built-in snippet engine.
Gotchas
- Secured keys are HMAC-signed — tampering invalidates them instantly.
- Free tier caps at 10k records and 10k search requests per month.
- Re-index on data change. Stale search results erode trust fast.