Michele Riva, founder of Orama - Open source interviews #35

In this Open Source Founder Podcast episode, co‑founder and CTO Michele Riva walks host Speaker A through his journey from a JavaScript full‑text search prototype built for a Berlin conference to the creation of Orama, an open‑source full‑text and vector search engine designed to run at the edge. He explains the technical motivations behind Orama—leveraging JavaScript performance, immutable data structures, and functional‑inspired design—to achieve micro‑second query latency across a globally distributed CDN. The conversation covers the challenges of deploying large indexes on edge workers, the decision to support multiple runtimes (Node, Bun, Deno, Cloudflare Workers, browsers), and the benefits of edge‑first scaling (infinite capacity, low cost, proximity to users). Michele describes the open‑source community model, highlighting community‑driven releases, contributions for language support, and the need for deep algorithmic expertise. He reflects on his functional programming background (Haskell, Elixir) and how it shaped Orama’s immutable architecture, while also noting the pragmatic need for imperative code to hit performance targets. The go‑to‑market strategy is discussed, including design‑partner collaborations with large enterprises, the difficulty of handling gigabyte‑scale indexes on 1 MB edge workers, and a roadmap that adds hybrid search, GeoSearch, custom embeddings, and RAG capabilities (Orama 2.x, 3.x). Michele shares founder advice: prioritize user feedback early, define design partners, and maintain a balanced team (hacker, hustler, designer) for prioritization. He also offers career guidance for aspiring engineers—emphasizing early‑night learning, networking, and optional public‑facing activities—while cautioning that marketing and content creation are not mandatory for all developers. The episode concludes with a live demo of Orama Cloud, showing index creation, schema definition, embedding generation, and a simple React front‑end that performs full‑text, hybrid, and vector searches with filters and thresholds. Throughout, Michele’s tone is conversational, enthusiastic, and candid, providing both technical depth and practical startup wisdom.
Chapters
Hey everyone, welcome to the Open Source Founder Podcast. Joining me today is Michele Riva, co-founder and CTO of Orama, an open source full text and vector search engine. Michele, thank you so much for joining us. I'm super excited to start with some information about your background and how Orama got started.
Yeah, thank you for having me. First of all, big fan of your project. So it's a real pleasure to be here talking with you now. Appreciate it. I've been working for around a decade right now as a software engineer professionally. And in the last past few years, I've been involved into open source and public speaking and knowledge sharing. So I've been very active in the community for creating open source projects, contributing to others, but most importantly, I was working at NearForm, which is a very important company for me. And just for the audience to know, NearForm is one of the few companies that have full-time people working on Node.js. So it's truly committed to open source. And I was part of the developer experience team, which is the team that works on Node.js specifically. I wasn't working on Node.js myself, but the rest of the team was. I was more concentrated on TC39 for certain things. So I was basically creating some polyfills for newer versions of JavaScript. And I was more interested in building new solutions rather than working on existing ones. I know that's very typical for engineers, but that's how it is. And I've been lucky enough to work in this company for almost a couple of years. And for a big conference, which is called We Are Developers in Berlin in 2022, if I remember correctly, I wanted to create something cool. So I created a full-text search engine in JavaScript. And it was, you know, very sketchy. It didn't work very well, but it was very fast. The reason why it was fast is, first of all, JavaScript is fast. Like, a lot of people say, no, it's not performant, but that's false. It's pretty performant if you know how to write it. And I was lucky enough to be in a team where people deeply cared about performances. So they they could mentor me and teach me a lot of stuff on JavaScript performances, Node.js performances. So it became very fast. It was in the microseconds area for most searches on millions of records in JavaScript again. And after I gave the talk in Berlin about this full-text search engine, which was more a talk on algorithms and data structures in JavaScript, someone put it on Hacker News. It went viral. And eventually the boss of the company, the former, sorry, the founder of NearForm came to me and said, okay, look, we are a consultancy firm. We can bring this as a product. So I'm going to help you and I will connect you with the people to create a company out of this. So thanks to Kian, the founder of NearForm, I have been able to spin off my own company. And yeah, that's how everything started basically. It was just a little toy and eventually became becoming a proper company. And it's still in the process of becoming a proper company after almost one year now.
I love it. Well, thanks so much. Thanks so much for the background. And, you know, in one of your conference talks, I saw that you said there's no slow programming languages, just bad algorithms and data structure design, right?
Yes, that's the point.
And so I particularly liked that. That code. And I saw you mentioned how basically, you know, you're a fan of Elasticsearch, but of course, you know, it's hard to deploy, the memory consumption is hard. And then who wants to work with Java? That's another key point there. And then, you know, there's Algolia, but of course, like at scale for an enterprise, it's way too expensive and it's kind of like a black box. You cannot really tinker with it and extend it. So now moving to Orama, which is solving these problems and of course achieves like performance that is like incredible. I would love to hear what the journey looked like in 2023.
Yeah. So first of all, just for you to know, that's a fun one. I'm a huge Elasticsearch fan. I want this to be very clear. I sent my resume like twice to Elasticsearch. They never replied. So I took this very personally and I created a company on another engine. I'm kidding, of course. But it was fun to mention. I've learned a lot, of course, by working with Algolia firsthand. So sorry, Algolia and Elasticsearch firsthand. So of course, I do still appreciate those search engines, even though they are competitors now, but I still love them because they're great. So with that being said, we started the company in 2023 and we hired the very first engineers to work on something very different. So Elasticsearch and MeiliSearch and also Minisearch, which is a very nice project in the JavaScript ecosystem. It's a JavaScript full-text search engine. Think of Fuse, Lunar, et cetera. They have something in common. They only run on the browser, only run on the server, but they can't run at the edge. So that was something cool we wanted to make happen with Rama. So the first thing we did was to take the open source Orama, which is the one you can get on github.com/aramasearch/arama, and put it at the edge. So we are now basically, the entire year we spent it in building a system, a distributed system that basically deploys your index, even larger ones, to 300 global locations. And the advantages of running something at the edge is that you get virtually infinite scaling, meaning if I am during Black Friday, for example, and I have an e-commerce and I get a spike of requests, I don't have a server to manage. So it's truly serverless in a sense. So you get like billions of requests per second, no problem. Like CDNs were meant also to propagate DDoS attacks. So we are cool with that. It's also very performant. We have big limitations in terms of CPU time, for example, So we can perform most searches in the microseconds area and we can aggregate back the results and then to the user and the round trip time. So since you get your first request from the browser and you get the data back from the server has basically very limited latency because there is a node that it's always close to you. Like we deploy in 100 countries, like 300 cities worldwide. So, you know, wherever you are in the world, even mainland China, for for example, which is not super accessible with AWS, et cetera. Like not every provider has a server there. We got it. And even if you connect from there, you have a server that it's very close to you. So it's like the time that the request takes to get back to you, it's very limited. So it's very fast. It's very scalable, but also very cheap because the price, it's basically the same as fetching an image at the edge, you know, on a CDN, which again, it's meant for serving billions of images. It's a very nice model, pretty difficult to program with, I gotta be honest. But yeah, this is what makes edge applications a bit more appealing to me than, you know, standard servers, for example, server-side applications, at least, or browser-side applications only, like the ones I mentioned that are fantastic products, but they could potentially run there, but to make them run on the CDN, I experienced this firsthand, it's gonna be very difficult.
Totally, and we'll see later on people sticking around the demo, actually that performance in microseconds, and I'm excited to get there later on. How's the open source motion been for you and your team in terms of the community as well as managing the project? And I know you're familiar from the past, but I'd love to hear what the experience with Arama has been like so far and whether there's any advice for other maintainers or open source founders.
Yeah, so first of all, you know, I've been very happy with the fact that we made entire releases without the core team working on those releases, like community-first releases. People like wanting, I don't know, Vietnamese language support. I don't speak Vietnamese and it's really difficult for me to, you know, build and test proper stemmers, removing proper stop words, et cetera. But we got people getting there and saying, yeah, no problem, I can do that. So they just do that for us. Sometimes we give them a bounty, why not? But you know, other times they just show up and they want to implement something that is missing and they do that. And again, I'm very happy to be able to make entire releases without having Diorama team working on those releases because that's just fantastic. That's pretty unexpected. I wasn't expecting that like 2 years ago when I first started the project. So that's cool. And again, it's not a super accessible project. I've got to be honest. It's very technical and, you know, it's algorithms and data structures again, plus a lot of optimizations because if you want to run on every single JavaScript runtime nowadays, you got to support BUN, you got to support Cloudflare Workers, Deno, Node, browsers. So you really need to know JavaScript and there's no abstraction there that can help you with that yet. We should probably invent it. But, you know, it really teaches you to think in JavaScript, which is very nice in my opinion.
Absolutely. And I think in the process of using Orama, there's also like a test suite that actually people can test out their algorithms and the data structures and learn in the process of building with Arama and become better engineers and better at optimizing their systems. So I really like that. And again, maybe we'll get to that later on. You come from a functional programming background, working with Haskell, for example. So how have you experienced this change?
So that's very funny. Yes. I've been working a bit with Haskell and a bit of Elixir. So I gotta say, working at the CDN, for example, is a functional model in my opinion. So Orama is an immutable database. We treat it as an immutable data structure. So every time you want to update Orama at the edge, for example, you have to redeploy the index. So in a sense, I was mainly inspired by functional programming in working that way. There is an inversion of paradigm when it comes to search in general. It's not just full text, but also vector hybrid search and newer kind of searches that ChatGPT taught us that we need to implement and making everything running at the edge and making it, you know, in a functional architecture actually made it possible. So that's something that I kept from my functional background. But there is a good quote I can give you from the— it was the V8 documentation, I think, that said, like, if you want your JavaScript to be as fast as C, just write it as you write C. So it's not functional. I'm sorry. Functional programming in JavaScript, it's very fun. JavaScript itself started as a functional language back then in 1995. But nowadays, if you want to have cool performances, you have to make two compromises. First of all, write imperative code. Second, if you really care about performance, it's going to be pretty ugly. But again, that's a compromise. And sometimes you can't compromise with speed. For example, if you want to execute your code on Cloudflare Workers, you only got 50 milliseconds for executing the code. So you see, you can't compromise with performances there. And sometimes functional programming makes it a bit harder on JavaScript specifically to run that fast. Then you have other programming languages such as OCaml, Haskell, et cetera, that are faster, but for different reasons. But that's not the case for JavaScript, sadly.
And Yadoram, of course, has the crazy performance. And again, we'll get to that. I'm curious how you have experienced the go-to-market motion for Orama, which can be done via outbound, can be done through marketing and the inbound interest. And of course, you mentioned that a lot of people prior to funding the company had their eyes on you through the Hacker News post that someone did on your behalf, which is amazing when that happens. And so how did you experience last year on that front? Was it mainly just building, building, building and letting the work speak for itself, or did you also have you know, a quote unquote enterprise, like outbound sales motion to get the feedback from big organizations who have such big scale needs with their search?
Yeah, so we definitely have some design partners that are helping us at scale. So if you think of large enterprises, for example, we have some large enterprises that are helping us in shaping, you know, a search engine, or as we call it nowadays, an answer engine, as they wish it to be. And those companies are mainly looking for switching off, you know, a different engine into Orama. So this is really helping us because we can see the problems that we need to solve. And we also acknowledge the scale at where we need to bring our product to. So that's pretty cool. We spent the past year basically building and it was pretty hard because again, there are not many applications running at the edge and there's not a lot of literature on how to run applications that are so complex at the edge. Because again, like if you think of again, Cloudflare Workers, for example, your worker size must be like 1 megabyte, but an index could be 1 gigabyte. How do you solve that? So we had to solve that problem, you know, and it took forever, literally. Like that's hard programming. That's some hardcore programming going on. And it wasn't easy. And we had some help from many people in getting there. And we have a team now that finally has been able to prove that this model is working, but it took time. So we are now ready to onboard some first customers and get back to those enterprises that are helping us and start finally to onboard their clients. So I can't say a lot more about our strategy at this point. We will probably announce something in a few weeks or months, but I won't be the person announcing this. I think our CEO and our marketing persons are the ones that are best suited for this. I'm just a technical guy. I'll stick to the technical parts.
A technical guy who goes around the world, of course, like presenting and educating people, and that's super unique, and I really admire that actually. And, you know, congratulations and keep it up. I, I was also curious, uh, to ask what might be coming up next. It is a milestone you could share on the product front.
Um, yeah, if you see, for example, the kind of edits that we made to the engine. Like until version 1.2.4, we were just a full-text search engine. We had all the goods like faceting, like grouping, sorting. We had it all. Like whatever you could do on other search engines, you could do it with Orama. Then we implemented vector search. So you could provide like a vector and retrieve results based on their semantic meaning. And now with Urama 2.0, we have GeoSearch. We have hybrid search. So we basically perform both vector and full-text search, aggregate the results, and understand if you're searching for something rather than something else. And I can give an example of why this is important. So that's a very silly example. And I'm so sorry because I couldn't find another greater example than that. So if I search for, a movie to watch with my 6-year-old daughter, right? I'm clearly looking for something and I don't know how to express what I'm looking for other than this must be a family movie, you know? But if I search, for example, for a movie about a doctor that is possessed, like I'm looking for The Exorcist, you know, the movie, and that's totally different. Like these results are totally different. I can give you results for The Exorcist if you're looking for a family movie. So this is where Orama makes the distinction. If you're searching by meaning or you're searching by keyword, we get this and we give you the right result every time. So Orama 2.0 has done that. There will be Orama 2.1 and 2.2 and et cetera, and then Orama 3.0. I can't spoil where we're going, but we have a very nice plan to get there. We will certainly enhance our AI capabilities. Right now, for example, with Orama 3.0, we also generate our own embedding models that are faster, cheaper, and closer to you than OpenAI. So you can generate embeddings automatically with Orama, but we will see that in just a second. And so we are moving a bit more in the RAG space where you have this way of searching that again, it's more about the meaning, not just the keywords. And we want to provide you the best experience either on the browser or the server or the cloud or the edge. You choose, we provide that to you.
Love it. And I'm super bullish. I have to say, is there any mistake that, you know, might have happened, something you would, could urge other founders to avoid. Uh, I know it hasn't been too long of a time and it's going, it's going really well from, from the outside. I'm just wondering if there's anything we could share with people, uh, here.
Hmm. I think it's not a proper mistake, but sometimes I believe you should really define your design partners and because eventually these are the users you're gonna get. And you should definitely always listen to your users. So whenever you have a doubt, for example, are my users gonna like this? Do they want this in the first place? Like the only real people you should ask is the users at this point. So one mistake I can see is probably I would have loved to learn that a bit earlier, you know, even when that was, you know, an open source project and nothing more. That would have simplified things so much. Now we are in a situation where eventually we respect that rule, let's say. It's a startup rule, if you will. But I wish I learned that earlier. Like, user is the king and eventually you're going to serve users. So just build stuff for users, not for yourself or, you know, Thanks for sharing this.
And to follow up, is there any specific process or heuristic you use for prioritizing? Because, you know, your design partners and your users, they might try to pull you in a different direction. They might have all these different requests and, you know, there's only so much bandwidth. There's only so much time every day. So how do you go about prioritizing? And I know this is super challenging for everyone. Just curious to hear your thoughts.
Yeah, so thankfully enough, the founding team, so it's me and a CEO and a head of design. So we are 3 people with 3 different departments, you know, and we have 3 different perspectives. So there is the business perspective, there is the product perspective, and there is the technical perspective. That's awesome. You know, in Y Combinator, there is the hacker, the hustler, and the designer on the team. Like that's the perfect three kind of performing team. And that sucks. Like I really love this. And I see why this is such important because those three perspectives really helps you understand what you need to prioritize, for example. And most importantly, to understand the point of view of different users. Like I can definitely understand the point of view of a user that is a developer., but I can't really understand fully, you know, a marketing person or a business person or anyone else that is not deeply technical and needs a solution that it's not super technical. So having again, multiple points of views, it's really helping. And then I gotta say, we have a part-time project manager that is really, really, really helping. So having a third person, you know, third party that comes and say, okay, we really need to prioritize and we prioritize with some strategy, with some structure. At a certain point of a lifespan of a startup, it's becoming pretty handy. So I'm really happy about that.
That's great. That's great. Thank you. Thank you so much for sharing this. Do you have any conferences that you're planning to attend the next months throughout this year?
Anything planned? Not yet. I got a couple, but they're not announced yet. So I can't really tell. But also I'm moving a lot. So it's going to be a bit more difficult this year because I really want to concentrate on working, working, working for this year. Maybe in 2025, I'm going to move a bit more. But we'll see. We'll see how it goes.
That's great. Are there any other notes that you think would be helpful for people to hear before we proceed to the demo?
I'm super excited about. I think you should all put a star on GitHub. That would really, really help if you could. And I'm going to show you why in just a second with the demo.
Absolutely. Absolutely. And actually, I guess I just thought, I think it would be useful to ask you this before we go to the demo. If you were starting today as a developer, right? Maybe you're in college, maybe you're going out of college and you want to start your career. Is there any rule of thumb you would follow, or is there something that you could recommend to people who are just getting started and would like to work in tech and be a professional software engineer?
Oh, that's hard.
I know it's a tough question and kind of generic.
No, but it's a cool question, and I think every developer has a different answer, so I'm just giving you mine. There are multiple levels of, you know, a career that you can achieve in software engineering. I truly believe that if you, if you want to see a very long trajectory going on, so seeing yourself progressing in your career, you really have to invest a lot of time early in your career. So the first 2, 3, 4, 5 years, you really have to work at night. And I'm sorry in saying that, I do understand that everyone has a life. I do understand that work is not everything, but this is a very hard job and there's no college, there's no university that it's gonna teach you how to do that job for real. I've been working with graduated engineers for a long time. They are super smart, super incredibly talented people and educated people, but I can't tell the difference, you know, with self-taught developers that really spend their nights early on their careers trying to learn something more about programming. So with that being said, I'm not saying that college and university is useless because it's not. Like if I could go back, I would do college and university, but that's not for learning how to program. That's for knowing the unknowns that I'm facing today. Because my problem as a self-taught engineer, I couldn't go to college because I didn't have money basically and I needed to work. My problem is that I'm facing a lot of unknowns, unknowns. Like I didn't know that I had to learn this. I didn't know that I had to, you know, go look into this other stuff. And I have this feeling that people that studied have a different approach. They have a method to follow whenever they face this kind of unknown. And they probably have a broader sense of the unknowns that they are going to face moving on a project, moving on a career, et cetera. And this is very valuable. Again, sometimes it's not a problem for me. Other times it is. But if I could go back in time, I would probably study a bit more. Because sometimes it's pretty frustrating. But this is not preventing you from getting a very nice career in computer science or in programming in general.
I love these insights. Would you say, just the last follow-up question here, would you say that the skill set that engineers need to build nowadays has been expanded to also include building in public, doing media, doing marketing? And is that becoming at all a necessity, quote unquote, or like a very nice to have?
That's the tip of the iceberg. You know, you see developers doing marketing, you see developers doing content and conferences and being influencers on Twitter. But again, this is the tip of the iceberg. This is like the 0.00001% of developers worldwide trying to express themselves and their doing this pretty well, if you ask me, but the vast majority of developers are not interested in having a career that goes, you know, into content creation or in building in public, in creating startups or being, you know, CTOs, managers of other developers, which is fine. Like that's totally cool. I think it's not necessary for everyone. To get on Twitter and get 100,000 likes on every post. It's pretty useless if you don't care about that. It's a pretty useless metric. But I do also understand that sometimes having a good network, it's really helping you in your career. So what I would recommend is, I said previously, you should really study in your, you know, during the night, early in your career., but during the day, just make some connections, like, you know, so you only got 24 hours, make sure to also, you know, grow your networks and your connections, because this is what it's going to be life-changing for you rather than your technical skills. Like your technical skills are going to be just fine. You might not be the strongest in algorithms, but if you are a pretty good one in relationships, this is helping you a lot more.
Absolutely, absolutely. And working in open source, contributing to open source can definitely help there, especially for younger people who don't have that professional setting experience working with teams. Well, with open source, you can contribute to, you know, production software and work with other people and get mentored in the process. And just as a middle way in terms of kind of like creating also content in, in some sense, I think a middle way would be to learn in public or to have your own blog where you have the TL;DR, kind of like document your journey do it for yourself as a journal. And maybe that's, you know, like an exercise that muscle a little bit, uh, should you find yourself in a position later on where you'd like to express those talents even more. Uh, definitely not a requirement, as you said, uh, just another avenue for people, uh, to, to explore their talents. Absolutely. Thanks, thanks, thanks for the insights, uh, here. And, uh, unless there's anything else you would like to add, uh, maybe you can jump to the demo, maybe start with showing the repository on GitHub and then the demo for Amo.
Yeah, sure. Let's start with the demo. I would probably share my screen. Let me see. Right. I will start with the repository. So in case anyone wants to add by putting a star, this is the repo. Everything is open source. We got a bunch of great contributors and oops, sorry. And this is where you can find all the documentation and the highlighted features for Rama. So whatever you need, just click and get to the documentation. Everything should be documented. And if it's not, I'm responsible for that. So just ping me on Twitter or Slack, and I will do my best to try to fix this. All right. But let's go back. If you want to start with the demo, I want to be honest. I totally forgot about the demo. So we're going to make something, no problem. All right, so let's start with Orama Cloud. I'll be signing up with GitHub. All right, this is the dashboard. This is where you can create and deploy indexes. You can upload files, you can connect to e-commerces, and of course we will be supporting multiple connections going on. Or you can create, you know, different data sources based on webhooks, REST APIs, or even Docusaurus or, you know, other platforms that eventually we will support. There is a nice analytics page, which is coming soon with a survey. I would really appreciate if anyone could compile that survey. And in developers tools, this is where you can put your OpenAI API key. And we will see why you might need this later. I've already inserted mine previously because I didn't want to share it publicly. I don't want to go bankrupt because of that. So once you insert it, you can never see it again. The only thing you can do, you see, this is text. You can just replace it with another one and that's it. So let's start. I'm going to show you the dataset. So this is going to be the dataset. It's going to be 1,000 video games with title, description, rating, which is a floating point number, and genres, which is an enumeration of genres. We are going to index this and deploy this at the edge, so let me show you how it works. Let's create a new index, let's call it "algodemo", description is optional, let's select JSON file because we're going to use a JSON file, and let's create the index. So now we can drag and drop the file here and we will see a preview. This is going to help us in creating the schema So if we create the schema, we should say title is of type string, description is of type string again, but rating is of type number. Genres— I have no idea how to pronounce this word, so I'm very sorry— uh, is of type enum, and it's going to be an array. You can also auto-detect the schema if you wish, but for the purposes of the demo, I'm showing how to properly write it. What's important to know is that you only should put data here that you mean to search through. So if you don't want to search through title, for example, just remove it. Only put the data you want to search through or filter through. So we want to search through the entire data here. We will enable the automatic embedding generation. So we can select either OpenAI or Orama. For the purpose of this demo, I know a lot of people is using OpenAI already, so I'll be just using OpenAI. We can select which properties to consider for embedding generations. Right now, we only consider string properties by default. So title, description, yeah, we'll select both. Save and deploy. So this is going to take somewhere between 1 minute and 3 minutes. And the reason why it's going to be so slow at the beginning is because we have to calculate all the vectors and we're going to insert all the vectors in our vector storage. So we have to rely on OpenAI. So for every single document, we have to call OpenAI, get the response, put it in the storage, etc. From the second time you're going to deploy them, of course, there will be a cache. So it's going to be a lot faster and you should expect such a a small dataset to be online in 30 seconds in 300 global locations worldwide. You can always see the status by looking at the logs. And as soon as this finishes, you will see the endpoint and the API key that you need to make requests. So we'll do one thing. I'll go on Visual Studio Code. I already created a Vite project. So we are trying to do that in like 10 minutes. We'll see if we can do that. Let's install a couple of dependencies. So first of all, Bun, because I really like Bun. I want to be honest. So we will be using Bun. And I will install orama, /orama, and then oramacloud. Sorry. So we will install orama and oramacloud-client. Let's see what are they about. So Orama, of course, is going to be the Orama package itself, but then we also have oramacloud-client. So this is going to be the client that we are going to use for searching on Orama Cloud. The APIs are the same that we are using for Orama open source, but this time we are searching on the cloud. In the meantime, we can see that this is proceeding in Inserting everything, and that should be done now. So let's go back for a moment in our terminal. All right, we installed the dependencies, we can now go back here. I can't really remember how to start a project, so— okay, that was easy. Um, bun run dev. All right, this is what we got. Let's go back. This is a very fresh installation, so we'll just go back here. Remove everything. We don't want CSS. We want nothing. My co-founder is the head of design, so he's going to kill me. I'm very sorry. I won't do anything very good. All right. This is what we got. And yes, we also have finished inserting everything. So this took a couple of minutes, as you can see here. 2 minutes exactly. And we got the API endpoint and the API public key. So let's go back here. Let's create a new folder. I'll zoom in a little bit. I call this lib where we're going to use all our libraries. Let's create orama.ts, and now let's import Client. So we can import a couple of things: orama.cloud or orama.proxy. I don't want to talk about orama.proxy right now, but we will see why this is interesting a bit later. So import it and export it. Export const prama, it's equal to new PramaClient. Oops. So a couple of parameters: API key and endpoint. So the endpoint is going to be the API endpoint, and the API key, that's public, so you can share this on the frontend, no problem. API key, here it is. We can start the heartbeat with a frequency of, let's say, 3.5 seconds. So this is basically keeping Orama awake because it goes idle mode after you don't use it. So you just want to keep it awake. We don't integrate this built-in because sometimes you don't want this, but there's no time maybe now to discuss this. Let's just take for granted that we want it. So let's go back here and import our Orama instance. All right. Then let's import, and again, I'm sorry, React developers, I'm gonna, I'm not a frontend dev. So I'm gonna create something that it's not super optimal. But import useState. From React and maybe useEffect. We're gonna use that later on. Let's create SearchResult and setSearchResults. Okay, good. Great Copilot, thank you. We're also importing a type which is nullable from urama. So nullable, it's basically telling you that a value could be null. That's pretty neat. We can also import results, which is the type of the search results, and you can determine the type going back to your index. This is basically the type. So you go back here and you say type SearchResult, result, it's gonna be— oops— it's basically gonna be this. The enum type is not a JavaScript— sorry, a TypeScript type we're gonna use now, just treat it as a string. Rating is going to be a number. Description is going to be a string again. So that's really it. So now we have, let's call it type SearchResultState, which is nullable. And we can pass SearchResult. Cool. Now let's just create an input. And we are going to create a second state, which is searchTerm. setSearchTerm, which is a string. And we now go here and say, all right, placeholder, search not a movie, something. All right. Then value is going to be searchTerm. And onChange, we're going to— oh my god, I love compiler. Can I say that? That's so— All the boring stuff, it's automated now. I love this. Cool. So now if we go back here, we will see hello. Cool. Let's maybe remove the CSS from there. All right. Again, maybe I can zoom a little bit. Okay. So go back here. Let's make some search. All right. So useEffect. We are going to spawn this effect every single time the search term changes. Term. And this is going to be the search term. So like if I search, for example, for, I don't know, Pokémon, you know, this is going to be the search term. Then we have mode. By default, this is full text, but I can also search for hybrid and vector. These two are only enabled if you either provide embeddings on your own or you generate embeddings with Orama just like we saw previously. So in that case, just limit to, let's say, 5. And you can paginate by using offset. We're not going to do that right now. Then this is a— oops— this is a promise. So we can just say set search results. And we can catch any error with console.error. I know this is not great. Yes, I'm probably— I need to specify this because of TypeScript. And all right, let's keep it as is for a moment. Now we got search results. Let's say if we have search results, let's just I'm sorry, I think it's going to be like this. So results, basically, I forgot to use the result. As you can see, this is the API response from Orama. So it's going to give you the count. So if you search for Pokémon, for example, you have 1,000 results. I'm going to limit this by 10 results per page, but I'm also giving you the full amount of results inside your index. The hits, so the results themselves, how much time has elapsed, and facets in case you wanted the facets, and groups if you're grouping the requests. So now we got search_results, oops,.hits.map, like that. As a key, we can use result.title. Ed, and then we can say result.title— oops, document, sorry—.title. So you see, this is inheriting basically the SearchResult type we just, just used. We can probably also say div and make another div for result.document. I don't know, let's say description. Hopefully that should be enough. All right. All right. So by default, I'm going to, if you don't specify search string, I'm going to return to you all the documents. Of course, you can block this by saying just return, right? So you're not making any requests if there's no search term, which makes sense. Let's maybe use H2 for this. I know semantically it's not correct, Correct, but I can go back here and say "Pokémon." This is working now, and I can search for "Guitar Hero" maybe, but you will see there is something that is not going well. Like, if you search for "guitar," you got "Guitar Hero." This is because by default Orama uses a threshold parameter. So if you go back here, for example, and say Let me give a threshold of 0 or 0.2. By default, it's 1. We're gonna set 0. That means, as you can see now, it works. That means I only want results that has both of the search terms in it. So if I search for "Guitar Hero," for example, the search result, either the title or the description has to have both. And I can have guitar here and hero here. That's fine. By default, we don't do that because you can customize this. By default, you could say also like 0.5, which means return all the results that has guitar and hero plus 50% of the results that only has one of those. If you have few results, that could be handy. You see why. But this is not the case, so let's just do that. So that's basically it. And I can also say, "All right, but I want them where, in that case, rating is equal to or greater than 3." So I can also say document.title, then result, document.rating. And now we should only have search results where the rating is greater than or equal to 3. So let's try it. Let's refresh. Yes, that's correct. You see, we basically don't have— if I search for A, for example, we shouldn't have results that have more— sorry, less than 3. And I can also say, like, you see now there, these are all 3. Basically, we can go back and say, all right, let's do with 4. And we go back, that's now 4. And I haven't changed my search query. We can do the same, of course, by saying only give me the— oh, sorry, I forgot to put here h3 result. Oh, because I— all right, this is not a string, this is an array of strings. So I can also say only give me the adventure. So where genre is equal to adventure or includes adventure and visual novel. So you can go crazy with all the filters you want. And this is how we basically create an index on Arama. I believe that's fairly simple, but I developed that with my team. So I'm looking for feedback here. Like if you want to join as an early adopter and try this out, I'd be very glad to. To hear some feedback. And that's basically how you do that. And last thing we can share is mode, maybe do vector. So threshold, it's not available when you're using vector. And I search, for example, for game for children. You basically get data based not on the keywords, but on the meaning of description and title in that case. So that's how easy you can create your own vector search database that works on the client, so on the browser, at the edge, et cetera. And I truly love this product, and I believe this is going to be interesting for many people.
This is super powerful. Well, thank you so much for walking us through this. Are you— are there templates available or planning to make any templates available so that, you know, people could do this, for example, with ready-made template? Yeah.
Yeah, I really wish we would get this. Now you have one template specifically, which is on Vercel Commerce. So if you go on Vercel Commerce, for example, you have Orama with the demo. So this is a demo using Urama Cloud, for example, or searching through the Vercel Commerce, let's say, cap, for example. So you can probably use the fork as a template for your e-commerce website if you're using Vercel Commerce, for example, and Shopify in that specific case. But yes, we definitely need to create more templates and we also need help to create templates so we could get some bounties going, if you will. I really love this idea. So yeah, why not?
Yeah, absolutely. You heard it first, guys. Perfect. Thank you, Michele. We'll be talking again soon. This was excellent. And thank you everyone for watching. Thank you. Until next time.
Cheers. Thank you.
More from Michele

Beyond Coding: JavaScript Full Text Search, Entrepreneurship, and AI | Michele Riva





