S8 Bonus: The Linux Kernel Maverick Rewriting SQLite in Rust: Scaling Micro-Databases for AI Agents with Glauber Costa, Co-Founder & CEO of Turso [0:00:00] Glauber Costa: The usual answer is ask your users. The reason I don't like that answer is not because it's not true. You obviously have to ask your users. But if you ask something to 10 different people, you will get 11 different answers. So it's a very complicated process of how do we go getting that information? And now how do we make sense of that information? One of the things that we did for the MVP that I think was very helpful is that before we made the product readily available, we had a private beta. Give me your email. Now I'm going to send you that email with a form to fill, and I'm going to judge if you are a person that I want to give access to. My name is Glauber Costa, and I am the founder and CEO of Turso. [0:00:46] Clip: This is Code Story. [0:00:48] Noah Labhart: A podcast bringing you interviews with tech visionaries. Who share what it takes to change an industry. Who built the teams that have their back. Keeping scalability top of mind. [0:01:11] Clip: All that infrastructure was a pain. Total waste of time. [0:01:15] Noah Labhart: The stories you don't read in the headlines. [0:01:18] Clip: It's not an easy thing to achieve. Took it off the shelf and dusted it off and tried to begin. [0:01:22] Noah Labhart: To ride the ups and downs of the startup life. [0:01:26] Clip: You need to really want it. It's not just about technology. [0:01:29] Noah Labhart: All this and more on Code Story. I'm your host, Noah Labhart. And today, how Glauber Costa is building a way to enable the edge. Not just for compute, but now for data. Glauber Costa is a family man with three kids at home, so he admits with a startup and kids, there's not much space for anything else. He made mention that the jump from two to three kids was hard, and we joke that he and his wife are playing zone defense now over man-to-man. As of this recording, he had already seen the Mario movie three times with his kids and enjoys playing video games with them. But his game to play is Civilizations, which he is highly addicted to. Glauber comes from a heavy database and systems programming background, as does his co-founders. They noticed that the buyer persona of database tech is changing. More and more front-end developers and full-stack developers are responsible for these decisions. After iterating on a few projects, they figured out the pillar of their data edge solution, which was SQLite. This is the creation story of Turso. [0:02:49] Glauber Costa: Turso is a database for the edge. First of all, it's a database where your data is replicated to the edge differently than usually the cloud. When we talk about the edge, we're talking about dozens, if not hundreds of locations. In our case, we're offering the service in more than 28 locations. You wouldn't have just like in the cloud, US East, US West. You now have data centers, you have locations, points of presence, like some people call it, plus other regions of the world, Japan and Australia and lots of places in Europe, a couple of places in South America. So you really want to have like this last mile latency advantages. And also when you look at the platforms that are today used for edge compute, like Vercel, Cloudflare, Netlify, there is itself a packaging of Deno Deploy. They pack very restricted environments. So connecting to normal databases from those environments is quite challenging. You can't really even open TCP connections. So another thing that an edge database does is that it makes itself available through those protocols like HTTP, WebSockets, and et cetera. So you can work from anywhere, essentially. We had the previous product in our company called ChiselStrike that we still maintain as an open source project. We put some effort. Open source never truly dies, which is an amazing thing about open source. I've been doing open source for 20 plus years now. We started the company and we started looking in that direction, my co-founder and I, because we come from a background of heavy databases and system programming. I was in the Linux kernel for around 10 years. So I was back on my co-founder. And then we joined a database company called ScyllaDB, a database company focused on petabyte scale, NoSQL workloads. So we come from those like very back and heavy infrastructure systems programming, low level background. And when we were looking a little bit around what's going on in the world today, one of the things we noticed is that buyer persona of a database is changing a little bit. Go back 10 years in time, the person in the company responsible for database decisions was a very particular individual who almost exclusively specializes in dealing with databases and have infrastructure. Fast forward to today, we don't think this is the case anymore. I mean, obviously, there is still some of that going on, but you have more and more people that are front-end developers, or in some cases, they call themselves full-stack developers, in charge of those database decisions. And we started to try to understand why. We started to look around and see what are the things that are taking the world in that direction, and is this a trend worth betting on or not? And one of the things that we saw that was making those people more capable of making those database decisions was that with serverless and edge, which is something lots of people conflate together and think to be the same thing. They're not. But like with serverless and edge growing in popularity, it was much easier for those folks that were doing their websites on Vercel and deploying them on Netlify and Cloudflare and et cetera to have the full backend under their control. We started working on a project to take advantage of that. And that project has a couple of things that we just don't think we got it right. But it also had one thing that we absolutely got right, which was the fact that it had internally something that we construed to replicate data with SQLite. So why SQLite? And the idea was that with SQLite, you can deploy everything locally. You can do everything locally. You can develop your application locally. locally but then if you find a way to distribute the data at that point because you know SQLite is not meant to be a distributed database but if you find a way to distribute that database later you now have the same code running locally and later in production and also the edge because it's this thing that is deployed to 20-30 locations it has a lot fewer resources than the cloud so you really need a database that is not as heavy as other databases so SQLite just fit the bill perfectly. And we started building on it. The idea of Turso really came from this realization. We understood that the edge was the next thing for us to deal with. And we knew that this part of the product was the part that people loved the most. The product did have this experience of like develop locally and then just push to the cloud, right? So this was like those two things coming together. We just said, hey, let's just put a product out that does just that and see how it fares and it fares fantastically. [0:07:12] Noah Labhart: Let's dive into the MVP then. So tell me about that first version of the product you built. How long did it take to build and what sort of tools did you use to bring it to life? [0:07:22] Glauber Costa: The MVP was also an interesting story because around the MVP, my third kid, my second daughter was born. She was born prematurely. So it was a little bit of an emergency and I just have to drop everything and go be with my family. And then my co-founder essentially built control plane in Go. And we are a very strong Rust shop. We use Rust a lot. We've been using Rust for all the other technical stuff. So I came back, I see this control plane in Go, I almost killed him, but I came to like it. So that's the running joke. I mean, Go was a happy accident. All the CLI tooling and all the control plane, the things that does the automation is essentially built on Go. The other thing that we use very heavily is Fly.io. Fly.io is also a platform where you can deploy containers. So it's not just functions, which is again, one of the main differences between serverless and edge. They are on the edge, but they're not serverless. So they allow you to have a server abstraction in all of those locations, in more than 20 locations as well. And the other thing that we do still use very heavily is Rust itself, because at the database level, at the core level, we don't use a lot of AWS. We use some of that. There is some of HashiCorp tools as well, like Vault that we use for storing secrets. was mostly out of it. I mean, I was looking, I was at the hospital at the time with my family, trying to understand like, hey, is my daughter going to be okay or not? It was a really fast paced process. It took around two months in total to just get something together, put in the hands of some early users. And we had, as I said, a couple of early users that were using our previous product and they say, hey, I mean, this is all cool. I love that. But the SQLite stuff is the stuff that we're interested in the most. So we put this in the hand of those early users. They And then the work started to actually release something public, like a free tier that people could just sign up to use it. [0:09:13] Noah Labhart: Okay, let's stay on the MVP for a minute. Obviously, there's a lot going on personally and professionally during that time building the MVP. Some of the decisions and trade-offs you have to make when building an MVP around technical debt or tool choice. And I heard you kind of touch on some of those things. Tell me about those decisions you had to make and the team had to make and how you coped with them. [0:09:36] Glauber Costa: a couple of architectural decisions that we had made before I left. We had had a bunch of meetings and we tried to understand like, what is the architecture that we want to build? Some of those things were not built. There were some good things that came out of that. There were some bad things that came out of that. I had to understand and let the team build it and let the team own it. So for me, it was a great experience on a personal level as well because of that. I was wanting to learn more how to be operating from the sidelines, but then life came and forced me in that situation. Going on the technical aspects of that, I think one of the biggest trade-offs that we made was we had this vision that SQLite was a tool that one of the strengths of it is that it can work from anywhere. You can embed it in the browser. You can deploy it on the edge. We can essentially put it all the way down to your inside your serverless function. But we couldn't do all of those things at once. So for the MVP, we had to choose very, very strictly. you know the biggest thing that we had in mind is like we can't just make this be yet another database so if it's just a database that you access over some network protocol what is the big difference between this and any postgres offering what is the big difference between this and any mysql offering but at the same time i mean we couldn't really realize and we can't still to this day realize this full vision of like hey this is the database that can run really anywhere and and again there are technical avenues that you pursue that lead you to those very paths? Are we going to build this really all over HTTP or are we going to really try to make this something that is WebAssembly from the ground up and can run on the browser? So we had to spend around the month. What are the advantages and disadvantages? And then we settle essentially on let's just make something that doesn't go all the way inside the function. That is not really something that you can push all the way inside your Netlify, inside your Vercel, inside your cloudflare infrastructure to WebAssembly, but let's build something more traditional instead that at the end of the day is just a database indeed that you can access over a network protocol, but this protocol is going to be HTTP and we're going to massively replicate this through the replication layer. So that was the biggest trade-off that we made in the beginning, right? So at which point did we draw the line? And we could have drawn this line in many places and finding the exact place for the MVP was a great challenge. It worked out fantastic. We're all at looking for product market fit. And it's very refreshing when you start to see the users coming in and telling you, yeah, that's exactly how I want this built. [0:12:07] Noah Labhart: So you've got your MVP and it's working. You've got some feedback. You're moving forward. How did you progress the product from there? And how did you mature it? And I think what I'm curious about there is how you built your roadmap and how you went about deciding, okay, this is the next most important thing to build with Turso. [0:12:25] Glauber Costa: The usual answer for that users. And again, the reason I don't like that answer is not because it's not true. You obviously have to ask your users. But if you ask something to 10 different people, you will get 11 different answers, right? So it's a very complicated process of, yes, how do we go around? How do we go getting that information? And now how do we make sense of that information? And obviously, one of of the things that help a lot is trying to step out and look into this from broader view. One of the things that we did for the MVP that I think was very helpful is that before we made the product readily available, we had a time, we had a period of time that we called the private beta. So before we announced this as publicly available, you had to give us your email to use the product and to And to your email, we sent a form, right? So it was not just give me your email and here's the instructions on how to use it. We introduced actually a little friction. Give me your email. Now I'm going to send you that email with a form to fill. And I'm going to judge if you are a person that I want you to give access to. At the end of the day, I mean, we gave access to almost everybody who asked. One of the things you want to be careful is just like people frauding or, you know, not giving you real information. But in that form, we had a question. What do you want to use this for? than 200 people who told us this was very exciting and told us why exactly they wanted to use it. Not everybody, by the way, had the same use case, but once you have this host of data with 200 people, two to 300 people that are telling you this is what I want to do with that, now the use case becomes very clear and now you can make those decisions. When you have other people asking you, can I have this feature or can I have that feature? You now can ask yourself, is that feature Feature is something that will help this specific persona that we now understand that is the persona that is using this product. Maybe a couple of examples. It's easy. And there are some people who come and say, hey, can you add a feature, for example, to use this from the browser? So directly from the browser, which is already something that we were thinking of. Now you can think of that feature in that framework. OK, but what is it the thing that my early users are doing of this? Do they really have this need? And if they don't, then it's a feature that you can safely defer. [0:14:43] Noah Labhart: to team. So how did you go about building your team? And what did you look for in those people to indicate that they were the winning horses to join you? [0:14:51] Glauber Costa: Team building is one of the most challenging things in any startup. I believe much harder than in big companies. And I think the reason this is much harder than in big companies is that you just don't have that much to spare. One of the things that we take into consideration a lot, and I'm not exactly proud of that, I wish it was different, but we like to work together with people we have worked in the past. And again, the reason for that is that we know them and we know already what they're good at, what they're bad at. And this is not being like a technical recommendation. Right. This is really just being a personality issue. There are a lot of there are lots of people out there that they do fantastic technical work, but you put them in the wrong environment. They just don't fit. Right. And startups are a very particular environment. environment it's incredibly difficult to to to do and you have to have the the right mindset you have to fit with the team if you don't fit with the team you're now 10 of the team because you have like 10 people and you're just not performing because we come from this background both my co-founder and i of developing databases doing heavy systems programming we have built over those the past 20 years a very healthy network of people who do that kind of stuff and we know which of of them are technically brilliant, but won't fit in their environment. That's not to say that we didn't make mistakes along the way, which we did. And then we had to, you know, essentially go the hard route and let them go. But we, we try to work a lot with people that we know, obviously this wasn't possible all the time because we were hiring for positions in which, you know, as startup is a lot broader than just the team of four or five, but then we try to see like, if those people have the same personality traits of those people that we already know, and it's been working fine for now. [0:16:36] Noah Labhart: Let's talk about scalability. This will be interesting, given your edge and your data. So this had to be a factor somewhere, but I'm curious, I'm going to ask it openly. Did you build this to scale efficiently from day one, or have you been fighting this as you grow in any sort of capacity? [0:16:55] Glauber Costa: Scaling has so many dimensions. This is one of the things that I don't think as engineers we sometimes stop to think about. scaling as if it really means like, hey, just scaling in general, but it's not like that, right? So there are many things that can scale. There are many dimensions that can scale. And the reality is like that in some of those dimensions, we are built to scale from day one. And in some of those, we're not. From day one, we are built so to scale the number of locations that we provide horizontally. So you can just add through so to more locations and you can more read capacity to the system very easily so i mean this is built from day one this is also part of the value proposition but there are a couple of things that they're not like that and it's really just because if you do that exercise of scaling everything from day one it's going to take you two years to get anything out of the ground so i think you really need to make this exercise of saying what are the parts of this product that really need to scale what are the parts of this product that I really expect if people start coming tomorrow, we'll expect people to put stress on that system. And what are the parts of the system that don't? There were some things that we were not expecting people to pile up on and they kind of did. But the reality is that you have to be very mindful in the beginning. If you don't build anything for scale, I think you're setting yourself up for failure because your system just will not be robust. But if you build everything for scaling, it just takes too long. You can't put a product out in the market. an exercise of like, okay, scaling, but in which dimensions? What are the things that I want scaling? What are the things that I'm comfortable if they don't? [0:18:36] Noah Labhart: So as you step out on the balcony and you look across all that you've built, what are you most proud of? [0:18:43] Glauber Costa: I think the thing I am proud of the most is how simple the product ended up being. I'm a very big fan of simplicity. And I love that phrase. You've probably heard of it because of the internet is attributed to like of different people, right? There's always like this problem of internet attribution that is very easy to come up with something complicated. It takes genius to build something simple. And we, one of the things that help us, I think was this understanding that, hey, we're building something for the edge. So we decided to build as a building block, a very simple database. So that helped us a lot to resist this temptation of like just making this more complicated because the default answer or almost all the problems that you see in engineering is that let's just build this one more feature, right? Let's build this just one more capability, this one more layer. And then you don't even recognize the thing you built anymore. It's so complex that it has become. And I'm very proud of the fact that we've managed to keep our offering very simple and yet solving a very real problem that people keep acknowledging that they have and just not to come to the temptation of just becoming a complex database. And at this point, why not Postgres, right? So that I'm very proud of. And I think we were helped by the fact that the technology choices that we made had simple spelled on them all over. [0:20:07] Noah Labhart: Let's flip the script a little bit. Tell me about a mistake you made and how you and your team responded to it. [0:20:14] Glauber Costa: Have you seen that Homer Simpson, that meme that he's talking to Bart Simpson and say, hey, this is the worst day of my life. It's the worst day of your life so far. Always a good reminder. I love that meme. but we haven't made lots of mistakes so far. I think, as I mentioned before, I mean, Turso is the result, essentially, of a reorientation of this company. In the previous iteration, I think we did make a bunch of mistakes. And I think one of the big mistakes that we made was exactly not to jump in this direction sooner. And again, Turso is a product of its own. It's not just something surgically removed from the previous product, but it was an aspect of the previous product that we decided to build a new product upon. And we were hearing for months that this was the thing that people were interested the most at, but we just thought it was something there. I mean, no, let's invest a little bit more. So in hindsight, I wish we had a better internal process or like this human process and even the courage to some extent, right? You look at this and say, hey, what we're hearing very clearly is that this part of our offering is the part that people like the most. The fact they deployed this to the edge is what people are excited about, the API, not this, not that, right? Not all of the other things we were thinking about. So I just wish we had quality courage or foresight or whatnot to understand that this would, you know, let's sunset the other project and just build a new thing, completely rethought just to solve this edge problem from the get-go. Definitely in hindsight, there was a mistake. We should have done it a lot sooner. So that I think is the biggest so far, so far mistake that we've made. [0:21:56] Noah Labhart: Okay, this will be fun. What does the future look like for Turso, the product, and for your team? [0:22:04] Glauber Costa: The more we talk about Turso, the more we hear this validation that putting your data at the edge really is a problem that people want solved. So I definitely look forward for this becoming more mainstream. As I said, I don't believe the edge is a niche in terms of something that only a few people need to do. but it's definitely a growing technology in the sense that it's something that only a handful of people are doing. I also look a lot to the rise of WebAssembly as something that will also enable lots of interesting use cases around it. I'm very eager to see that happening. And another thing that I look forward to in the future is that people keep talking. If you remember, I mean, look back a couple of months in the beginning of the year when the, can we already say the AI revolution or too early? But when the AI revolution started, right? hey, this is the end of the world. Or other people like, I don't need my job anymore. And I think as those things progresses, we're starting to understand that this is just a technology like any other, right? With its pros and cons. I see very similar dynamics of, hey, I have this big corporation offering you this proprietary model versus a lot of open source stuff happening. Things like LangChain, things like LLaMA and like llama.cpp, right? Just people re-implementing those things in C++. very similar dynamics that we've seen before, like with the rise of open source. And when I look at like how open source became table stakes for our industry, I don't think people are just dropping this and say, hey, this doesn't matter anymore because AI. So I do expect one of the theories that I have is that we will see a lot more open source adoption of those open source AI models. And I'm hoping like in the future that we can position to our to be a great database to host use cases related to that, not to the full stack of AI applications, that can go to the edge, right? I'm not ready to just say, hey, like whatever. I think we found with Turso was something very valuable, which is this edge story. So I'm not reorienting the company towards like a general purpose database, but there is a part of this AI application landscape that really, I believe, we want to be at the edge. And I'm really excited to be the best database for people to do that. [0:24:15] Noah Labhart: Let's switch to you, Glauber. Who influences the way that you work? Name a person or many persons or something you look up to and why. [0:24:23] Glauber Costa: I don't have anybody in technology and business I think that I look forward to. And I think the reason for that is that I've met most of them. Have you heard that phrase like never meet your heroes? I think I'm a lot more influenced by dead people because they were likely as horrible, but we just don't know. So one person that I think influences me a lot was Emperor Marcus Aurelius. So the Stoics in general are people that I have a lot of respect for. And I try to, I mostly fail, but I try to bring a lot of those principles to my life and to my work on like how to just look at the world and understand that, you know what, we're all aft anyway. So just raise your head, make the best of it and go forward. And I bet that he's done a lot of horrible things, but we don't know about it. He's not around. So you never get disappointed. So looking out for dead people is always a good thing to do. Yes. [0:25:17] Noah Labhart: Okay. Well, Glauber, last question. getting on a plane and you're sitting next to a young entrepreneur who's built the next big thing they're jazzed about it they can't wait to show it off to the world and can't wait to show it off to you right there on the plane what advice do you give that person having gone down this road a bit [0:25:34] Glauber Costa: just build it and ship it this is the usual like startup advice but i think that again we haven't done it that great that well in the beginning of this company like before we reoriented the the company to true. So we try to take this into a lot more account now. And again, the reason for that is that I think it's really hard at the end of the day to like build something and not fall in love with that and just keep pushing. But I think the advice that I would give this person is just build your stuff, put it out there, see what comes out and be ready to always change directions. Like be very flexible, resist the temptation, understand, look around you, understand understand how the world and how yourself will pile this pressure every now and then you see stories like figma that this guy was just building this product not really getting all that traction for four years building the engine of this or that or that you hear those amazing stories about this person with a vision that just kept doing it so you always think that that's the same thing that's going to happen to me it's very unlikely though so the advice that i would give to the young the statistics. And unless you really have this vision, have the money, the funds and the infrastructure, because I think Figma also wouldn't have survived in today's interest rates. Unless you're the right person at the right time, at the right situation, you're just like everyone else. So if the situation calls for it, just be ready to look around and understand that maybe let's do something else and be very receptive to what the market is telling you. That's [0:27:07] Noah Labhart: great advice. Well, Glauber, thank you for being on the show today. And thank you for telling the creation story of Turso. [0:27:13] Glauber Costa: It's my pleasure. Thank you very much for having me. [0:27:18] Noah Labhart: And this concludes another chapter of Code Story. Code Story is hosted and produced by Noah Labhart. Be sure to subscribe on Apple Podcasts, Spotify or the podcasting app of your choice. and when you get a chance leave us a review both things help us out tremendously and thanks again for listening