skip to content

Collaborative, real-time apps with Partykit

The web is more fun with friends. Sunil Pai will teach us how Partykit makes it fun and straightforward to add collaborative experiences to any app.

Full Transcript

Click to toggle the visibility of the transcript

Captions provided by White Coat Captioning ( Communication Access Realtime Translation (CART) is provided in order to facilitate communication accessibility and may not be a totally verbatim record of the proceedings.

JASON LENGSTORF: Hello, everyone. And welcome to another episode of Learn With Jason. Today on the show, we're bringing back the one and only, Sunil Pai. Sunil, how are you doing?

SUNIL PAI: We keep bumping into each other like this. How's it going?

JASON LENGSTORF: So, at this point, this is your third time on the show? Every time, we're talking about something new. It's something that I find very fascinating. For folks who haven't seen you before, do you� we need one, anyways, because things have changed since the last time we talked.

SUNIL PAI: Hi, everyone. I'm the firsttime founder of something called Partykit, which is a product platform toolchain for building multiplayer, collaborative apps. You might know me from my time in Cloudflare. I spent year on the React team and we don't talk about that. I spent time at a bank, I refuse to talk about that. You might know me from a CSS and JS library. I've done a bunch of things and mostly, it's been about 20 years of [No audio] JavaScript now. I went from being the youngest person in the room to being the oldest.

JASON LENGSTORF: That was a weird transition for me, as well, yeah. [Laughter]. I remember being the one that everyone would look at, like, how did you get here? Now, they're like, you're still here?

SUNIL PAI: You're still here. Especially� [Laughter]. You know what? Especially with the� over the last five years, there's this whole, new breed of� I don't want to say [Indiscernible] because that's kind of a slur, the face of JavaScript has changed and all these extremely enthusiastic, they connect so deeply with the audience, I guess? And this� I mean, you're part of this, as well, they'll spend hours watching a stream and I'm like, y'all, you take toilet breaks? I assume you do, at some point? I don't know.
It has gone from, hey, we are the old hands.

JASON LENGSTORF: Yeah. Definitely a little strange to find myself as� as one of the� you know, the more, um, chronologicallyadvanced members of the team. I've reached an age that I'm still young, I'm in my 30s. I worked at a pizza place and there was this really friendly guy who owned the shop across the street and he was, like, 32 and I remember once saying, you know, he's pretty cool for an old guy. And then I got to my 30s and I was like, oh, no, wait, shit, we need to talk to the teenagers. [Laughter]. It's not old. 30's not old and maybe it is and I'm just fighting time vigorously. [Laughter].

SUNIL PAI: [Audio cutting out] recently and we were talking about how in the engineering college, there were folks in the final year of college and we looked at them, we used to hang with them, and they would create inspirations for us, they were 21. I have� like, don't get me wrong. Young people are, like, great. But, I keep thinking to myself that a whole chunk of my life lessons I got from 21 and 22yearolds. That's a little weird. [Laughter].

JASON LENGSTORF: Yeah. Yeah. And, hello, everyone. We got a great rate, showed up, what's up, Adam and friends? It's great to see everyone.
So, okay. So, Sunil, you are a firsttime founder. I've never� and by "firsttime" founder, we are saying you have raised venture capital to raise Partykit. I've never done that so I have a lot of questions, which I'll start with an easy one. What was the experience like? How did it go for you?

SUNIL PAI: So, officially, I haven't announced the raise yet, so no details on the raise.

JASON LENGSTORF: Just kidding. Hypothetical raise. [Laughter].

SUNIL PAI: It's the worstkept secret right now anyway. No specifics. Let me tell you how Partykit came to me, how it went from, hey, this is a nice project, to, oh, shit [Away from mic]. After five years in the UK [Away from mic] what it means is you don't need a sponsor anymore. And I thought to myself, the company's doing so well and it's a time of global peace, so what a great time to start my own company, I would think. [Laughter]. And, so� and that's just it, I think the one year I spent in Cloudflare was one of the best years. My platform is built on it. A wonderful group of people and technologies. They really showed me how to have ambition in terms of the things you can build and enable for other people.
So, I figured I do some contracting and I started hanging out with the folks. It is a startup by Steve that� and they were dealing with trying to implement multiplayer in the new� in the rewrite of the stuff they were doing. They were trying to move away from another solution. [Audio froze]. And you don't have a local development experience. How do you staging environments? The pricing is always� well, you're not just paying for the water and the taps, you're paying for something else. If the thirdparty service doesn't have a feature you want, you have one or two solutions. Either you build the solution around their infrastructure or you change your product or you wait for the service to build it. All three are horrible options when you're building. You don't want to be dependent on it.
And I realized that I could basically enable them by giving them an abstraction layer that all developers are familiar with. Hey, I want to be able to write the code that runs on these things. I need a local development. I want to write tests that run in CI. You want preview environments. Netlify does a great job of this. It generates a URL per GitHub PR and so on.
So, I helped them build to. And to be clear, like, that, like, was the deployment platform they built this incredible syncing engine. A guy named David. He built a customsyncing engine with the rest of the team, that was customtailored for [Indiscernible] and they were able to deploy it and they got it to production. We got something working in about a week, two weeks, and within two months, it was in production.
I don't know if you were hanging out in November at Jamstack, it got way better [Indiscernible] after that. And it turns out, if you have the right abstraction layer, a team of� I think there were, like, four people at the time. I think there are now six? I don't know. Can build a worldclass experience that has otherwise required insane investment, operational excellence and people. So web sockets were introduced� they shipped in Chrome in 2009, the spec was in 2008. And, for 15 years, now, roughly, the dream of building realtime applications, everyone� that's kind of in the dream of the internet. But...but some kid will build a game on the weekend, they'll stitch it together and try to deploy it and they end up in this hell scenario. [Away from mic] honestly, if you look at me wrong, I'll tell you the details about the architecture. But it turns out, you end up having to maintain this massive infrastructure simply so it scales across the world. It's a mess.
So� but Cloudflare and show us up on the scene. It's a big part of how Partykit is built, but there's a lot more. And it comes� it's a fundamentallynew primitive that's entered our computing scene. You end up having these synchronization points and Cloudflare take cares of their routing stuff. And that, it turns out, is the kind of abstraction layer that you, as an application developer, want to use. You want to write code and have the infrastructure handle the scaling and the routing of these connections as well.
Anyway, there's a bit of a sidetrack. They shipped, it's great. The product is amazing, but the multiplayer takes it to another level so I thought, hey, I should build this for everyone. And I came up with the name "Partykit," which is kind of a stupid name, but people love it. It's a platform for building parties.

JASON LENGSTORF: For building parties?

Yeah, it's infrastructure for building parties. Like, groups of people talking. I starting building it and the amount of inbound interest has been mad. Everybody has been reaching out. They want it. They want something they can use to build locally. They don't want to be distributed systems experts. JavaScript you can change and synchronize across screens. So, everybody wants it. I've been slowly onboarding. The way I onboard people is on my server, I have an array of GitHub user names. Every time I add a new person, I add a person to that and I do a push and that's kind of how I've been onboarding people.

JASON LENGSTORF: I'm like lowkey sad that I have not been onboarded, by the way.

SUNIL PAI: I can literally add you in five minutes now. [Laughter]. I shipped a new feature where you don't even need to be onboarding. The inboard interest was mad. When I started thinking this will be a nice lifestyle business to do. My ambition grew. Once I started looking at the impact it could have, the reason to raise is two or three things, to accelerate the timeline. I need to get this into peoples' hands as quickly as possible. I can't do this alone. My tag line is "everything's better with friends." That's my own, personal philosophy.

JASON LENGSTORF: By the way, I am lowkey pissed that you� that you did that because I swear to god, this is not me stealing ideas. At the same time as you� as you did that tag line, I started saying "coding is more fun with friends" as a way to talk about Learn With Jason. I was like, come on! I'm going to take it as a "great minds". [Laughter]. Also, how dare you!

SUNIL PAI: I haven't trademarked that line yet. So whoever can file quickly owns it. [Laughter].

JASON LENGSTORF: Steve is here and has thrown a  tldraw that everyone is using right now.

SUNIL PAI: All the [Away from mic].

JASON LENGSTORF: Is there a tablet you're drawing on? If you can do cursive like that, on your dang trackpad, I believe that means we've just become enemies. [Laughter]. Come on! No! Absolutely not!

SUNIL PAI: He does this with his� yeah, he's written thousands. That's his signature word.
Anyway. So, the raise went well. I spoke to so many founders, just trying to figure out even if this is the right thing for me to do. And, I think it is. By the way, everyone� every founder loves to give advice. All their advice conflicts. You get a spectrum of advice. You do this, no, you don't do this, which is great for me because I understand what my options are, but everybody thinks it's hard. A CEO was talking to me and said, I started a startup back and it got harder and got a little harder after that. Sunil, it doesn't stop getting hard. I was like, this is the worst advice ever. [Laughter]. I got some money in the bank now. We are doing hiring, building a London startup and I'm superexcited about it because I love speaking to people who want to build this thing that they have believed has been so hard to do for years and then you get them hooked up in, like, 20 minutes [Away from mic] is that it and I'm like, yep, this is how you start. How let's start talking about product features and they're like, oh, shit. That is a magical feeling that doesn't go away. Yeah, that's absolutely wonderful.

JASON LENGSTORF: So, you touched on something� I'm going to take us on a tangent here for a second because you said something I want to talk about. The idea of building an abstraction over, like, all this technical infrastructure, the things that Cloudflare puts together. I've always seen the list of features from Cloudflare and I've backed away from it because I don't go how it fits together. I still, to this day, don't go what the hell a key value store is how it's different than a database. [Laughter]. There is a very good technical reason, but no one's telling me the story why. No one is telling me, you want to accomplish a thing. What I think is really fascinating about what you're doing with Partykit and what we've seen some other companies do is, you're doing something that is typically frowned upon in the, kind of the general Zeitgeist. I think there's this interesting dividing line between abstractions that help and abstractions that hurt. Right. And so, like, I'm of a mind that if you� if you ship a really big, opaque SDK on top of lowlevel tech that's actually, like, basically the same as the SDK, you're just changing all the APIs around, you're causing confusion, you're making a mess. This is, like, RIP mentions, this is why I don't like Tailwind. I feel like it's not fundamentally simpler than CSS. It creates a parallel track of abstraction and I don't like that.
But when I look at something like, um, what a company like Netlify did around deployment, well, you push to Git or what GitHub did around managing Git. You don't have to figure out� you know, where things go. You're not setting up a server. You're not dealing with permissions and installing Git yourself or how you used to set up a server in� in even 2015, you would go to DigitalOcean, provision a box and SSH into a box and configure a firewall. I'm talking preDocker days� or before I know about Docker. You had to configure all this stuff remotely.
Whereas, hey,, here's my app and they're like, cool, I got you. It's a night and day difference. In both cases, they're abstraction, but in one case, I feel like the abstraction slows me down and in the other case, the abstraction is a Turbo booster that says, hey, all that stuff that used to scare you and make it hard for you to get something done, it's gone. Go build the thing you want to build.
So, from my perspective, the thing that I find the most exciting about Partykit is that I've always had ideas that would be fun if they were multiplayer. I have built web sockets before. We're running the chat and the corner is powered by my, little web socket server that I built and I hate it and it's flaky and it fails sometimes and I don't know why because I didn't go in and look at the retry logic so the idea of an abstraction that says, you want realtime, hit this button and I say "yes," and cool, go build features, what an exciting abstraction that is for me because I don't have to become an expert in this infrastructure and technology. I can be an expert in the things I am in, which is building the web and having terrible ideas that require realtime.

SUNIL PAI: My man, this is the entire history of computer science right now, which is, hey, here are lowlevel primitives. I have a lot to think about this and I need to convey it without taking over the rest of the hour. Which is...the reason to seek abstraction is optimization. And the question is, what are you measuring for optimization? So, computers were� in fact, to the level where I remember it, like, you used to do registered programming. You used to program the processor at that level. That is what programming is. And if you could figure out� I mean, that's how they sent the rocket to the moon [Away from mic]. [Laughter].


SUNIL PAI: The thing, though, that it is fraught with tradeoffs, you can fuck it up in a bad way. You change the register to the wrong number, the rocket crashes so you want to build an abstraction that puts guardrails that does two things. One is it provides safety so that you don't do the wrong thing. But more importantly it is that when you� usually when you have that kind of constraint, you can unlock new optimizations that come into place. A good example, I think, is memory management. JavaScript programmers have never had to manage memory manually for their entire careers because it started off with that. And that is because of the work that folks did with LISP in the 60s or 70s, whenever they did the lambdas.
Same thing with TypeScript. Hey, if you use TypeScript, you have to� still compile if the types fail. But it makes sure that you're not sending the wrong object types and weird  your JavaScript engine gets a little more optimal by making sure they're of the same shape as you pass them through things, et cetera.
Specifically with multiplayer� wow, if my competitors� I don't like calling them "competitors," I call them "players in the space." A lot of these players in the space are incredible engineers. And, one of the pitches that I've seen that they do for a number of the products and platforms is, hey, if you rewrite your app to be completely in this magical way, then we can provide you a number of optimizations. Hey, like, we get� your admin dashboard, you can build your own migrations and all that stuff. Here's a magical Reactive [Away from mic] the Reactive databases, I'm going to hook them up to Partykit at some point. One of the mistakes they make, you need to write your applications in a certain way. That doesn't gel well with me. I'm a developer, the friends� the first people that I want to impress, that I want them to use my product are my friends. I mean this in a very serious way. I need to make sure the people I talk with on a daily basis, either on Twitter or in chat, I trust them. I've grown up in the industry with them and we share values.
We need control over how our application behaves [audio cutting out] [Away from mic] so, it's very weird for me to have to use a product or platform that I don't have control of those things, or a very superficial year. The abstraction layer I've picked is way more similar to Netlify, which is, hey, like, deploy your code and we'll handle the boring infrastructure, routing, deployment, scaling for you.
In fact, by the way, there are features that I've stolen directly from Netlify. For example, you can� you can generate preview URLs. So, for every GitHub, it'll generate a preview staging deployment so you can test it before shipping it to production. So important. You cannot do without it. Environment variable and secret management. Just bogs standard stuff. I've made it so you don't need a custom client to connect to these servers. You can just use a web socket. But it's crossplatform. Not only will it run anywhere you have a JavaScript runtime, you can connect from another server. But it also means that you can connect to it from mobile apps. You can just make a web socket from Swift or Java and connect to these things.


SUNIL PAI: One of the things I want to do with Partykit is make sure the size of the market dramatically increases because I'm just relying on standards over here. There are tradeoffs. One of the big tradeoffs with Partykit� which I'll solve later� is concurrency because we use synchronization points where everybody connects. 40 to 100 people in a room� I will refresh this tldraw. Has it crashed for me? I don't know. Upwards of 30 to 40 people in a room start struggling. If you have more than 40 people in a Google Doc, you have a way bigger problem. You don't want people mashing on these things.
We're going to solve the concurrency problem. There are some pretty great ideas I have, but nothing to share today.
Sorry, that was a bit longwinded way, I've picked an abstraction layer that I've always wanted with building these apps. That's what I've been trying to say, I tried building it and I was not happy with any of them.

JASON LENGSTORF: I think from my perspective, at least, what I've noticed is that the challenge that so many companies have� and I think this is a challenge that will be true for Partykit and any other company that exists� is that when you enter a space, you see a problem that you have R. Right. And, so, you know, in the early days of Netlify or Vercel, it was people who were building apps saying, I wish it was easier for me to do that and so those people then solved their own problem. But then, you're working on the solution and you're not working on the problem space that you were initially solving so over time, you drift further and firth away from the problem space, the market. Because when we start, engineers have really good instincts, I am my target market. As you start building the thing, you stop being your target market but you remember having these great instincts, because you're like, I'm going to trust my instincts. That's why we're here. That's why I'm in the leadership position. But the problem is that you now have different problems. You have the problems of an infrastructure management company or whatever the services that you're providing. So, you stop talking to your customers. You stop being your customer and then when customer research conflicts, the urge is then to say, no, no, no, my instincts are right, we're going to do this.
And I find that so fascinating, as a generalized approach, that almost as a founder, you have to be willing to start out trusting your gut and then as soon as you gain market share and you're actually working on your product, immediately stop trusting your gut. Saying, I'm not right anymore. What I'm experiencing are the problems of running my app and my app is removing all of the problems that I have running my app for everybody who's a customer now so I have to use the customer research and what I've noticed is that nobody does this. So companies starts shipping features that nobody wants. They stop shipping things that the developers who love them, care about, and they start shipping things that they think they need, the edge cases, the enterprise deals or the thing they're trying to solve in the platform that they really want. And that's great. But it becomes an opaque, interesting mess to all of us. It is a really fascinating way of, like, reframing what's going on with a lot of these companies and why we always have new spaces every few years for a company to come in and drop a branchnew paradigm that actually shakes things up because everybody else gets too inwardlyfocused on their own problem sets.

SUNIL PAI: I have a lot to say about this. Can I tell you? Can I tell you?

JASON LENGSTORF: Yeah, yeah. Absolutely.

SUNIL PAI: First of all, it's never been my fashion to build a B2B SaaS. I want to make something wonderful. But literally what you're talking about, I was having this conversation just a couple days ago. What happens to dev tools companies? Your first two years� maybe three years� is about capturing the hearts and minds of developers and now we need to make money. Let's have an enterprisefocus and become a serious company. I have a couple ideas. Everybody has tried, for 20 years� and everyone has failed, but I think I'm going to do it differently. [Laughter]. But I have a couple of ideas. The first one is the one that I think that's� that's the big one, which is remember when I said, I don't call them "Competitors," I call them "players in the space." More applications are going to become realtime multiplayer anyway. I don't believe in fantasies so what that fundamentally implies is there have to be multiple takes on the thing. A lot of these players, they imagine the size of the realtime application space to be a size and they try to go after all of it. But, the Partykit thesis is that it's going to dramatically increase and there's going to be a lot of space for people to play. The people who need to worry are older companies, like� I don't want to say IBM, but are they even a player at this point? Microsoft. If Microsoft wants to acquire me, have your people call my people. We can figure this out. [Laughter]. I have a threedigit million number in mind and if you can match it, we'll work for you.
I reach out to all of them, some of them get back to me, some of them don't. The people who get back to me are not only friendly, but friends with me. One team that I would call out here are New Yorkbased company called Drifting in Space. Wonderful founders. We align on our values, like, so much. Their thesis is wonderful. They say we are surrounded by compute in 10 to 20second millisecond, how do you tap into it? Oh, shit, that's a good one. The more you talk to them, the more they realize even though there is some overlap, you have less overlap than you think. Either you're not interested in focusing on those problems or, you have other things to focus on yourself. You're like, okay, no, I care about this problem and this is the take I'm making.
The more I talk to these people, it turns out that, again, not only do there need to be multiplayers in this space who work on different angles of it, but the overlaps are where you start working together. Drifting in Space can tap into GPUs on the edge and then suddenly if you want to get multiple people looking at the same thing, suddenly, it becomes a Partykit situation. Everyone's a competitor. It's such a weird thing to say, when you're playing the game and you need to be, like, well, we need to become a billiondollar company. Partykit will become a billiondollar company because everyone will give a $1. [Laughter]. [Audio cutting out]. But it turns out, like, there is so much to� the hubris on Twitter of thought leaders talking about how they think the application architecture game is solved and they start discussing the minor details of user is so� I don't want to say offensive. But it feels smallminded to me. You're missing the forest for the trees, kind of situation.

JASON LENGSTORF: Honestly, I've just been uninterested on the discourse around JavaScript. I've said this before� and this is a little bit of a hot take� I've felt like the React serve components feels like cool tech that's solving a problem no one has. Right. And, like, we're seeing arguments about milliseconds about performance. But just about any framework out there today is fast enough that it doesn't matter if you're thoughtful about the way you build it. The problems that make those frameworks not performant aren't actually related to the internals of the framework. So, the solution isn't in changing the internals of the framework. It's in changing the way we interact with those frameworks and that is on us, you know, like what the promise of Partykit is. Right. Is if you try to set up sockets on your own, you're probably going to get it wrong, so trust these worldclass experts to manage this for you and that's the same promise that a Netlify or a Vercel has is when you set up globallydistributed CDNs and caching. We test it and we know what we do works. Stop trying to do that internally. Those are the things of abstractions that are going to move us forward, not, like, should we� do we serverrender like this or serverrender like this? That's not the problem. If we want to move the industry forward, we need to be looking at how do we build. What are we trying to accomplish. Not, what are the technical underpinnings of this thing.
Recognizing that JavaScript frameworks, that any of these things is a tool and it's one of the leastimportant decisions you make in whether or not the thing you're building becomes valuable.

SUNIL PAI: One of the things� and it's not clear to me whether this is cause or effect� past a certain size for a company� I think actually a fairlysmall size. The moment you're at 2030 engineers, the engineering team gets separated from the business side of the actual company. Sometimes also with product. But that usually happens a little later, which means that engineers get cut off from thinking and caring about the things that actually matter to the company. Sometimes, that's good because engineering is a hard problem and you do actually need to spend a bunch of time on that.
In that space, you celebrate launches. Engineering teams do this all the time. Right. They'll build something for six months. They'll ship it and celebrate on Day 0, which makes so, little sense for me. What you should be doing� first of all, you should not ship it after six months. I think you should ship it incrementally and start getting feedback. Revisit it in three months, see how it's affected the core business. Unless you are an infrastructure company, even then, you have developers, it's always in the service of users. It's in the service of business. It's in the service of some metric that is not milliseconds to load your JavaScript on the page.

JASON LENGSTORF: Oh, my god, yes.

SUNIL PAI: You know what I mean? Some people, they get lucky in e commerce, if we shave milliseconds, we're going to make more money. I used to work at an ecommerce. We got acquired by our competitors, which is a glory story for those days. I joined when everyone was migrating a PHP codebase to Node.js.

JASON LENGSTORF: Round and round we go.

SUNIL PAI: I started having lunch with the folks in marketing. I was like, oh, shit, you all care about so many different things. Yeah, bro, it you made it so it takes a day to change a banner on a page. You know what I mean? I was like� I swear to you, this is what I built for them. I was like, okay, let me make you one, shitty thing I'll host on a box running in the machine. It was JSX. I was like, it's like XML. If you put in the URL of the image, it'll get pushed and be on the site in seconds. They're like, what the fuck did you just say to me? I showed them the demo.

JASON LENGSTORF: Like, I know I'm walking all over you, but I gotta� I gotta� this is, like, my core rant is that, like, everybody's talking about, you know, how to I advance in my career, how do I make a bigger impact, how do I do all these things and what they're asking me is what tech should I learn. And it has so little to do with the tech. It is so much about looking around and realizing that the tech literally doesn't matter. What matters is that all of these people in the business� like, a business has three metrics, new signups, retention and conversion. Right. Like, everything else is a submetric of those things. Did somebody sign up, did they hang out, did they pay? Every other metric is somebody trying to sliceanddice those metrics so they can have an individual, owned thing. When accountability turns the metrics into nonsense, then it's not good anymore. Now you're just playing these games so you can have something to own and you end up in this situation where you are building things that don't matter anymore because you cut up the metrics in a way that don't mean anything anymore so you can then be a part of the team of� I don't know� that got the highest score on the meaningless metrics game. What's important is go out and have conversations with real people who actually use these things. That can be internal stakeholders, like the marketing team. External, like the people who pay you. And understanding what they are actually suffering from.
Don't worry if your pet solution doesn't solve any real problems. That's fine. It is very fun to play with code but it's not always the right thing to do. Sometimes you need to build a boring thing that people will pay for and the whole� like, I Tweeted about this a while ago and it was really inflammatory. I think more damage has been done by businesses by engaged, passionate developers who treat their job like a hobby and they get to do fun projects than by people who punch the clock and do tickets. If you've got a list of todos requested by the company and all the passionate developers are going, that's boring, I'm going to work on this instead. How much damage is happening to the company over time. It's immeasurable.

SUNIL PAI: I happen to [Indiscernible] also that this isn't� I don't think they do it purposely. Culturally, simply because we cannot� I don't think anyone has� I don't think we have the vocabulary or systems to talk about product engineering in public, which is why the thing we talk about� and there are very impressive engineers who work on very hard problems, which makes sense in the context.
Let me put it this way, the reason why glorify it, it also means every person wants to become a library or framework author. You know how much money there is in product engineering? Go have lunch with your salesperson. Build them a shitty prototype to change their banners and you will be a god.
By the way�

JASON LENGSTORF: Look at all the stuff we actually pay for as companies. If you look at where the checks get written for the average startup, it is not for the frameworks. Frameworks are free. What you're paying for is the accounting software, you're paying for the little tool that trades notifications between all the platforms. You're paying for the project management thing, the content management thing. All of these tools are making� doing the job easier. The flashy tech is� it's an incidental. I was writing a article, I think we're seeing a shift and I think JavaScript will be like jQuery. No one would say you should start with it, but it's everywhere. jQuery is powering 77+ percent of the entire internet according to W3 stats.

SUNIL PAI: I think it is WordPress.

JASON LENGSTORF: React powers 3.4%. Right. So, it's just this very, like, we live in this bubble where we think the tech matters. Threequarters of the internet is being powered by tech that every one of us thumbs our nose at.

SUNIL PAI: I think those stats don't include app login, but you're right. You know what? I think React is still incredibly useful, but we need to start talking about React like an ingredient and not the meal. Does that make sense?


SUNIL PAI: Like, server components, I like thinking of� server components [No audio] what is the format on the wire, how do you do server actions? The really powerful thing I think is more, I can click together little label blocks that define the whole stack so I can think about my actual application in terms of� instead of this lasagna layer. Those stacks, if you look at it [No audio] metricsfirst, and so on. Start talking about it as a portion of the business because it usually aligns with a team in your actual business, in your actual company. The reason I started doing Partykit� that's my segue into what I'm doing.


SUNIL PAI: Is because the desire has actually ramped up. Pandemic or not, still, just in the way we deal with technology, there are� people who spend� there are millions and millions of people across the planet who spend four to eight hours a day, looking at their computer, staring at documents, code. It is a very hard part of the collaboration space. And we will� we solve that for you immediately, you just use it for it. Collaboration space is so wide. GitHub is collaboration, email is collaboration. Hey, can you jump on a quick call with me? That's collaboration and there's going to be years of productthinking going into how to do that well.
One of my realizations from the pandemic, when it came for remote work is that senior engineers loved it. Hey, we don't have to deal with so many meetings. I like meetings, by the way. I think most people just do meetings wrong. Junior engineers absolutely hated it and there's a very specific reason for it. The job of a junior engineer� and when I say "junior," one year out of college� is to sit right next to a senior engineer and learn. I mean, literally. The feedback loop has to be secondslong. But the moment you put them in different buildings and houses, they have daily syncins. They do a oneonone every week or their GitHub PR 24hour review seconds.
I will start web development by the name of [Indiscernible], back in my development days. Not only did I learn a lot by sitting right next to her and seeing how she would code, but I saw how she would use her keyboard. Oh, this is why shortcuts are useful because you get fluent where you're not thinking about the keyboard. That's why typing is a good skill, not because of some word count. It's because you want to be able� how do junior engineers learn that? Honestly, ChatGPT.

JASON LENGSTORF: That's why I've been pushing on streaming. You get to watch someone work, not the polished end result, here's where I screwed [No audio] how's I get a remote environment. We don't have it yet. I've watched companies with the absolute best of intentions completely fail junior engineers because we don't have the mechanisms� I failed junior engineers and I have done� I did� like, we had big plans. We had structure. We had first day of school docs. We had really welldefined tasks but we didn't have a way for them to just be in the room where somebody could notice that they were stuck, instead of making them ask for help. You can see somebody, hand on the head, hey, what's going on there? We don't know how to do that remotely yet.

SUNIL PAI: Copilot, there are so many companies and teams that refuse to use Copilot and I'm like, no, you don't understand. That is such a big help when you're alone and you don't have someone you can ping. Or the people that you ping are either busy and you need to know, like, right now. I think the collaboration space� sorry, go on?

JASON LENGSTORF: I was going to say, one of the reasons I stopped using Copilot, it was because it kept putting stuff into my doc. I just saw one that I thought was really cool. It's called Cody, from Sourcegraph. You rightclick on some code and ask Cody. It opens up a sidebar and shows you, this code does this thing, it takes these parameters, that's what this means and it outputs this, here's what it does if something goes wrong. It's this really nice, humanreadable explanation of what a chunk of code does. I don't want anything to write my code for me, but I love the idea� I was kind of putting it through its paces, I highlighted something. What files call this function? It gave me a list and said, how. I could immediately jump through to find all the different use cases and understand, like, where they were related to in the rest of the codebase, which is exactly what I would have done with my onboarding budding if I joined a new team. What is this for? If gets used over here and over here. Now I'm starting to understand the idea of the code assistant tools because that's a real problem.
Otherwise, what am I going to do? A Find in my whole codebase? No, that's what I want the robots to do for me.

SUNIL PAI: The other thing is that, we, as a company [Away from mic] we don't have a culture of longform writing anymore. Like, as a senior engineer, your job isn't simply to write the code. It's to literally write down what your decision process was, why you did the things you're doing. How do you learn to communicate to the rest of the team. What you did, what you want to do, what you're going to do, why we are not doing the things we want to do. I also struggle with this. I wish I was better and I'm going to try making that [Indiscernible] principle of Partykit. Calling Partykit a read/write company. We're also a company that reads and writes. And I think that's another thing that� otherwise, you end up reinventing things six months later. One of the nice things I like about this "explain this code" tools is Copilot has Copilot Chat. I'll take the explanation, copy and paste it in the comment. Why not. Okay. This lives in the code base. Go for it.
Especially, the explanations that I like or agree with. Sorry, what were we talking about, Jason?

JASON LENGSTORF: We were talking about collaboration. I want to call out, we have been talking for about an hour. Did we want to code something today or do you want to keep going on this?

SUNIL PAI: The thing I want to show is, I want to show how easy [audio cutting out].

JASON LENGSTORF: Okay. Let's do it. Let me switch us over to the view, here. I'm going to get us over� wait, wait, where is it?

SUNIL PAI: So I shared a link with you in the DMs about a simple todo app built with [indiscernible]. I like to do because it usually has state, interaction and someone kind of data storage, usually if you wire it up. It's not about people building todo apps because it has enough interaction buttons. We're going to be using a standard todo app.

JASON LENGSTORF: Before we start. We've had Vanessa with us today, doing all the live captioning. Thank you so much for being here. And that is made possible through the support of Netlify, New Relic, and Pluralsight, all kicking in to cover costs and making this show accessible to more people, which I very, very much appreciate.
Okay. So, you sent me...this URL. No, maybe that URL is not...I think it's private.

SUNIL PAI: Really? Oh, wait. Let me fix that right now... [Laughter]. Okay. The default� yeah, it is private. Hold on.

JASON LENGSTORF: Maggie is in the chat. Great to see you. Everybody needs to ask spicy questions to derail the last 30 minutes. But, no, we want to see this in action. [Laughter]. Jacob wants to know, what's the best curry?

SUNIL PAI: Anything with coconut. I like chicken. Thighs and legs. I don't understand why the rest of the world prefers chicken breast. It's the worst part.
Coconut curry. People always like tomatobased. Cashewbased. I like coconutbased curies. It's hard to fuck up a coconutbased curry. You can put carrots, peas, it's a very forgiving base.

JASON LENGSTORF: I'm going to get my cooking show off the ground and you're going to come on and we're going to cook a curry together. It's going to be great.
I have this repo. I'm at the React.

SUNIL PAI: So, feel free to check it out and run NPMinstall. You recognize the styling, it's very classic. For state, it uses something called Synced Store. This is very similar to [Indiscernible]. The API is almost exactly like [Away from mic]. Which, you'll have an object, in this case, an area of todos and you can do�.push. Edits on it and in the background, it'll immutable set. It doesn't matter. The important thing when you run it, et cetera�

JASON LENGSTORF: I'm in the wrong project right now. So we're going to open and I'm going right. So now I'm going to run that. Oh, wait.

SUNIL PAI: Only realized there are a number of comments happening on Twitch. Hi, guys. This is the stage fright moment and they are judging me deeply for all the words I've said.

JASON LENGSTORF: Everybody has been very supportive today.

SUNIL PAI: Really? That's disappointing. [Laughter].

JASON LENGSTORF: You did miss a moment where people were being gross in the tldraw. Otherwise, it's been great.

SUNIL PAI: That's what it's meant for.
You can type� enter something, press Enter, it just works. This is very standard. That's fine. Now, is there a way for you to open up two tabs and put them next to each other or put them one on top of each other?

JASON LENGSTORF: There sure is.

SUNIL PAI: Let's do that.

JASON LENGSTORF: What's my next tab?

SUNIL PAI: Localhost. It's not really replicating or anything, but you'll see that it's also� whatever, right. Sync Store is a JavaScriptfriendly API on top of type of data structure called a CRDT.


SUNIL PAI: I'm not, right now, typing CRDT. A conflictfree data. I knew that by heart. I was searching� the typing you heard was something else. Conflictfree deprecated data type. You can make edits on to it, which is usually change one key value to something else, move it, delete it, add something new, et cetera. And, it does that very efficiently. And the nice thing about� so, the very popular one is Yjs. If there's one thing the group should have on this podcast  is this a podcast?

JASON LENGSTORF: We don't know what to call this. We call this a�

SUNIL PAI: Yjs is going to become very big. Sync Store is good with it. Look for store.ts. You'll see how it's actually set up. There's a little type and a type for the todo and there's an area of todos, right? What you can do, now, with this object is, if you have a synchronization point, you can start sending all the edits to it and start reading edits to it. Okay. What it means, start using the network to pass all these edits around and end up in a place where they're synchronized so that everybody's seeing the same object.
It turns out, this is a very, very hard computer science problem that Yjs has conveniently solved for you.
What that means is, if you have some form of state, some JavaScript object, something, that you need to be synchronized across multiple computers, you will use this library� yep.

JASON LENGSTORF: Okay. So, I'm going to repeat this back to you to make sure that I understand it and go from state management principles. So, in an app, I have my array of todo items and the way that I do that, in something like React, is I would use a� I would have an array, I put that in state somehow and then I'm going to use context to put that at the top of my app so that then all of the components can get it. Or I'm going to use nano stores or sync stores so that the rest of the app can say, hey, give me the store, I'm going to use the list that's in here and with Yjs and what we're doing here, with Partykit, you're saying that the concept stays the same, it just continues and now I'm saying, not just in this app, but in any app connected to this browser, I want you to take the same object and any updates goes to this object and it replicates.

SUNIL PAI: Exactly. We are in a session and you might have actually seen, on the screen, the commentedout code. We can give every session a name. You call this an ID. We're calling it LWJ here. The moment you uncomment that part of the code� feel free to uncomment it and refresh your page. Feel free to start typing and pressing Enter and doing stuff in the todo list...

JASON LENGSTORF: All right. Are you in here, as well, right now?

SUNIL PAI: I'm not, actually. I could start it up locally, as well. Huh, I didn't realize that I could do that, too. This is the whole point of it. Okay. I'm going to refresh my page.


SUNIL PAI: Are you seeing my edits?

JASON LENGSTORF: Yeah. They did. There they are. At the bottom. I'm handsfree. This is very cool. This is such a cool way to work, right. And, the fact that� okay, so� is this the only change that made this [Away from mic].

SUNIL PAI: Only change that made it collaborative. It's one line of code.

JASON LENGSTORF: So, can you walk me through how this synced store is being used in the rest of the app?

SUNIL PAI: Oh, yeah.

JASON LENGSTORF: Just so I can get my head around.

SUNIL PAI: Go into app.tsx, you will see a line that says, hey, store is the same as sync store.

JASON LENGSTORF: And we grab our global store.

SUNIL PAI: There you go. Now that store is� has all the values and it'll update every time you make a change to it, either locally or on the network.

JASON LENGSTORF: Okay. So this is the part that is really exciting to me because I already know� I've built apps that keep a list of things or that are doing whatever it is. I know how to put state into an app on the internet. If all I have to do to get this state to cooperate with other platforms to be collaborative is run that web socket server with Partykit, that's huge. Like, that's incredible because it means that I don't have to change the way that I think about writing my apps. Right. It looks like I probably need to migrate over to Nano Stores to Synced Stores. The baseline implementation, if you look at Nano Stores to Sync Store, more or less, the same code, they're going to be very similar. So the migration path there is pretty straightforward. Maybe a little more intense if you're using something like a big Redux store. Even then, you could get the value of the Sync Store and drop it into Redux.

SUNIL PAI: You are not running� you're not running a particular server on your machine right now. I have a deployed a generic Yjs backend. If you want to build a collaborative app today, I don't need to give you access to Partykit. I add people to� screw it, use the URL that is over there and instead of saying, LWJ, just use something else while you're working and just sort of work. So that's a new session now.

JASON LENGSTORF: I mean, it's� and this is cool, too, because this also means that, like, I could use my URL, right. I could set up it where it's something like� I grab this one, two, three out and drop it in here.

SUNIL PAI: Yeah. And that's kind of how� by the way, together, tldraw, it's deployed on Partykit but it's also on Yjs. Will everyone jumped into This is the drawing app. This is me, by the way.

JASON LENGSTORF: This is very cool. And I think we do have to worry about what I've started called the TTP on a freeform app, that's TimetoPenis. I'm going to go ahead and pop off this real quick.

SUNIL PAI: I shared this online and we started to see a form of community moderator, people were drawing swastikas and then they changed it to something else.
This is sharing state, which is, first of all, this has� this has been incredibly hard in the past. And I'm saying it's one line of code. This is only where you start. Now you can start building your own shit on top of this. I'm working with folks at Stately. They're running states. We'll have audio/video if you want to build your own Zoom with one line of code.

JASON LENGSTORF: The thing that I think is really fun about this� so Maggie just asked a really good question. She says, this might sound sacrilegious, could a bunch of people use a collaborative app that isn't deployed, like localhost. And, yeah, we're doing it right now. [Laughter]. You could theoretically� it is behind the firewall.

SUNIL PAI: So if you don't want to use Partykit, what you end up using is Web [Indiscernible] which is one of those technologies where you connect directly to each other. It's hard to build  that's great. You can do that here, as well. One of those problems is it doesn't scale well the moment you have a lot of people. If you're with Partykit, you can add stuff like auth. Only these six people can do writes. You need a platform to implement more complex logic and, well, more features that you can enforce when you're in charge of a server. If you want to build something simple, use WebRTC. You end up with massive JavaScript bundles.

JASON LENGSTORF: This is going to go really well with ecosystem tools. If I want to set up a or a Okta or 0Auth, if the current user has� here, if the current user has the right permission, then they can� they can go in and do that or role or however you want to set this up.

SUNIL PAI: Even something like storage. When you do peertopeer, you can't really do storage so you do need a server for doing these things.

JASON LENGSTORF: Those, too, throw it on, what, like Planet Scale has this globallydistributed database. Something cool that Sanity does, you get conflicts, they detect whoever opens an individual field and they lock it and say, soandso is editing this field. That is great until somebody has their browser open and goes to lunch. [Laughter]. These are the types of things we can build and those particular things aren't actually in the realtime. Right. So, the hard part of this stuff isn't actually the� the realtime anymore, because if we're just adding something like this to say, sync our store across everybody who's open in this session, what we're doing instead is, we know this object is going to be synced between everybody so we need to build out the features we would have built anyways into a dashboard or an app, we need to control how people interact with the app. But now we can say, in addition to controlling the app on your browser, you're controlling it on everybody's browser so we can think about how this works collaborative. What if two people are in the field at the same time? How do we show the avatar stack, if 15 people are here, can we show those things? Those are not, how do we get data across the web socket or, you know, how do we� you were talking about a CRDT, I don't have to worry about the data being merged. I have to worry about making sure that the data, when it arrives, gets saved.

SUNIL PAI: This is exactly the Partykit pitch. You should not be giving a fuck about infrastructure and maintenance. You should be focusing on the product experience and the things you want to build. That is the whole� this is the value of Partykit. We could have made something, which was way more engineeringspecific, here's a cool React [Indiscernible] I want to make sure that on Day 0, you start thinking about your product, you build out your product, the things that matter to you, as a game developer, as just someone experimenting building fun tools or as a business. That is your job. That is the� that is the experience that I want to enable so I when I go up to these startups who want to build collaborative experiences and I show them how easy it is to get started, they lose their shit, they're like, oh, fuck, we get to work on other things right now.
Can I also tell you something? I'm going to drop you a link to show you what the backend code  if you want to deploy your own. If you open up [Away from mic] it's in the chat.


SUNIL PAI: Open that and how much code it takes to build this backend. That's it. It's that eight lines of code. But it comes with persistence. We can store your entire document on the server, as well. Sorry, go on?

JASON LENGSTORF: So, just tell me� tell me, again, what this is doing? So, we've got a server. Where am I running this?

SUNIL PAI: This is the code that's running on the Partykit platform. This is what we just connected to.

JASON LENGSTORF: Okay. The way this runs is if I� whatever. Like, I'm running a Node server, I set up Express and when you hit the, /Partykit.

SUNIL PAI: The moment you need to do this multiplayer networking, Cloudflare platform, you will pass it through these� this is the code that runs in every single room, by the way. It says, hey, every time a web socket connects to a room, use this y particulate, which is the open source library we have built. So, the first thing here is it's simple to get started. Because you can run this code, you can see� you can imagine, check the login information on this web socket and only allow Jason and Sunil to do edits. That is where the flexibility of Partykit comes in, you can start adding any serverside logic that you need on to� over here. That's� that's actually, like, the value here, which is, it's� the thing that we started with, which is, like, hey, here's a shared todo list, was a great starting point and it'll actually get you a long part of the way there. Once you need to add more logic, more features on the serverside.
For example. [Indiscernible] knows this and works at, which is an AIassisted fictionwriting tool. Such a great tool. Not only can humans connect to this document, but� you can connect an LLM to this document in the same way. Like, if you imagine, like, five people on a Google Doc, four of them will be humans, but the fifth of them is an LLM making edits, making suggestions, answering questions you have, et cetera. You now have this primitive that represents something important in your app, which might be a document, a story, a song, I want the music industry to start using this, by the way, now that we've solved the latency problems. It spins up in a location that is 5 to 10 milliseconds [Away from mic].
You can now start deploying your own code on to the servers. If you don't want to use Yjs, you can use Stately. They are running� well, I don't know how much I can talk about it. They're trying it out. They're running edge machines� state machines on� inside these little rooms that have mad, collaborative powers, but also, it just� they're doing some really scifi shit to this. You should ask David to come here and talk to you.

JASON LENGSTORF: It's about time for another David episode.

SUNIL PAI: We are not CRDTsasaservice. We give you this primitive where you can run this little code that people can connect to and do things in it. What is the code you would run inside it? Do you want it run a little state machine? Do you want to set up a shared Spotify playlist? I don't know, man, it's up to you. I'm so excited to enable the people who have better ideas than me for using this technology.

JASON LENGSTORF: Yeah. Yeah, yeah. This is very, very fun to see. Like, it's supercool to see that there is, like� there are rules but there are no rules. I think that's a good sign of a good abstraction. The things that need to be handled are handled. You can do whatever you want. This is too big a space for anyone to say, this is the right way. And I think that what's exciting about this is, as you're saying, this is not the time for competition. We want� we're just starting to understand what's possible with collaboration and so far, most of the things that we've seen, that have been really impressive, are fairly homegrown. The things that we're seeing, that are really cool in collaboration, tend to be things that were built inhouse somewhere. If we can get the primitives out of the way without having a big engineering team and a big infra and platform team, providing primitives that let people play without having to become networks in edge networks, we have the potential to actually see the Cambrian explosion.

SUNIL PAI: Man, I got to tell you, like, exploring all the other ones in the space, I have spent enough time in this industry where I expect my tools to be boring. Number one, people try to sell you not, instead of trying to make� instead of trying to bring out the ambition in their users, they try to convince how cool they are as a solution.

JASON LENGSTORF: Oh, my god. Yes. I don't need an identity, I need a fucking deployment platform. Please. Yes.

SUNIL PAI: Partykit wants to be the most boring fucking part of your app. Use TypeScript, you get local development, which means you can run it on your machine, which means you can run tests for it that run in CI. It'll generate preview deployments� these are the things that matter to me. I'm not interested in looks� I have features to ship and I need to get home by 5:00. I'm closing my laptop and going to the pub for a pint. Partykit is going to become so fucking boring. The moment you use it� what I want it to get to is, look, the website sucks right now. I put it together when I was doing the pitch and stuff and we're going to get a much nicer website. I have a thing where every time you refresh the page, the icon changes. I like that.

JASON LENGSTORF: Oohh. That's cool.

SUNIL PAI: Other than that, it doesn't say much. I'm not going to build another website that looks like [Indiscernible] or Vercel. We want to take, like, every other technology paradigm, we want to take something that was previously hard, expensive, you needed to be a subjectmatter expert in your domain to use it and say, no, shut the fuck up, we will solve these problems for you, you do what's best for your app. That is what Partykit wants to do.
The word "realtime" is so scary otherwise. I'm sending bytes down the browser and it's rendering in realtime. I'm way more interested� if we do our job right, nobody will be talking about Partykit, but everybody will be using it. By the way, the logy was designed for us by Steve, if you can recognize the handwriting. We are going to become so boring. We want to be a utility, yeah, we're like Node. Because we have found what I think is the right abstraction layer and we can� the optimizations we unlock for you is your workflow, shipping your features. I think that's a good place to be.

JASON LENGSTORF: Yeah. It's a huge� that� at the end of everything, what we're paying for is the ability to do the thing that makes our company different. Right. And every single time I go to build something and I find myself, rather than building the feature that I wanted to build, wrestling infrastructure, it makes me not want to write code [audio cutting out] and you're looking at it going, that's going to be a nightmare to maintain. Every time you get pulled out of the thing that's uniquely valuable, you're setting up a bunch of code. Why is Docker exciting? Why is NPM, we can take this undifferentiated labor and give it to people to use to build that stuffs. They don't have to write a crypto library. They just grab a package and they're off to the races building the feature that they wanted to build.
One of the major reasons I think a lot of people don't touch collaboration and realtime now is that it feels like the bulk of the work is going to be babysitting that infrastructure. And I'm very, very excited that it� it seems pretty obvious that that's not actually the case anymore and now all of my bad ideas that I have for building things� they would be way more fun if everybody was playing together as opposed to if you were just playing by yourself. Now I'm going to go unleash hell on the internet because I don't have to think about infrastructure anymore. I can just build the feature.
And I think that, again, there's a bit of� we just get so excited about the tech because it's fun to build, right. There's a big difference between interesting to me and useful to other people. And I think that sometimes we get crossed up so what I love is that you're focusing on this, from the aspect of, I want to see people build stuff. Not, I want people to see how cool this tech is. And the focus on boring, the intentionally, like, you should literally never have to think about this. The entire goal is that this entire corner of your app exits your mind the way running a CDN has excited. You don't have to go to Singapore to figure out why you've got latency. You use it every day and you've literally never thought about the fact that there is a server in Australia that is serving your stuff and somebody has to keep that living.
I want all of the pieces of infrastructure and platform management to do that so that I can just have bad ideas and ship them very quickly.

SUNIL PAI: Love that. That's the sign of success, I think. If we can ship your bad ideas, that is the true sign of success. Man, I was thinking about this. So, I've been spending the past few months companybuilding. I have gotten some time to code. I've been doing shit with lawyers and accountants. Just speaking to a bunch of so very fucking special people, trying to form the team around this. And, we'll do things that� like you said, the moment the company grows after a while, we'll do things like appeal to the enterprise and have them sign us sixdigit, sevendigit check.
Collaboration. As a company and as a product. The company collaborates with everyone. The one I'm very interested� I'm personally very interested in is about ambition. Look, man, Sunil Pai, speaking about myself in the thirdperson. That's not a red flag at all. This shit head did so bad in college and ended up having JavaScript save him and provide him an opportunity to participate on the world stage and meet wonderful people like you and move to London. I'm so fucking blessed to do this. If Sunil Pai wanted to build a collaborative application 15 years and had the options available to him then, he would have gone nowhere. The least thing I can do with this stupidlynamed startup� it's stupid, but I like it. For 15 people years, people have been trying to build this thing. 15 fucking years, there are games and things and they have been dashed because they have no idea how to leverage this compute layer. I think Partykit solves that. That's what I'm excited about. That's my pitch.

JASON LENGSTORF: And what a great note to end on because with that, we are out of time. So, Sunil, thank you so much. Everybody, go check out Partykit, like, let's go play. Let's� let's party. Code is more� what is it? Better with friends? Everything is better with friends. So, get out there and go build some stuff.
Also, make sure that you go and check out the schedule. We've got Rich and talk about Svelte and this episode, like every episode, has been livecaptioned. We've had Vanessa here from White Coat Captioning. Thank you so much, Vanessa and that is possible through Netlify, Nx, New Relic and.

SUNIL PAI: Vanessa, I'm so sorry I made you type out all that profanity. [Laughter].

JASON LENGSTORF: We're going to find somebody to raid and we will see you next time.

Closed captioning and more are made possible by our sponsors: