Quick answer
Typesense is an open-source search engine that runs as one small server and forgives typos out of the box: a shopper who types "kurtah" still finds the kurta. You define a collection with a schema, index your documents over HTTP, and search with a single request that returns ranked hits in milliseconds. It fits a small shop or app that needs proper search without running a search cluster or paying a hosted service for every query.
A customer opens your shop site and types "kurtah" into the search box. Your database query uses LIKE, so it needs the exact letters in the exact order, and it returns nothing. They try "kurta" and get a list, but half your visitors have already left. The same happens with "shalwar" typed as "shalwaar" and "dupatta" typed as "dupata". A search box that only matches exact text quietly loses sales. The database is the wrong tool here: LIKE scans rows one by one, cannot rank by relevance, and has no idea that one wrong letter is still a match. That is the gap a search engine fills, and Typesense fills it with the smallest setup I have found.
What I would check before using it
My first check is whether search is a feature of the app or the whole product. Typesense is built for search as a feature: a shop catalogue, a docs site, a list of jobs. If search is the product itself, a bigger engine earns its complexity, and the Elasticsearch post covers that side.
My second check is who runs the server. Typesense ships as one binary with no dependencies, and the same command that starts it on a laptop starts it in production. The trade is that you own uptime, backups, and upgrades, or you pay for Typesense Cloud.
My third check is how the data changes. Typesense holds a copy of your searchable data, usually synced from the database that already holds it. That copy goes stale if nothing syncs it, so the app must update the index when a price changes or an item sells out. The products stay in the database, and the PostgreSQL post covers the store that usually holds them.
My fourth check is the comparison shoppers make. Algolia is the hosted service Typesense is most often measured against: polished, fully managed, billed by usage. Meilisearch is the closest open-source cousin, also a single binary with typo tolerance. My judgement: Typesense wins when you want self-hosting with the least fuss, Algolia wins when you want no server to think about.
My verdict, as judgement: adopt Typesense when a small or medium catalogue needs typo-tolerant search and you are happy to run one binary. The recommendation flips if you want no server to maintain, because a hosted service is the honest answer then, or if you need heavy analytics, where bigger engines earn their keep.
A Karachi clothing shop, from an empty server to a typo-proof search
The demo is a small Karachi clothing shop selling kurtas, shalwars, and dupattas, with prices in rupees. The search box must survive typos, because shoppers type fast on phones. Everything runs on one laptop: Typesense 30.2, a single binary, no Docker.
Download the Linux binary and check the version:
$ curl -O https://dl.typesense.org/releases/30.2/typesense-server-30.2-linux-amd64.tar.gz
$ tar -xzf typesense-server-30.2-linux-amd64.tar.gz
$ ./typesense-server --version
Typesense 30.2
Start the server with a data directory, an API key, and port 8108:
$ ./typesense-server --data-dir=data --api-key=xyz123 --listen-port=8108
$ curl -s http://localhost:8108/health
{"ok":true}
Now the first search, and it fails at once:
$ curl -s -i "http://localhost:8108/collections/products/documents/search?q=kurtah&query_by=name"
HTTP/1.1 401 Unauthorized
{"message": "Forbidden - a valid `x-typesense-api-key` header must be sent."}
Every request needs the X-TYPESENSE-API-KEY header, even a read, so the fix is to send the key. Next, create the products collection: a name, a category that can be faceted, a price in rupees, and an in-stock flag:
{
"name": "products",
"fields": [
{"name": "name", "type": "string"},
{"name": "category", "type": "string", "facet": true},
{"name": "price", "type": "int32"},
{"name": "in_stock", "type": "bool"}
],
"default_sorting_field": "price"
}
Then index six products:
{"name": "Embroidered Kurta", "category": "kurta", "price": 3499, "in_stock": true}
{"name": "Plain Cotton Kurta", "category": "kurta", "price": 1999, "in_stock": true}
{"name": "Men's Shalwar Kameez", "category": "shalwar", "price": 4299, "in_stock": true}
{"name": "Printed Dupatta", "category": "dupatta", "price": 899, "in_stock": true}
{"name": "Chikankari Kurta", "category": "kurta", "price": 5499, "in_stock": false}
{"name": "Lawn Shalwar Kameez", "category": "shalwar", "price": 2999, "in_stock": true}
The import returns {"success": true} six times. Now the search that matters, typo included:
$ curl -s -H "X-TYPESENSE-API-KEY: xyz123" \
"http://localhost:8108/collections/products/documents/search?q=kurtah&query_by=name"
The response, trimmed to the fields that matter:
{
"found": 3,
"hits": [
{"document": {"name": "Chikankari Kurta", "price": 5499, "...": "..."}},
{"document": {"name": "Embroidered Kurta", "price": 3499, "...": "..."}},
{"document": {"name": "Plain Cotton Kurta", "price": 1999, "...": "..."}}
],
"search_time_ms": 0
}
"kurtah", with an extra h, found all three kurtas. A search for "dupatta" found the Printed Dupatta at Rs 899. A filtered search for "kurta" with filter_by=in_stock:true found 2, leaving out the out-of-stock Chikankari Kurta. Typo tolerance, ranking, and filtering each came from one request.
Common mistakes and how to fix them
First, forgetting the API key header. The symptom is HTTP 401 with the message "Forbidden - a valid x-typesense-api-key header must be sent." The fix is to send X-TYPESENSE-API-KEY on every request, and use a search-only key in browser code, so the admin key never ships to visitors.
Second, sending a field with the wrong type. The symptom is a failed import returning {"code": 400, "error": "Field 'price' must be an int32.", "success": false}. The fix is to send a number, not a string: price 3000, not "three thousand".
Third, searching a collection name that does not exist. The symptom is HTTP 404 with the message "Collection not found". The fix is to check the spelling of the name in the URL, and list collections first if unsure.
Fourth, searching a field that is not in the schema. The symptom is HTTP 404 with a message like "Could not find a field named colour in the schema." The fix is to add the field to the schema, or search a field that is already indexed.
Frequently Asked Questions
Is Typesense free? Yes. The server is open source under the GPL-3.0 licence, and you can run it on your own machine or server without paying anything. Typesense Cloud is the paid hosted version.
How is Typesense different from Algolia? Algolia is a hosted service: you send it data, it runs the search, and you pay by usage. Typesense is software you run yourself, so there is no per-search bill, but you own the server.
Do I need Docker to run Typesense? No. The server is a single binary with no runtime dependencies, so you download it and run it directly.
How many documents can one Typesense server handle? More than a small shop needs. A single node holds catalogues in the hundreds of thousands, and the project's demos search tens of millions of records.
What to remember
- Typesense is one binary with no dependencies, answering on port 8108 with an API key.
- A collection is a schema plus documents, and the schema decides which fields are searchable.
- Typo tolerance works out of the box: "kurtah" found three kurtas.
- Every request needs the API key header; a missing key returns 401.
- Use
filter_byto hide out-of-stock items instead of filtering in your own code.
Where this leaves you
The shop search box no longer depends on shoppers typing perfectly. Six products, one collection, and three requests proved it: the typo search found every kurta, the exact search found the dupatta, and the filter hid the item that was out of stock. The only failure was a missing API key, and the message said exactly what was wrong. If your site has a search box that only matches exact text, try this: download the binary, index your own catalogue, and search it with the typos your customers actually type.
Further reading
- Typesense documentation
- Install Typesense
- Typesense on GitHub
- Meilisearch Tutorial: Instant Search Without the Heavy Setup
- Elasticsearch: Search That Understands Your Data
- PostgreSQL Explained: The Reliable Database You Default To
- SQLite Explained: The Database That Lives Inside Your App
Waqas Shahid is a software engineer from Karachi with more than 12 years of experience, including 6+ years in engineering leadership. He writes The Practical Developer.
Originally published at https://practicaldevblog.blogspot.com/2026/11/typesense-search-tutorial.html

Top comments (0)