Search feature giving you problems? This is a great solution.
Tags: webdev, search, opensource
Published: 2022-01-30 23:15:08

---
title: Search feature giving you problems? This is a great solution.
published: true
description: A brief review of an OSS project for search engine built-in
tags: #webdev, #search, #opensource
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qh5796hc565mwht7hggf.jpg
---

Hello again, my friend.

Happy new year and welcome back to another article.

In this one, we're going to talk about a really cool project I found recently and it's going to help us simplify the whole process of adding a search feature into an app.

Without further ado, let's get into it!

![Let's go](https://media.giphy.com/media/nBQMf95HKESX1c8zAY/giphy-downsized.gif)

## What it is

This open-source project I'm talking about is called Typesense. 

At first, just with hearing the name, I thought it was some sort of checker for the types on a JavaScript project to make sure they’re correct (you know, kinda like a less annoying version of TypeScript 😛) 

But after going through the docs and checking a demo of it, I realized is actually something much cooler.  

It is a search engine for projects with an instant search-as-you-type experience. 

Now, one would think that this experience works on small-to-medium groups of data. And as the data increases the experience becomes slower. 

Well, I gotta say I was surprised to see that this “instantness” works even in groups of data that have about millions of entries. 

![Not bad](https://media.giphy.com/media/xThuW2Vrx2ruC42Dcc/giphy.gif)

We can be already familiar with search solutions like Elasticsearch or Algolia. And while these two deliver results, they have some tradeoffs to deal with that aren’t ideal. 

On one end, Elasticsearch is a big piece of software that does a lot of different things, has a ton of configuration options, and is not easy to get up and running (unless there’s an engineering team that knows what they’re doing.)  

The source code is available under the SSPL license so one can peek under the hood for anything that needs customization (but it is written in Java and runs on the JVM which is a big hassle that I don’t want to get started on...) 


On the other end, we have Algolia. It is a proprietary, hosted, SaaS product that works well and is been getting quite popular over the past few years. Most of the popular software projects that have docs use Algolia as their engine for search results.

But here is where things stop being so nice. When one of these projects starts getting more adoption and scales very fast, it runs into search and indexing limits. 

Ones that can only get lifted by switching to a more expensive plan...

On top of that, Algolia has some searching “quirks” that do not make it quite an ideal tool to use on large-scale projects. 

One of those being the requirement of separate indices for each sort order (when you want to group or filter the search results)


Now, with those options out there in the market, Typesense stands in the middle being a lighter, easier to use alternative to Elasticsearch and an open-source, more flexible version of Algolia with those quirks solved and productive out of the box.

Not only is easy to get started with but is also easy to deploy and use on production-level, already-running applications.

The team behind the project insists on the out-of-the-box, batteries-included nature of the tool.

Since it is built from the ground up with no external dependencies it can be self-hosted or deployed to an external cloud service and be ready to go without any extra hassle.


But there's another thing I found quite interesting about this project. 

It wasn’t the benchmarks about how much data it can handle or how fast it can respond even after indexing massive amounts of it.

Instead, it is the flexibility it has to build responsive search UIs with very little extra code.

One would think that since it’s a full-featured search engine, it takes care of the handling of data and all the extra backend stuff only. 

But it also makes it easy to be integrated within existing applications by using the [InstantSearch.js](https://github.com/algolia/instantsearch.js) library through the [Typesense-InstantSearch-Adapter](https://github.com/typesense/typesense-instantsearch-adapter).

This allows us to use any of the widgets that Algolia already provides but, in this case, we’re using them connected to a Typesense backend. This is what people would call “the best of both worlds” 

The cool thing about it is that the adapter not only works with the Vanilla JS library but also integrates with the React, Vue, Angular versions of the library. 

So, with just a few lines of code and a little config, we can get the search completely working with an app built in something like Next.js. 

Totally awesome stuff here!

![Awesome](https://media.giphy.com/media/fmkp70c7IIb9C/giphy.gif)

## Wrapping up

That's pretty much all I have for this quick intro to Typesense. 

There are several features to be explored and several cool things that can be built with it. 

The main docs have a couple of demos where it’s being used in different cases like a book's app, or a recipe one, or a Spotify-like one, and even on E-commerce! 

With all of these features, it’s now even easier to be production-ready with a full-featured app in hours instead of what it would take by using any of the other services out there (or God forbid by building the feature ourselves...)

And here I'll have to put a disclaimer saying that I'm in no way affiliated with any of the folks behind the project. (Although it would be really cool if I was hahaha 😅)

---

That’s it for this post. Thanks so much for reading, I hope it has been useful and informative for you and you can try it out in the next app that you'll build.

If you have any questions or want to discuss this further, let's talk 'bout it on [Twitter](https://twitter.com/juanfrank77).

Take care and see you in the next one.

![Chao](https://media.giphy.com/media/S73VWF8xW6sjNxozoN/giphy.gif)