Sunil: I used a old computer and I could F five refresh, no compile, and you could iterate a million times. You can now do this with full stack applications. Any kid on the other side of the planet can imagine something ambitious and they don't have to hold back and say, well, this is just for south India or for where I can afford servers or this part.
No, this is like, you know what? I'm going to deploy this thing across the planet and find the cheapest providers
Andrew: Hey, before we get started with this fun conversation with Sunil, he's building a lot of really cool things. We want to remind you that we have a Patreon. If you want to hear the full episode, you'll have to become a member over there. You can also support us by going to our merch shop and buying one of our shirts.
And with that, let's get onto the episode.
Andrew: Hello, welcome to Dev Tools fm. This is a podcast about developer tools and the people who make them. I'm Andrew, and this is my co-host
Justin: Hey everyone. Uh, our guest today is Sunil ai. Uh, Sunil works on the React Team at Facebook. He created the CSS and JS Library glamor. He built CloudFlare CLI tool Wrangler, help create Babel macros and many, many other things. It's such a pleasure to have you on sunil. Um, now you're sort of doing your own thing.
You're working on, uh, this project called Party Kit, uh, and we're really excited to have you on to talk about that. Uh, but before we get started talking about React and all the things that you've been up to and and Party Kit, could you tell our audience a little bit about.
Sunil: Uh, hi. Uh, thanks for having me. Uh, I've been looking forward to this. Uh, really nice. Um, I, I think you hit like the major points about the last five, six years of my life. I've, uh, otherwise traveled a bunch. I spent a bunch of time in India, a little bit in the us Of course, I was contracting at the time, and now I've been in London for the last five, six, well, for the lower five years now.
And, uh, it's, uh, pretty great. And, uh, I think I'm, I'm coming up with a founder story. Now that I'm a founder, I have decided that my head is three times, uh, bigger than it used to be. Uh, how lucky for you that you get to talk to me, uh, . Um, but no, I, I, I, uh, I, I did my time in CloudFlare and that was very exciting for me because, um, I got a big insight into what, how powerful something like edge computing can be.
And I've kind of made it my life's mission, so to speak, uh, to drag everyone into the 21st century. Uh, Party Kit is the first project in that where I'm trying to build a platform for collaborative realtime multiplayer apps. But I think it's kind of been the theme of my career so far. Stuff like glamor, uh, uh, bullying my way onto the React team.
And even just joining CloudFlare, CloudFlare, I joined saying like, yeah, I don't like your cli. I want to fix it for you. They're like, sure, just come and do that. Uh, but yeah, that's
Justin: a work
Sunil: pretty much, pretty much, and now I'm at a place where I think, uh, I have a focused idea of a big few big projects and party kit is the first one of them.
So that's the plan, uh, bringing, uh, really, really letting developers build like ambitious ideas as of today. Like, how quickly can we make it
[00:03:21] Path to React
Justin: I, I think it's awesome though that you're branching off and doing your own thing now. So you've had a pretty, uh, a pretty long like storied career. You've like, worked on a lot of stuff and this is sort of, I think, the dream, right?
To like have a nice like technical project that, you know, your career's sort of building, been building up to that you can sort of take and run with. And it's like, yeah, I don't know. I'm, I'm excited for you even in this, you know, I just, I think it sounds really fun.
Sunil: Uh, I, I do have this tendency, if you look at my resume, so to speak, it looks like I've job hopped a lot and I kind of have, uh, but it's been conscious. So what happened is I got into a really good engineering college back, uh, in 2000, uh, 2001. Jesus. I, oh, by the way, fun fact, I just, uh, realized today that I was born closer to the end of World War II than today.
So I am probably the oldest one in the room nowadays, which is just a weird thing to realize. It just happened without me knowing it. Uh, so, so in the last 15, six, well, I close closer to 20 years, really. I've done a bunch of things, like I've built out a big e-commerce stack that scaled really well. At one point, everyone was moving from PHP to node, so I did one of those, right?
Like crazy, uh, scale. Uh, I worked in a design shop for a while. That was really fun. Uh, designers. they should ship, uh, much faster than they do, which is why I went back to a tech company. Uh, moving to London was also interesting, even before I actually, uh, joined the React team. I spent a year and a half, uh, with Oculus doing writing React For VR, which was the most sci-fi fun job of my life.
That is just a, like, very, very cool. Uh, and the only job that I would've left it for was to join the React team. I spent a year in the React team and I didn't do well at all. Well, I did some things well, uh, but then like I moved on. It was the pandemic. Uh, uh, so, uh, uh, a big theme for me has been, Uh, trying to build ambitious tools for ambitious developers.
And the thing is that the world is going through this phase of global peace, and the economy is doing so well right now. So the timing is just perfect, I think to do a startup, uh, you don't have to. The stupidest thing I've said so far, uh, no. I figured it had, it had to be hour, never. Like I finally got a residency and I didn't need a Visa sponsor, which meant that I could actually just do my own thing and I was like, you know what?
I'm just gonna try it for another year. And yo, I gotta tell you like, I didn't realize party kit would have the kind of attention that it's actually grabbed. It's my dms are filled with people who just want to use it, which is why I've been moving so fast, uh, on it. I hope to open it up for local development to everybody, but within like the next three weeks, uh, which would give this thing, I think within two and a half months I've gone from, uh, no code to literally like, yeah, everybody should be building this really quickly, which is nice.
It's, uh, it's, it's nice to move that quickly. Yeah.
Andrew: Yeah. So before we dive into that a little, that a little bit more and like edge computing as a whole, because I'm sure people in our audience have no clue what those two, two words mean together. Uh, let's go a little bit deeper on your time and react. So one thing that you just said that interested me a whole lot and I'd like to hear the story for, is how did you bully your way onto the React team?
How can I do that?
Sunil: Uh,
Andrew: want to do that
Sunil: uh, uh, first you are to be in, well, you, you gotta be incredibly friendly, uh, so people trust you. Uh, , I think that's the
Andrew: So it's like fishing
Sunil: exactly. That's why you, you become everybody's buddy. Uh, no. So what happened is, uh, I, um, I've been involved in the React community for years before that, ever since it like, kind of came out.
In fact, I think, uh, I remember when React native announced, I don't know if you remember, it was a closed beta only for people who attended the conference. Do you remember? Like that, like only the people who showed up for the announcement had access to it. And we were in India and, uh, me and my buddy Perham, we were, uh, we uh, we were seeing just the tweets, in fact, and we saw the blog post and we faked.
Uh, we built it from scratch just based on that. We were like, oh, this is my, this might be what it might be like. And we sent it to Vjeux Christopher Shadu, uh, and he immediately gave us access to the repo. I think we were the first production deployment of React Native in India before anyone else, simply because, like, we just went so fast with it.
So, no. So I've been involved in the React community for a while, since then. Uh, the whole CSS n js thing, there was a fun few years. Uh, I got a bunch of, a lot of people insulted me in public and in the dms as well, but I, I don't have too many regrets about that. Um, I helped out with, uh, uh, when, uh, Dan was making Redux.
Uh, I, I was, uh, well he even credit some of my work for it in the readme. Um, so I kind of had an in with that first wave of people who were working on React related projects and trying to figure out what the edges of this whole new component declarative programming model was. Um, . Then I worked at, uh, Oculus.
Like I said, uh, I actually came, joined Facebook. I spent a year and a half in Oculus. And that the floor there was right above the React floor in London, which meant that every lunch break or every evening, I would just go downstairs, hang out with, uh, Dominic and Dan, because I kind of already knew them as friends.
Um, and I kept like talking to them, especially because, because we were doing the whole reacting VR thing. We kept hitting like the performance edge cases that you could, there you have to, like, if you don't hit 16 milli, uh, uh, 60 milliseconds as a buffer, you are screwed. Like it has to be 60 fps or people are throwing up, uh, if the UI doesn't, uh, step to that.
So I, I kept like interacting with them, had a bunch of ideas. And I think like on one offsite when I went to, uh, Menlo Park, uh, Sophie and Sebastian pulled me aside and said, Hey, you wanna like maybe just work on these things on the team itself? I was like, God, there's a bear shit in the woods. Uh, so yeah, that, that's, uh, that's how I got in.
It was, uh, it was, um, it was quite nice that, uh, uh, they asked me to join and I spent a year with them before I left. Uh, in hindsight, I don't know, man. Maybe there was a bit of a, I don't wanna say a mismatch, but I think I never really found my, I shipped some nice things. I think one, I got 16, 9, 9 out of the door.
Uh, I, I take credit. I don't know if you've ever done this. Do you remember when the method names got the unsafe underscore prefix? Like, uh, a bunch of the, uh, method names? So, um, we were, everyone was freaking out because you would have to rewrite, um, you would have to, uh, rewrite all of those to remove the warnings.
And we had a code mod in place. , but I think I like fixed that to become like a one liner. I don't even, now, if you like for example, you use component will mount or did mount, I forget which one was unsafe. Uh, the console log statement is a, Hey, run this one liner in your code base and replace every instance with unsafe underscore.
Uh, and that I thought was pretty cool like that. Uh, like we didn't get any complaints and over overnight just the usage of that library went, uh, I made the testing api, it was called act well it still is called act. Uh, so that's quite nice. Uh, well, yeah, it was quite important. Uh, it was important basically because hooks kind of changed the scheduling model, so you needed to make sure all effects were run before you could make any, uh, assertions on your, uh, about the elements on screen.
So I did act, I did that. I did some, uh, research work on how suspense would work with images and style sheets, mostly images. That was very cool. And I can't wait for them to like actually ship that because, uh, right now there is exactly one UI framework that has, uh, uh, so if you, if you've used web vitals and, uh, metrics like that, if something called cls, which is cumulative layout shift, which is how a page moves around while it loads, uh, and you want that to be as close to zero as possible, ideally like one frame, but you also don't want to freeze the entire screen, um, waiting for everything to load because that would just d that's pretty much the same as client side rendering anyway.
Uh, so I did some work with images where you would never really see any empty blocks where images would render and they would all call us into like, into like singular commits. And that I think was actually really cool. And I did that work in 2019 and it's still not shipped. I think they've now announced, well announced in the sense they said that's on their roadmap now.
It's called suspense images. So hopefully in 2023. Uh, so that's roughly what I managed. Uh, and I shipped 16.9. There was very much a, the entire team was being lazy about it. So I put on my product, my project manager cap, and said, I'm going to go to literally every single one of you and ask you what the status of your prs were.
So you can thank me for 16.9. That was a good release. Fixed a bunch of
Justin: Nice. Nice.
[00:12:37] Edge Computing
Justin: Well, maybe speaking about solving the world's hard problems, let's, let's talk a little bit about your, you know, life goal, bringing people into future and, uh, sort of like how that relates to what you were thinking about when you were working at Cloud F and, and Edge Computing as a principal.
Sunil: uh, let's talk about edge
Justin: Yeah, yeah. What is Edge Computing
Sunil: love it. Stupidest name ever, by the way. Absolutely stupid name. Uh, and I think it actually originated from iot folks or anything, but let's keep that aside. Let's just actually talk about the problem, uh, so, uh, in the nineties. Sure. Uh, to host a website, you would put all your code on one server and point all your requests at it, and you would get responses fine.
Uh, couple of problem, uh, problems with that. Uh, the more users you have, the more the computer starts getting, uh, hammered. Uh, so you got to put a second computer and now you have a load balancer that splits it out. Uh, you keep doing this. Uh, uh, you eventually have it spread across the country. You're like, yeah, we have some computers in this data center.
We have some computers in this data center. And so in India you would probably put it in the Metros, Bombay del Bangalore, calta, that sort of thing. Uh, and that's good for a while. Uh, but you, and there are trade-offs to that system, and we'll talk about the trade-offs in the middle. Okay. So now that model, now multiply that by a thousand, not just in terms of cities, but even inside cities, you end up having thousands and thousands of little, uh, places where you can put these machines.
Uh, so CloudFlare right now, I think is the definitive one though I think, and for a slightly different reason than Amazon. So they're both in roughly 2 50, 2 75 cities. I suspect CloudFlare will hit 300 sometime this year. Uh, but it's not, uh, CloudFlare actually doesn't have data centers. They will take their racks and install it directly where the ISPs are.
So they don't like, they don't even like the hop to make from your phone. Like the moment it hits the isp, there's a good chance it's hitting a CloudFlare box. Like right there. Uh, either they put their racks or they come and install their software on, uh, this thing. So even though it's 275 cities, it's actually closer to 10,000, what they call points of presence, because they just make deals with all these ISPs, all these telecommunication people, and just put their software all there.
So when they say edge, I think the word edge refers to it's on the very edge of your boundary with the real internet, which is, hey, the moment your packets bounce off one or two cells, . So that's what Edge Computing is. It's basically this idea of number of servers, but spread across the world. Uh, but there are some trade-offs there.
Uh, in your older model, it was your responsibility to literally make sure the computer was running and to have monitoring software on it and to run a little script. System d I think used to be like the old one that did it, which would like literally spin it up and you'd use something like Norman or whatever to, uh, check if, uh, the process was running.
If it wasn't, spin it up again. Anytime it dies, this would all be your headache. Uh, uh, in the edge computing world, it takes some of that headache away from you. It takes the system, takes, uh, uh, responsibility for spinning up these threads and processes and it gives you like some form of monitoring observability for it.
Uh, but the trade-offs are also, so for example, CloudFlare uses V eight. V eight is h our script engine, much like I think the one that powers Safari is called. JavaScript core, I think, uh, something like that. Uh, uh, what, uh, so, uh, V8 is the one that, uh, Chrome came up with in the late two thousands and is now used by Node, et cetera.
So, uh, CloudFlare uses a, a version of it where it can spin up thousands of these things that they call isolates on the same machine, where each one is given about like 1 28 MB of RAM and some cpu, which it turns out is actually really great for the use case of taking a bunch of requests and throwing it back up, like just sending responses on it.
Uh, and so it works, but the trade off now is, oh, you, if it's just 1 28 MB of ram, you can't really run. Oh, and at the time they had like a one MB script limit. I think now they, if you're a paying customer, you have a five MB script limit, which means you are not shifting, uh, you're not, uh, sending like some big binary.
You are not running fff mpeg, you're not running video encoding on these systems, which is a good use, which is a good trade off, right? Like if you're running FFF m Peg, Uh, there's a good chance that you don't need a 10 millisecond latency thing. You can run that on a few servers somewhere and use CloudFlare to talk to them.
Uh, but it turns out for a good 80, 90% of use cases, this model is really great, especially like serving websites and static stuff and APIs with proxies, what have you. Um, and that's kind of what CloudFlare is betting on. Everybody talk, and my mental model for it has changed a little bit. It used to be, uh, oh imagine tens of thousands of servers, uh, but now I like to imagine this, uh, stretchy balloon or like a Bucky ball of servers just covering the planet.
Imagine, like I imagine it to be like one server with many thousands and potentially millions of processes running for you. And the moment you make a request, it basically just finds the part on the stretchy balloon that's closest to you and responds to that. Uh, the big trade-off is data, right? Your cap theorem is immutable.
Uh, you can now choose to have earth centralized database, and the folks who are closest to it will have good response times. The cloaks, clo uh, the folks who are farthest from it will have bad words, response times. Uh, so now you, you end up in the same problem, but it's much harder with data. Okay? So now you have two databases, let's say on two sides of the planet.
So now, if somebody makes a right to this server, uh, and somebody makes a read from this server, how does it stay consistent? How do you make sure that it stays consistent? And that's been a favorite comp computer science problem for the last 60 years. It's, there's the cap tier, like you have to, okay, now one is a leader and you have read replicas and you have to make sure.
So, uh, so data is actually an, an unsolved problem, I think even for CloudFlare, but they're working on it. They have a database that they call D one. Um, , which is interesting. I don't even think it's in, like, some people use it in production, but it's not fully production ready yet. Uh, fly the Fly. IO folks are working on some stuff with, uh, SQLite.
Justin: Yeah.
Sunil: Uh, uh, that team is sensational,
Justin: Oh yeah, yeah, yeah,
Sunil: I forget. Yeah. They're, uh, they're doing some very exciting work. I would keep an eye on them. I know Deno is working on stuff like this. AWS always has like 12 databases that it wants to sell you to solve one of these problems.
Justin: yeah. So Cloudflare's database, is it, is it D three? Is that the one? Or,
Sunil: D one, it's called
Justin: But it's like a, it's like SQLite basically, isn't it?
Sunil: it is SQLite. Yeah. Yeah, yeah. It's
Justin: Yeah. Super interesting.
Sunil: uh, that it's very weird that SQLite is having this cultural moment Sagain over the last two years.
Justin: like resurgence. It's, well, I say resurgence, that's a misnomer cuz it's like the most widely used database on the planet, right?
Sunil: well, it's on everyone's phone, right? Yeah. Uh, the thing I'm hearing is that Chrome is also going to ship SQLite now. Is that right? I think so. I think they might be moving away from web sql, what have you, and literally shipping a four
Justin: Well, so SQLite has a WASM extension that they built in, like that they're, the team is actually supporting, right? So it's like there's better browser support for it now. Um, but ironically Chrome is also changing their cashing rules. So it's like they're, uh, , they're breaking the cache boundaries across, uh, domains or whatever.
Sunil: Which is now every
Justin: Yeah. You know, all your WA and modules no longer shared, uh, too bad.
[00:20:46] Bringing the World Together
Andrew: Okay, so you gave us a pretty good overview of like what edge computing is as a space, but out of that space, like what excites you the most about it? What, how, how does this look like a new frontier of computing to you? How, yeah.
Sunil: Alright, so the big obvious one for me is a thing that's been close to my heart for computing for all of my career. Social mobility, uh, technology always, uh, starts from a place of, uh, two things. One is, uh, only experts can use it, uh, and it requires money. It requires capital, uh, both in terms of, uh, money to spend on like hardware, et cetera, but also to spend on people to manage these things.
Uh, in the nineties websites were made by experts, uh, but then it got commoditized. And, uh, long story short, now you can just sign up for a free database and use a JavaScript plan to it. You don't need to be a database expert to use a, this was a case to even write a PHP website and CGI bin and what have you.
You'd have to find a, a VPs. Provider. And, uh, so, uh, but for me, the big deal is that technology actually gave me social mobility. So I did real, I I got into a really good engineering college, and then I immediately discovered alcohol and marijuana, and I did really poorly. Uh, it was great, but I don't remember much of it.
That's, that's, that's, uh, that's what it is. Um, so I found myself, uh, with all my plans, uh, in disarray. Like I just, uh, I, I wanted to do a postcard. Everything, all of those plans were gone. And I found a job doing front end development for a firm in Haba, India. And it was amazing. I loved it. I was like, oh shit, this is awesome.
But this was at the time when JavaScript and front fronted development was still considered not real engineering. Um, it, uh, uh, which was fine by me. It paid the bills. It didn't even pay that well. But I, uh, uh, roommate with a guy who was into comic, he had like a shit ton of comic books. So I would read comic books all night, then go write JavaScript all day.
It was amazing. I, I missed that. Yeah, I, I, I missed that career a lot. And he was the kind of nerd who loved collecting single issues, not like graphic mall. So he had all the originals and everything. Um, anyway, uh, that's a whole other story. Um, but it kind of got me out of, uh, baddest situation. Uh, but also the two thousands were about, uh, India becoming, uh, uh, uh, the outsourcing center of the world.
So it pulled thousands and millions of people out of, uh, it gave them a way better career that they could support their families, that could support, uh, their even friends, whatever, like it, uh, ba basically gave them a way to move into higher strata, uh, in the, uh, as a socioeconomic, sorry, uh, uh, I don't know the words they did well for themselves.
Like, uh, technology and programming gave them a way which, uh, uh, to do well in the world. And it actually raised India's, uh, level in the world as well. And for me, that has always been important, which is, oh shit, this is one thing technology does. Uh, which is why I'm not really scared of AI and L L M. I'm like, no, no, no, no, no.
Like it is going to bring the next few million people up. This is kind of what we want. Now, it's another thing that there seem to be very few players for collecting capital at the top, but that's also a problem I think that open source will solve regardless. Um, That said, uh, an unattainable thing has always been scale, uh, scale in terms of being able to deploy your ideas across the world.
Uh, it kind of happened for static sites in the early 2000 tens, 2015, uh, but real dynamic working stuff where you have compute and storage that is now becoming accessible, via edge computing to the rest of the world. CloudFlare, when you deploy code on CloudFlare, for example, you don't choose a reason.
They don't let you choose a region. They decide where and how the code is going to be across the world based on usage, all that jazz. And that's how they can keep it so cheap. And it is so cheap. It fundamentally means now that. I became a front end developer because two things, right? The internet was cheap for me and I didn't need a powerful computer to program it.
I used a shitty old computer and I could F five refresh, no compile, and you could iterate a million times. You can now do this with full stack applications, uh, for anybo. Any kid, uh, on the other side of the planet, uh, can imagine something ambitious. Hey, I want to build an app for fill in the blanks. And they don't have to hold back and say, well, this is just for, let's say just, uh, uh, south India or for where I can afford servers or this part.
No, this is like, you know what? I'm going to, uh, deploy this thing across the planet and find the cheapest providers. And edge computing provides social mobility, and I wish more people like saw this, that you can take it. It is very easy to achieve scale now with edge computing.
That's one thing. The second, and that's the thing that I'm working on right now, is the types of applications can now be more ambitious, especially at this time when literally everything has changed in the last five, six months, you would be like, you cannot deny that something very new is brewing and it's not crypto.
Uh,
Andrew: Thank God,
Sunil: yeah, I,
Andrew: something.
Sunil: I, I really did not want to learn rust, bro. Like, I was like, no, I don't want to do this. Um, so no, like in this, in this interesting period, like how do you make. , this sort of, um, so keeping aside the AI l l M stuff, you still need GPUs for that. But again, that the cost of the, the required cost of those GPUs has already gone down in three months.
It keep going down, but, um, uh, the types of applications that are built for the last five, 10 years, we have gravitated towards this somewhat sta uh, okay. Mostly static, but the dynamic nature is mostly on the front end, like very client side animationy stuff. Uh, but the moment you want to build anything that's comp, the, it is not within the grasp of a regular person to build Google Docs today as an, as a weekend project. Uh, this is, I'm clearly segueing into here, but let me, let, let, let me, let me talk about it. Wh why it's important to me. It turns out, uh, uh, in the last two or three years, some things have happened, which is some of the libraries and ecosystems have matured. So, uh, there's a very popular library called Y Js.
It's a li for CDTs, these conflict resolution data types. Uh, another one that just had a version 2.0 VAM release two days ago was
Andrew: uh, auto merge. Yeah.
Sunil: So good. And the team behind that in can switch folks. Oh, legends. Uh, there's also something which isn't really A C R D T, but it's called Replica. Uh, they seem to have a bunch of, uh, uh, attention at the moment because they kind of do a video game style strategy of doing syncing.
Like it's kind of like rollback net code, uh, which is a whole other thing. But they have a model. Uh, there's also a third party service, which just had a one or two launch literally a few hours ago called Live Blocks. Uh, their pricing's a little weird, but they're actually such a smooth, polished product.
Uh, I look forward to competing with them. Um, Anyway, so, um, so some of those libraries have come into place, but, uh, it's unfor it's unfortunate that the platform for deploying this, I wanna say it doesn't exist right now, but it does exist. And that's my job. Like, to make it more accessible to everyone else.
I'll give, I, I I, I, I did a write up. So let me explain, uh, what the pro, let's say you're building a collaborative application and it's, uh, uh, five people working on a document. Okay. Like, uh, just a Google Docs document. Uh, so you, when you're building this locally, you'll run a little node server, uh, and you will say that, uh, you'll make a little cons.
Opt obj, which holds the state of the entire. Okay. Uh, and you will start reading stuff. Let's say you're using web sockets for this. It could be ht uh, http as well. But let's say you're saying using web sockets and why web sockets. You're sending these messages, which is like, Hey, edit this, change this, uh, little bit to something else.
Change, uh, something, uh, let's just say it's a counter. Uh, you can send increment and decrement functions. Okay? So use 1, 1, 1, 1, 1, 1, and you refresh it in your page. And you see it keeps increasing. When, when I repress the button and you're like, oh, that's awesome. Uh, let me deploy it out onto some cluster of servers. Uh, and then you share the URL with your friends, and, uh, immediately you start seeing problems, which is everybody's just seeing the number one, uh, your clicks on the number one are not being shown on their screen. Five of them are in the same room and they can see it, but for some reason it's not happening for you.
And the reason for this is, uh, the model is split, right? There are multiple processes. Each process is holding its own instance of. This OBJ model or whatever counter model you're using. So now you end up having to, uh, I, I won't go through all the intermediate steps. What ends up happening is that you need to use like one centralized reader's instance to maintain the state of all the connections and all the documents.
It immediately becomes this distributed systems problem. And as we know, distributed systems are the easiest problem to solve in computer science. Uh, uh, so no. So, uh, and that is the problem, right? So it doesn't matter how distributed all your compute is, like across the world, you end up with the same kind of problem with databases that you need some centralized data store to like synchronize the stuff.
And that is slow as shit. You start, uh, you age slow as shit. Like, you'd never get the kind of like instant feedback. Like you can be having like a call, let's say like a Google talk call and people typing, but there's like multi second delay simply because these packets have to travel across the planet and it just, it just sucks.
Um, So, uh, yeah, that's, that's the problem. We are done. Uh, no, no, no. So the, the, there is a solution here. Uh, uh, anyway, so, wait, uh, before I get to the solution, there are two other big problems. One big-ish problem here. Since now you need to do this whole reader's thing and you need to manage a whole cluster of servers, et cetera.
Deploying this product into production now means you need to hire people and you need to spend a bunch of money on their time and effort and tools to manage it. This means that the kid who has an idea just to deploy a multiplayer roleplaying game, nothing too complicated, screwed, he's not gonna push it out there, which is why the kind of web applications we've seen, how kind of reached a plateau in the kind of stuff that we build.
And the only people who do complicated stuff is your Google or your Figma 20 bill, uh, or, um, what are, uh, Quick video game companies because they can spend the money on it. Awesome. So what is the cloud edge computing solve for this? It's fucking awesome. Uh, for a given. CloudFlare has has this tech, it's called durable objects, but I assume other providers will as well.
It inwards the edge computing model and it says, Hey, we will give you that original computing model that you did lo local development with for a given id. We will make sure that everybody who connects to it literally connects to the same isolate, the same process that I was talking
Justin: Hmm.
Sunil: Uh, no matter where they're connecting from the world.
The nice thing about something that's collaborative is usually like they're within a five to eight hour time zone. So the latency isn't actually that much, uh, but it does mean that there is just a line of sight. Um, latency between all the players who are connecting to this. I do a lot of gesturing, and my problem is that my hands are outside of this, uh, rectangle, by the way, so I have to keep bringing it in, but assume I'm waving you, you can see it, but I'm waving my hands
Justin: It'll be in the full screen though, so you're fine. You're good.
Andrew: Yeah, you'll be in the YouTube video, hands
Sunil: Oh, damn. Oh really? I didn't, oh, damn. See, I should have kept a very cool guitar just here, uh, that I would be like, oh, this guitar. I didn't notice that. My last balls right here. Okay. Okay. Okay. Uh, so yeah, no, so it does that and, uh, this is ultra fascinating because. it's brilliantly fast. These packets don't have to travel across the planet anymore.
And it's kind of like self optimizing. The people who are using these things like end up connecting to the same thing across the planet. Much like the original compute model, right? Like the original compute model that I was talking about. As I said, that like for one person, it would find the closest thing.
Now for the five people, it'll find like the closest point to connect to. Uh, and the programming model is so simple now, like you can literally hold, for example, an array of web socket connections. And if you want to like broadcast, you say, yeah, four connection in this, just do a dot send message. Uh, it, uh, stuff like the replica model, multiplayer, gaming, all this collaborative stuff, uh, becomes extremely simple to, not extremely simple, but relatively easy to start developing for.
and it does. The other thing which I really like about this technology, which is that it makes it way cheaper, like dramatically cheaper. If your game doesn't get any attention, uh, then it's fine. It's probably going to be within the free tier. Like CloudFlare has a very nice, well, I'm also going to have a free tier.
Please use part ticket for this. Uh, and uh, uh, if it does well, then it prob a, it probably means you're pro ho. Hopefully you've slapped an ad on the page and that revenue itself will like pay for it. Uh, but do you see what I mean when I talk about like ambitious applications? It's not about, Hey, I want you to solve hard problems.
It's that the platform has solved a bunch of the hard problems for you. You should be working on your business logic slash game slash big next big idea. Uh, and that's what excites me about, uh, edge computing. That's kind of what I want to, when I say I want to drag developers into the 21st century, my whole point is that this.
um, technology exists today, like today, uh, but it is not accessible yet because it's because engineers love engineering problems and they don't like making it a product that, uh, everyone can use. Uh, and that's, uh, kind of the thing that's driving me. Uh, I, uh, I wake up every day and I'm like, yeah, I'm going to, uh, I think I can do this.
Uh, and it, to be fair, it's not just me. Like, it's actually quite exciting to see that multiple players at the same cultural moment are working on the same problem. Uh, and it's, uh, awesome. I'm glad I have competition. I'm looking forward to this.
Justin: Yeah, you're talking about edge computing being this, um, sort of tool to level the playing field a little bit to provide some economic mobility, social mobility. Uh, something that we talk a lot about on the podcast over many episodes is incidental complexity and the cost that it has on our development story.
And I, and it's one of the reasons why we wanted to do this podcast and in general is cuz like tools generally help with this, right? They h hopefully help lower your, your incidental complexity. Um, and as I've gotten older and. , maybe wiser. Hopefully wiser. I find that like I value platforms that allow me to write less code to express the, the, you know, solution to the product problem that I'm trying to solve, right?
It's like, I'm not trying to invent a new framework here. I just want to render some pixels on the screen and I want to do it in a way that somebody can come behind me in two years and like read it and understand it and maintain it and make changes without hopefully it being intimidating. You know, it's unfortunate if you need, you know, somebody who's been in the industry for 15 years to edit your web app, right?
Like, that's such an unfortunate problem to have. Um,
Sunil: 100%.
[00:36:48] PartyKit
Justin: So I'm super excited about this and, and also it's interesting, so I just looking at some of the stuff that you've posted on Party Kit, you know, back in the day I used like Socket.Io to like play around with some like real time games and stuff and, and I feel like.
There hasn't been, besides some of the, the services like replicache and Live Blocks and like some of the companies solving this problem, there hasn't been a whole lot of like as much library movement it feels like in the past, like five years or so. Especially in until sort of like now I guess is like, it is really interesting.
That's kind of coming to a head
Sunil: See bang on, right? Like I, I, you're just, in fact, think about it. Uh, the guy who made Socket io is Guillermo Rauch who runs Vercel and Vercel does not have a realtime story right
Justin: That's kind of wild, isn't
Sunil: simply because Right? And it's because it's been operationally hard and expensive. There's, there was a lot of innovation that happened on the client side part of things.
Uh, but, and even on the server like Socket.io is gold standard. I'm totally going to rip it off for a library for party kit. Uh, but uh, there was never really any innovation on the platform side. You were always reinventing these things in user land. So the moment you try to do anything ambitious, It would immediately become way too expensive to like manage.
And unless you are a big company, uh, you just wouldn't, you'd be like, yeah, we are just not going to do this. We can solve some other problem right now. But that is changing that, that exactly that problem now is changing with edge compute and so on. Well, I, yeah,
Andrew: so like what does working with Party Kit feel like? So like, like what does it compare to with not working with Party Kit?
Sunil: Love it. Uh, party brings some very, okay. So there are a number of services out there right now that, uh, a number of them have been out there for a while, in fact, and they all have their own strengths. there have been some players like Pusher Aly, which is like pop sub message, sending you drop a message in somewhere else.
You can hear it on a topic, et cetera. Um, uh, replicache right now is only a client, well, it's just the software that you would deploy onto a platform. Um, live Blocks is a third party service where most of the lo all of the logic for you, you have to basically handle on the client side. The angle I'm taking with Party Kit is that it's an end-to-end platform slash toolkit, and I explain what that means.
The first one is that you get to write your own code. Uh, it you, in the simplest form, it's just a, you export one function that says, Hey, on Connect web socket to a room, what do you do? Uh, and it turns, uh, I just love that that's the API because, uh, all the complexity, so to speak is hidden behind that, all the connection to a room.
uh, distributing it across the planet, et cetera. Even, uh, even the storage API just comes with it. Uh, so the number of features that you actually get to write your own code, which I think is super important because it means that you get to pick the trade-offs, uh, ins, uh, uh, instead of a third party service that says, Hey, this is how you should build applications.
You get to build on it and make changes to it, or add two or three of them together. You get to deploy NPM packages, whatever JavaScript runs in this thing. And Vom, I just la uh, landed wam support last week, uh, which is good because auto merge 2.0 is vam. So I'm gonna get the new Y js, which is written and rust and auto merge, uh, and replica, uh, as well, uh, running on.
And my socket, I clone possibly a loud blocks clone as well. Let's see. Uh, I, you get to pick, like, that's just the whole point of this is a, that you get to pick, uh, partykit also like responds to regular http requests. So you also get to, uh, Sorry, one second. Uh, so you also get to write regular http request response handlers if you don't want to do a web socket, which is great when you're writing something like a mobile website and you don't want it sucking up battery, so you can do like long polling, just one call every time.
Justin: Awesome.
Sunil: like it. Uh, so the first, so you get to write your own code. Uh, b uh, you get all the niceties that you expect from a development platform like this. Uh, stealing some ideas from not just word cell, but also CloudFlare pages, uh, Heroku, whatever. So environment variables where you need secrets, all that stuff.
Uh, preview URLs. So every PR gets a URL that you can test with your application. And if you're happy with it, uh, you use it and land it. And when you close the pr it magically disappears. Just such a great feature. Uh, and which is very hard for a third party service to do, especially if they don't let you write your own code.
But this does it, uh, analytics of the, uh, Per room usage basis. In fact, I think I might just expose the analytics back as an API so people can take it and do well. They might want to pass on the costs to their users and customers. So I, this has to be a platform for platforms. Um, Pardi also comes with libraries, uh, uh, and all, all of this is open source.
Literally two things are not open sourced, which is the core, uh, part that I deploy onto my servers and my dashboard, because I don't want people seeing my css. I have not written proper CSS in like four years. Uh, I refuse to put that in, in the, in the public repository.
Andrew: Well, well, yeah. You were writing CSS and JS for so long. How could you
Sunil: how could I, I have forgotten all the basics, however, maybe so , um, so no.
Uh, but I'm, uh, there are a bunch of libraries. So for example, Y J s, uh, currently doesn't work on CloudFlare or any of that. So I wrote that from scratch and. , in fact, that's nice. It's basically four lines of code and you get a fully functioning, scalable y js backend with persistence. Uh, I get auto merge working as well.
I have this resilient web socket thing that does retry and buffering when it's not connected. And of that, uh, honestly, one of the big because of this, and that's what I like about good design, one of the nice things about this is a, not only do you have a local development story, but you get to write tests for your own code, right?
And run it on GitHub actions or your air gap machine that doesn't talk outside to any external services and all that. So like, it's, it's a proper developer toolkit end-to-end. You get libraries, testing utilities, local, uh, for stuff. And then you finally get to deploy it onto the edge. Uh, the edge CloudFlare has, uh, started, stopped, has stopped calling it the Edge.
By the way, I don't know if you know this. They're, uh, trying to push the phrase Super Cloud. So I will push it onto,
Justin: Uh,
Sunil: Uh, I have a lot of friends there, so I refuse to comment on it publicly. Uh, so I push it onto the super cloud, uh, which is effectively my thing that uses CloudFlare, but also some other like, fun proprietary shit, mostly just to like, do metrics and analytics and stuff.
Uh, but yeah, you push it out there and within a few seconds it's available across the planet so you can start using it. So there's this whole end-to-end experience that I want developers to feel comfortable using because the, those are the standards that the tools before us have brought so far. So that's the thing I'm building.
And there are a couple of other things. There's like, admin is for seeing how many rooms are starting up new rooms, GDPR compatibility. So you make sure that a room and its storage is only within, uh, uh, the European Union. Um, which, uh, we used to be a part of, uh, the uk. And, uh, they decided we decided to do our own thing.
Um, anyway, but so like GDPR compared is a part of the story. Um, what else, what else do I got? Uh, yeah, but I, I think like that's the rough story. Like it's, it's the, what I'm really, I'm building the kind of platform that I would like to use to build my realtime applications. And what that means is that within, under five minutes, I have something that's working, ready to go, like a setup that's ready to go.
I don't have to worry about, I use esb, like I ship es build, so you can use any unpaid module, it bundles, ities it, all that stuff. Uh, I would like to use it with anything else. Oh, that's the other part of this. Use it with your Wordell, uh, pure network, uh, pure. This thing, this is just the side chain that does the networking around it.
So I wanted this platform to exist for myself to build realtime apps, and it's kind of what a building. So that's what Party Kit does. It's the, uh, it, it is perfect and it has no trade offs. Amazing
[00:45:41] Building for the Future
Andrew: Yeah, so, so in summation, it sounds like it's a, uh, realtime Vercel basically like batteries included deployments. You get, you, your party kit is your next Js. Uh, you can go from nothing to real-time app in five minutes.
Sunil: it. Stealing that line. Putting it in my pitch deck. Yes.
Andrew: nice.
Sunil: Uh, I, uh, I, yeah, that's, that's pretty much it. I, uh, maybe, maybe I should just start calling it Vercel for web sockets. Sell for real time. There are trade offs, right? Like, and, and I, maybe that's the thing that I should also call out, which is, um, so the big trade off right now is in this model, like I said, everyone like connects to like one single isolate.
It suddenly means that you can't do high concurrency things here. So, for example, you can't build discord simply because you can't have thousands of people connecting to a 1 28 MB Ram thing, which is fine. That is very much the trade off, uh, that I want. In fact, part of me thinks that chat was such a big distraction from realtime apps.
Like, everyone built these things and said, well build the next chat system on that time. Like, why, why would I do that? Like, I have Twitter, I have Discord, like I don't need a third or fourth thing. Uh, the other thing, and I probably will ship it in at some point, which is, uh, I could also imagine doing audio and video with the exact same, uh, infrastructure, which is, hey, connect to one thing and, uh, Super fast audio video instead of having to, in fact, I assume without doing web RTC or peer-to-peer, but you know what, actually I've got a little bit of pushback from the people I've spoken to about this.
I thought it would be a killer feature. And they're like, no, we already have Google Talk, zoom, Skype, whatever going, all we need is something to show the other rest of the application on. And it's come up so much that it's just, uh, it goes against all intuition I had about this. But yeah, people, uh, aren't really looking for audio video.
Maybe it's a, maybe it's a question of time. I think, uh, the more people start building realtime apps, which a lot of people don't right now, I think once they start doing that, uh, I think they'll probably want audio video in it and I'll get to it in a bit. Um,
Andrew: Yeah, I think, uh, audio and video are kind of like last mile sort of things. We definitely are feeling the edges of like what browsers and computers can do right now.
Sunil: I have a bunch of plans for party kit right now. It's very much the, hey, there's, I think the pandemic high of everything has to be collaborative all the time, has subsided. Turns out you don't actually want to be starting at a screen and doing all that all the time, but now it turns out.
Remote work is created in pieces, and there are multiple forms of collaboration. It's not just the everyone on the same document at the same time. It's also asynchronous. It's your GitHub. Uh, it's also, uh, a Google Doc style where you don't actually get to edit the doc, but you get to leave suggestions and people say, accept sectors.
Accept, accept. Uh, and I think I want to get there. Uh, the web is a big part of it, but there are two or three other platforms that I want to hit. Uh, I think ar vr is a big space. Uh, once Apple launches, its $3,000 glasses. I want some of that Apple money is what it is. Uh, I think so. I think I, I think that will be a part of it.
Uh, number of people, I, I, I hadn't planned on doing games at all, but the number of kids who show up in my DM saying, Hey, can I use your stuff? Like I have an idea for a game. And I'm like, oh, shit, I won't have to do. And it's like roleplaying, not like, Aaa, uh, F p s stuff, I'm like, oh, sh a hundred percent. I definitely want to enable you people, which is why one of the features that party Kit will ship with is a free tier.
I have to make sure that people can do experiments and ship their stuff to vaguely production without worrying about costs. I, I have to solve this for them. I'm very excited.
Andrew: an exciting prospect. I, I, I, myself love free tiers also. It's, uh, helped me get, uh, experience with a lot of different tools and a lot of different environments I might have not, uh, encountered before.
Justin: There's something to be
Sunil: see what I meant about social mobility?
Andrew: Yeah, exactly. Great point. Uh, one I had never thought of but is like an amazing point,
Sunil: It is third dream of techno. Yeah. Right. Like it has it's third dream of technology. It's, it's, it fundamentally saved my life. I mean, I kept smoking weed for a few more years after that, even so, but, uh, I, I don't anymore, which I miss. I mean, no, just to be clear, nobody should smoke weed. It kind of ruins your life, but while it's ruined, you feel like Pink Floyd sounds amazing. uh But yeah, I think technology, like, uh, it, it's, it changes life so dramatically if like it's done right. I, I feel strongly enough about that.
Justin: So, uh, moving on to, like, before we move on to Tooltips, we always try to ask a forward-looking question or, uh, a question about, uh, how you approach something and how it'll, you know, how you envisioning it going in the future. So we had something that we were gonna ask. , there's a common question that we've brought up in a lot of other conversations.
You, you mentioned a lot of party kit is open source and you, you're taking this big adventure. You know, you're going off, you're doing your own thing, you're building kick ass technology and, you know, living the life. Uh, but at the end of the day, we all have bills to pay. How, how are you planning to make this a sustainable endeavor for yourself?
Sunil: Uh, I have two or three ideas. Uh, so I'm gonna start raising, uh, this month within the next two weeks or so. Uh, I hope, uh, I would like some of that venture capital and money. Um, like I said, the economy is in such a good place right now. I'm, I'm sure I won't have any problem, uh, getting that, um, ? No. Uh, so venture capital, no.
I, I, that said, I am actually kind of confident. I think the story's coming along like really well, and the kind of interest that party kit gotten is very much a, listen, I need the money simply too, because people are asking for it. Uh, and I build, I build and ship fairly quickly. So this is something I can validate, uh, fairly well.
Uh, the other two things are, well, I, uh, I feel very strongly about charging for usage and not for users. A lot of people like charging on the basis of like connections and users connecting. Uh, that's not great, especially for realtime apps because, uh, if you charge per user, you end up, um, use cases actually get very narrow where it has to be for stuff that lasts a long period of time and very few, uh, much fewer sessions.
Uh, what I want is for sessions to be like really cheap and for a lot of people to come in, come out, and it turns out to do that, you need to charge on the basis of usage. Uh, but the nice thing about charging for usage is that you can walk up to a, let's call them a bank, uh, uh, PJ Morgan, whatever. Uh, and uh, you can charge for enterprise, like you charge for the people who actually like, have their money.
Because if it turns out to be a useful tool in the small, it's also a useful tool in the big for people who do spend a bunch staring at the screen. Um, especially. And uh, the nice thing about tools like this of course, is because party kit is so fast, it's so freaking fast, uh, people just end up using it more because it's.
comfortable to spend time in. That's the nice thing about having software that's tuned for performance, which is you don't feel exhausted by using it. That's one thing you learn when building user interfaces. Uh, so, uh, that's one, uh, that's the other one, which is I just want to charge enterprises and people for money.
Um, I'm pretty good at keeping my costs itself down. Uh, I suspect that my costs will, uh, nice thing about being me is I like remote work, which means I probably won't even have an office for many months. Uh, I'm talking to you from my dinner table right now, like there's a lot of junk right behind this. Uh, so I know how to keep like my costs down.
That being said, the reason to raise is so that I can work with, uh, other talented people. Uh, I have my eye on a few people and I would like to throw some money at them and say, Hey, come, let's build, uh, CRDs in, uh, on the edge. Um, but honestly, with the amount of interest that this has and with some of the plans that I have, uh, I suspect that, uh, this thing will just like, sort of pay for itself.
I'm not buying a Lambo bro, like Lambos are Rerated. I'd like one of those, uh, Suzuki Swifts because that's the hatchback I had back in India. It's not an expensive car. Uh, and I just want to like, chill on the English countryside and drive around my man's frugal. Uh, it's not gonna be
Justin: Hey. There you go. There you go.
Sunil: does that have, it's not, it's kind of a corporate of an answer, but that's mostly it, which is if it does well, it does well.
And if it doesn't, uh, either I move on to the next thing or I get a job or something. But as of now, my priority really is, Hey, this is something I believe should exist and that's why I'm building it. It's, uh, this isn't, this isn't my billion. it would be nice to make a billion of this, but I don't think, uh, I don't think this is, uh, the play for this is very much a, this should exist because, uh, I'm sick of not seeing applications that are, that could be
Justin: Right, right. I honestly think that's the best reason to build something. Uh, you know, if you're, if you're in it for the money, uh, I think your product will suffer and you know, unless you're just really, really good then, you know, I guess more power to you
Sunil: Mm-hmm.
Andrew: That's the problem though, finding the projects where you can make money from. But Sunil, I think you found one. This seems like a, a project where you can make money.
Justin: and,
Sunil: I make some money enough to make rent.
Justin: I think importantly, this, this, you know, rounding back to sort of what you, what you started with when we're talking about edge computing as like, you know, social mobility, this definitely takes a complicated problem, domain, uh, and makes it more approachable and more feasible. And, you know, if it helps some kids out there make games or someone publish their first, you know, real time app or whatever, that'll be, you know, tremendously valuable in and of itself.
So it's awesome.
Sunil: Oh, I know how I'm gonna make money. I'm gonna charge all the l l m dudes. Ah, that's what it is. Oh, that's part of the story. Uh, so if humans use a web socket, I'm going to charge X. But if an l l M is connected to a thing, I'm charging 10 x. That's okay. That's the, that's the plan. Done. Done. Okay. I got the monetization
Justin: Nice. Nice..
Andrew: Okay, well that wraps it up, uh, for tooltip and for the episode. Thanks for coming on, Sunil. This was a super interesting conversation about how applications might be structured in the future and how you hope they will be structured. So, uh, I wish you luck and it looks like built something really cool here.
Sunil: so much. I'm very grateful to come on. I do like talking about my work and, uh, now that I'm working on it alone, I get like, not that much opportunity. So it was really fun to talk to y'all. Uh, please edit this to make me smarter, sound smarter than I actually am.
Justin: Yeah. So no such a pleasure. Uh, so good talking to you again. Hopefully I'll come back to London sometime soon and we can, uh,
Sunil: Looking forward to it. Let's party when you're in
Justin: hang out at the teal draw office again. like.
Sunil: Hell yeah, of course. Most definitely. Most
Justin: we're all gonna have to go. We'll have a Dev Tools episode from the tldraw office. We'll just have everybody
Andrew: I'm, I'm down. Tell me the next time you're going to London. I, I got her credit card. I can buy a buy a plane
Sunil: So, by the way, this is, uh, Steve's, uh, uh, uh, business idea, which is if tldraw doesn't work out, he'll just keep getting developers over to the tldraw office. Uh, and he's going to rename the company to CloutFlare. That's what it's gonna make up.
Justin: was it Cloud Flout or something like
Sunil: Clout. CloudFlare? It's CloutFlare
Andrew: Clout flare. Yeah. Nice.