Latest / Talk Python To Me / #537: Datastar: Modern web dev, simplified
Transcript
- 0:00Michael Kennedy: You love building web apps with Python, and HTMX got you excited about the hypermedia approach.
- 0:05Michael Kennedy: Let the server drive the HTML, skip the JavaScript build step, keep things simple, right?
- 0:11Michael Kennedy: But then you hit that last 10%. You need AlpineJS for interactivity, or your state gets out of sync,
- 0:16Michael Kennedy: and suddenly you're juggling two unrelated libraries that weren't really designed to work
- 0:20Michael Kennedy: together. What if there was a single 11-kilobyte framework that gave you everything HTMX and
- 0:26Michael Kennedy: AlpineJS did, and more with real-time updates, multiplayer collaboration out of the box,
- 0:31Michael Kennedy: and performance so fast, you're actually bottlenecked by your monitor's refresh rate.
- 0:37Michael Kennedy: That's Datastar.
- 0:38Michael Kennedy: On this episode, I sit down with its creator, Delaney Gillilan, core maintainer, Ben Crocker,
- 0:43Michael Kennedy: and Datastar convert, Chris May, to help explore how this backend-driven, server-sent event-first
- 0:50Michael Kennedy: framework is changing the way full-stack developers think about the modern web.
- 0:55Michael Kennedy: This is Talk Python To Me, episode 537, recorded January 15th, 2026.
- 1:19Michael Kennedy: Welcome to Talk Python To Me, the number one Python podcast for developers and data scientists.
- 1:24Michael Kennedy: This is your host, Michael Kennedy.
- 1:26Michael Kennedy: I'm a PSF fellow who's been coding for over 25 years.
- 1:30Michael Kennedy: Let's connect on social media.
- 1:32Michael Kennedy: You'll find me and Talk Python on Mastodon, Bluesky, and X.
- 1:35Michael Kennedy: The social links are all in your show notes.
- 1:38Michael Kennedy: You can find over 10 years of past episodes at talkpython.fm.
- 1:42Michael Kennedy: And if you want to be part of the show, you can join our recording live streams.
- 1:45Michael Kennedy: That's right.
- 1:46Michael Kennedy: We live stream the raw uncut version of each episode on YouTube.
- 1:50Michael Kennedy: Just visit talkpython.fm/youtube to see the schedule of upcoming events.
- 1:54Michael Kennedy: Be sure to subscribe there and press the bell so you'll get notified anytime we're recording.
- 1:59Michael Kennedy: This episode is brought to you by Sentry.
- 2:01Michael Kennedy: Don't let those errors go unnoticed.
- 2:02Michael Kennedy: Use Sentry like we do here at Talk Python.
- 2:04Michael Kennedy: Sign up at talkpython.fm/sentry.
- 2:08Michael Kennedy: And it's brought to you by CommandBook, a native macOS app that I built that gives long-running
- 2:13Michael Kennedy: terminal commands a permanent home.
- 2:15Michael Kennedy: No more juggling six terminal tabs every morning.
- 2:18Michael Kennedy: Carefully craft a command once, run it forever with auto restart, URL detection, and a full CLI.
- 2:23Michael Kennedy: Download it for free at talkpython.fm/command book app.
- 2:27Michael Kennedy: Ben, Delaney, Chris, welcome to you all.
- 2:30Michael Kennedy: Thanks for being here on Talk Python To Me.
- 2:31Michael Kennedy: Thanks for having us.
- 2:32Michael Kennedy: Hey, how are you doing?
- 2:33Michael Kennedy: Doing well, doing well.
- 2:34Michael Kennedy: Very excited to talk about Datastar and some cool web frameworks for Python people and beyond, of course.
- 2:42Michael Kennedy: But, you know, most people listening doing Python web frameworks.
- 2:45Michael Kennedy: So talk about how that all integrates.
- 2:47Michael Kennedy: And if you like the HTMX vibe, which we've talked a lot about on the show, I think there's
- 2:52Michael Kennedy: going to be a lot to like here as well.
- 2:54Michael Kennedy: And maybe more.
- 2:55Michael Kennedy: We'll see.
- 2:55Michael Kennedy: A case to be made.
- 2:57Michael Kennedy: But, you know, before we get into all of that, though, let's just talk about a quick introduction
- 3:02Michael Kennedy: for everyone here and like go around the squares of Ben, I'll let you go first.
- 3:07Michael Kennedy: Who are you, Ben?
- 3:08Ben Crocker: Based in Costa Rica at the moment.
- 3:10Ben Crocker: I'm based in Europe most of the year, but half of the year my wife and I spend here.
- 3:14Ben Crocker: In terms of background, I've been primarily working with PHP for well over 20 years and got involved with Delaney and Datastar, been a core maintainer on that project ever since.
- 3:26Ben Crocker: And I looked at my commit history for last year, and it turns out now I write more Go code than PHP, so I don't want to call myself a PHP developer anymore.
- 3:37Ben Crocker: I'm just a web developer, a backend web developer, primarily that also writes TypeScript and maintains a front end.
- 3:44Michael Kennedy: framework. There's a lot of stuff going on and ways in which you can write code for the web these days.
- 3:50Michael Kennedy: Well, thanks. Awesome to have you here. Delaney, hello.
- 3:53Delaney Gillilan: Hi, how you doing? Yeah, I have kind of a weird checkered background into web development. I was
- 3:58Delaney Gillilan: originally in the circus, then I became a 3D artist, then I became an engineer. I've worked in
- 4:04Delaney Gillilan: games, video games, slot machines, military applications, all kinds of crazy things.
- 4:11Delaney Gillilan: I tend to work on really highly optimized, fast things.
- 4:14Delaney Gillilan: I love the ideas of the web,
- 4:16Delaney Gillilan: but I got really tired of how you actually implement things in that.
- 4:20Delaney Gillilan: And I was doing very large applications with millions of updates a second.
- 4:24Delaney Gillilan: And the tools that were out there just weren't good enough.
- 4:27Delaney Gillilan: So I ended up going down many, many rabbit holes
- 4:30Delaney Gillilan: and finally found something to make it better for everybody else.
- 4:33Michael Kennedy: So yeah, that's really cool.
- 4:34Michael Kennedy: And wow, what a really interesting issue.
- 4:36Michael Kennedy: I know you got some crazy stories.
- 4:38Delaney Gillilan: Yes, I do.
- 4:39Delaney Gillilan: I always have a funny, weird outcome of something.
- 4:42Delaney Gillilan: Ironically, people talk about things being a circus,
- 4:45Delaney Gillilan: but like circuses are very well run logistic machines
- 4:48Delaney Gillilan: compared to most developer situations.
- 4:50Delaney Gillilan: So it's kind of funny.
- 4:50Michael Kennedy: Yeah, it's an insult to circuses.
- 4:52Michael Kennedy: Yes, it is.
- 4:52Delaney Gillilan: It really is.
- 4:54Michael Kennedy: Amazing.
- 4:55Michael Kennedy: Okay.
- 4:55Michael Kennedy: And what we're going to talk about,
- 4:58Michael Kennedy: Datastar has this amazing ability to update many things
- 5:02Michael Kennedy: really quickly in real time, which we'll get into,
- 5:05Michael Kennedy: but yeah, sort of foreshadowing there.
- 5:07Michael Kennedy: And Chris May, welcome to the show.
- 5:10Michael Kennedy: I've known you for a long time and I'm really happy to have you here.
- 5:12Michael Kennedy: Great to be here. Thank you so much.
- 5:14Chris May: Yeah.
- 5:14Chris May: Yeah. So about me, I started writing websites back in 1995 and then picked up Python about 10 or so years later and just have really enjoyed the ride since then.
- 5:25Chris May: Picked along the way, became technical coach and just loved making single page applications.
- 5:30Chris May: I loved, I just love the web.
- 5:32Chris May: You know, I love that we can publish something from our computer and anybody around the world can see it.
- 5:36Chris May: And then what, maybe a little over a year ago, I, oh no, it was more than that.
- 5:40Chris May: I remember I was on a trip and I was listening to a podcast of HXPod, the HTMX podcast,
- 5:46Chris May: and heard about this crazy, cool tool, Datastar.
- 5:50Chris May: And I was like, I even put in my DjangoCon presentation, like you should, everybody else
- 5:54Chris May: should try it out.
- 5:55Chris May: And finally I did and I'm converted.
- 5:56Chris May: I love it.
- 5:57Chris May: So I'm excited that the three of us get to talk about it.
- 6:00Michael Kennedy: The reason that we're having this podcast is because I read your article about switching
- 6:05Michael Kennedy: to Datastar. And I'm like, okay, this is interesting. You made the case very well. Of
- 6:10Michael Kennedy: course, I'll link to the article. And so I thought, hey, I need to have Chris here as my Tony Romo to
- 6:18Michael Kennedy: my Al Michaels or Nico Rosberg to my Crofty or whatever, right? So I'm happy to have you here.
- 6:24Michael Kennedy: Exactly. Awesome to have you here. So let's just start with what is Datastar, right? I mean,
- 6:30Michael Kennedy: we've hinted that it has some similarities to htmx but also not so ben and delaney give us the
- 6:37Michael Kennedy: overview what is datastar so i can give a little bit of history and then ben's probably better at
- 6:42Delaney Gillilan: saying what it is now i have a background in like low-level stuff um even though i was a 3d artist
- 6:47Delaney Gillilan: first i'm much more comfortable in like shader development and that kind of thing like so glsl
- 6:52Delaney Gillilan: web thing like i'm a c guy that knows some other things but the thing is that i was working on
- 6:57Delaney Gillilan: some military applications where I needed really fast updates of a browser. And the reason why you
- 7:03Delaney Gillilan: in this military situation is that getting things approved is really hard, like executables to go
- 7:09Delaney Gillilan: into deployment. But having a browser means that you have this nice little sandbox that things can
- 7:13Delaney Gillilan: go in. So it's actually more of a deployment platform in my background than, you know, just
- 7:17Delaney Gillilan: the regular web. But I was doing things that were pushing the browser really, really far. I was using
- 7:21Delaney Gillilan: Vue and SPA. And I basically was like, well, these are the smartest people out here, but it's not
- 7:26Delaney Gillilan: fast enough. So I was using crazy WebSocket stuff, all this binary stuff. And then I tried doing,
- 7:31Delaney Gillilan: you had someone on last week talking about LiveView and like they have a Python version of that. I went
- 7:37Delaney Gillilan: hard in making a binary version of that, like going down to the protocol level, changing,
- 7:41Delaney Gillilan: optimizing that 10 different ways. I had an entire framework for doing this. And basically,
- 7:45Delaney Gillilan: in my opinion, that's a complete dead end. It is untenable. We can go into the reasons why,
- 7:49Delaney Gillilan: but the thing is, long story short, I ended up seeing what was happening in HTMX in the hyper
- 7:53Delaney Gillilan: media space. And I completely discounted all of that because I said, like, I'm doing low level
- 7:58Delaney Gillilan: binary stuff. There's no way this other approach can be faster. And then my thing is always check
- 8:02Delaney Gillilan: the metrics, always don't take your assumptions and do the work. And the thing is, there's things
- 8:07Delaney Gillilan: that are wrong in the implementation, but there's things that are 100% right in the overall ideas of
- 8:11Delaney Gillilan: how to use that. So I went and I took a year and a half work and just threw it in the trash
- 8:16Delaney Gillilan: and said, okay, I'm starting over and like ended up doing some basic things would probably get into
- 8:22Delaney Gillilan: and ended up with this thing that is a backend diagnostic backend framework that has a 10
- 8:27Delaney Gillilan: kilobyte shim that is the fastest, smallest thing out there by orders of magnitude. So it's not just
- 8:33Delaney Gillilan: a slightly different thing. It is literally a different paradigm shift. It's a crazy shift.
- 8:37Delaney Gillilan: So the difference between reacts to something like HTMX is different from HTMX to the data
- 8:42Delaney Gillilan: start way. So I'll let Ben actually explain what that is. But the thing is from a low level C
- 8:46Delaney Gillilan: guys point of view, it is one of the fastest things in your stack now, which is crazy to think
- 8:51Delaney Gillilan: Yeah, like a 10K shim can do that.
- 8:53Michael Kennedy: That's incredible.
- 8:54Michael Kennedy: And also, it sounds like your advice comes from somebody who's done a lot of profiling.
- 8:59Delaney Gillilan: Very much so.
- 8:59Delaney Gillilan: Like, that's the only thing.
- 9:00Michael Kennedy: You got to measure, not guess.
- 9:03Delaney Gillilan: Yeah.
- 9:03Delaney Gillilan: In fact, there's funny things that we've had things on Twitter fighting with people and
- 9:06Delaney Gillilan: they're like, oh, this one situation was really slow.
- 9:09Delaney Gillilan: We actually looked at their flangraphs and it was a bug in the Safari GPU stuff.
- 9:14Delaney Gillilan: Because we were actually at the level where the JavaScript doesn't even show up.
- 9:17Delaney Gillilan: It's actually a GPU issue of it rendering fast stuff.
- 9:20Delaney Gillilan: in the browser, nothing to do with the JavaScript.
- 9:23Delaney Gillilan: Because the fastest JavaScript you can write is no JavaScript.
- 9:25Delaney Gillilan: So we really lean into what the browser can already do.
- 9:28Delaney Gillilan: And we're just making it so that that's easy to do
- 9:30Delaney Gillilan: so that the average person with the average website
- 9:32Delaney Gillilan: doesn't have to write any JavaScript at all.
- 9:34Delaney Gillilan: And they get to be a full stack developer
- 9:36Delaney Gillilan: in whatever language they choose.
- 9:37Delaney Gillilan: And I'll let everyone else talk from there.
- 9:40Ben Crocker: Awesome. Ben?
- 9:41Ben Crocker: Yeah, my version is going to be quite different to Delaney's
- 9:43Ben Crocker: because we care about different things.
- 9:45Ben Crocker: Fortunately, we do care about some of the same things.
- 9:49Ben Crocker: We work well together because I think we complement each other.
- 9:52Ben Crocker: But coming from a PHP background, I want the backend to be driving the front end.
- 9:57Ben Crocker: And it naturally does, right?
- 9:58Ben Crocker: Because even your HTML is being produced by your backend.
- 10:02Ben Crocker: And that's what's being served to the front end.
- 10:05Ben Crocker: I describe Datastar as a hypermedia framework.
- 10:09Ben Crocker: And some people get tripped up on what hypermedia is, but it's essentially hypertext with other media like images and CSS and that kind of thing.
- 10:16Ben Crocker: And everybody should know what hypertext is because it's the H in HTTP and HTML.
- 10:22Ben Crocker: There is an expectation for people coming into Datastar that you have a basic understanding of the web and web browsers and the web browser API because we lean as heavily as possible on the browser API.
- 10:34Ben Crocker: We get a lot of people coming into the Discord asking us, you know, how should I do this the Datastar way?
- 10:39Ben Crocker: And it got to the point where I'd heard that question so often I decided, OK, I'm going to write a page in the Datastar docs.
- 10:45Ben Crocker: We call it the tau of datastar.
- 10:47Ben Crocker: So it's kind of like the way of datastar.
- 10:49Ben Crocker: And if there's one thing to take from that, it's use as little datastar as possible.
- 10:54Ben Crocker: Like leverage the browser, because the browser is an incredible thing, right?
- 10:58Ben Crocker: Like it's basically an operating system, our operating system as web developers.
- 11:02Ben Crocker: So, and everything happens at the C level, super optimized.
- 11:06Ben Crocker: We're not going to be able to build something faster.
- 11:08Ben Crocker: So leverage the browser as much as possible on the browser APIs.
- 11:12Ben Crocker: And where HTML kind of lacks or where there are some gaps, that's essentially what Datastar is trying to fill.
- 11:19Ben Crocker: So I did a lot of work.
- 11:21Ben Crocker: So just to relate this, I guess, to something that other people might be familiar with, which is HTMX.
- 11:27Ben Crocker: I was an early contributor to HTMX, actually, and I was sold on the idea of hypermedia from the very beginning.
- 11:33Ben Crocker: So HTML is the language of the web.
- 11:36Ben Crocker: Why are we trying to replace it with JavaScript?
- 11:39Ben Crocker: And the problem that I ran into after several years of thinking HTMX is all I need is that last 10%, right?
- 11:46Ben Crocker: Because it'll get you 90% of what you're trying to do.
- 11:50Ben Crocker: But that last 10%, which we all know is the hardest piece that takes the most work, just isn't covered.
- 11:56Ben Crocker: So with HTMX, for example, you will very often reach for another library like AlpineJS,
- 12:02Ben Crocker: or you'll start writing vanilla JS perhaps to fill in those gaps to interactivity to the page,
- 12:09Ben Crocker: because HTMX is really just going to the back end, replacing the DOM.
- 12:13Ben Crocker: But now you have two dependencies.
- 12:15Ben Crocker: Now you have HTMX and Alpine, for example, and you're trying to make those play well together.
- 12:20Michael Kennedy: And because I think that might be a little bit of the missing sauce from HTMX.
- 12:24Michael Kennedy: I've had Carson Gross on and I really admire HTMX.
- 12:28Michael Kennedy: But as I've worked with it over a couple of years, I feel like it's really good as salt or seasoning,
- 12:35Michael Kennedy: something you sprinkle on to really make a website better.
- 12:38Michael Kennedy: But if you try to make a meal out of salt, you're not going to want to eat it.
- 12:41Michael Kennedy: And what I mean is, you have three different disjointed parts of the page,
- 12:47Michael Kennedy: and you're like, this is so amazing to update this with HTML and partials, and so is that.
- 12:51Michael Kennedy: But then you start talking about AlpineJS and connecting different things,
- 12:56Michael Kennedy: and then the JavaScript gets out of sync with this server response.
- 12:59Michael Kennedy: And it just, you start to feel constrained by it.
- 13:03Michael Kennedy: And I think you all have a really nice solution.
- 13:05Michael Kennedy: It's something a little bit like how you, we're going to talk about it,
- 13:08Michael Kennedy: but sort of how you specify the HTML to be updated by the server,
- 13:13Michael Kennedy: but then also connecting different parts of the pages.
- 13:16Michael Kennedy: Chris put it in his article that like the problem is AlpineJS and HTMX
- 13:20Michael Kennedy: are just two unrelated different things that happen to go together a lot.
- 13:24Michael Kennedy: And so they're not cohesive in a sense, right?
- 13:26Delaney Gillilan: Well, and that's one thing that's definitely an issue.
- 13:28Delaney Gillilan: Like, for example, this was my thing
- 13:30Delaney Gillilan: because I actually tried to fix HTMX back in the day.
- 13:33Delaney Gillilan: And like the things that I wanted to fix
- 13:35Delaney Gillilan: were the problem that I see at least
- 13:37Delaney Gillilan: is that you have HTMX, you can add,
- 13:39Delaney Gillilan: it has extensions, so you can add stuff to it.
- 13:41Delaney Gillilan: But it fundamentally was built to be like,
- 13:44Delaney Gillilan: here's our way of doing it.
- 13:45Delaney Gillilan: And then you can do your own stuff on top of it.
- 13:47Delaney Gillilan: The problem is, is that I thought that's broken.
- 13:51Delaney Gillilan: I've done enough game development
- 13:52Delaney Gillilan: to know that you need to be agile.
- 13:53Delaney Gillilan: I need to be able to like be able to move quickly.
- 13:55Delaney Gillilan: So I wanted it so that nothing was basically like the core of data star is like 300 lines
- 14:01Delaney Gillilan: long.
- 14:01Delaney Gillilan: And it is basically setting up data dash star elements, hooking up plugins, and then everything
- 14:06Delaney Gillilan: else is a plugin.
- 14:07Delaney Gillilan: So if you don't agree with us, or if someone's better than I am, great, that's wonderful.
- 14:12Delaney Gillilan: We will be able to just pop that part out, put the new part in.
- 14:15Delaney Gillilan: But plugins can now depend on each other.
- 14:17Delaney Gillilan: They can understand.
- 14:17Delaney Gillilan: It's an ecosystem.
- 14:18Delaney Gillilan: Ironically, that's what happens under the hood.
- 14:21Delaney Gillilan: But the ideas of that make it so much more powerful.
- 14:23Delaney Gillilan: And the irony is that if you build it in that kind of plugin style way, in the more game developer style way, we are smaller than HTMX and Alpine alone, let alone combined, let alone Hyperscript and all these other things.
- 14:34Delaney Gillilan: So it's just a different way of thinking about the problem.
- 14:36Ben Crocker: When I first encountered Datastar and looked at the source code, it looked very foreign to me because Delaney coming from game development, he built Datastar like a game engine.
- 14:47Ben Crocker: So you have this very thin core and then everything else pretty much is a plugin.
- 14:52Ben Crocker: And all Datastar core is a way for registering plugins and having Datastar attributes.
- 14:59Ben Crocker: And that's pretty much it.
- 15:00Ben Crocker: Everything else is an add-on that you, is a plugin that you can take away.
- 15:03Ben Crocker: So we even have a bundler on the site that allows you to just, well, you can just download
- 15:08Ben Crocker: Datastar core or you can just select what plugins you want.
- 15:12Ben Crocker: Now, that in and of itself is not that interesting because we're, at the end of the day, we're
- 15:16Ben Crocker: talking about a 10 kilobyte JavaScript file with all of the plugins.
- 15:19Ben Crocker: But it is open source, which we didn't mention.
- 15:21Ben Crocker: And so anybody can go just kind of look at it if you're interested.
- 15:25Ben Crocker: But that approach means that everything is modular and everything is there for a reason.
- 15:30Ben Crocker: And we'll get into this later, I guess.
- 15:32Ben Crocker: But like deciding what plugins go in and what stay out is one of the challenges.
- 15:36Ben Crocker: And we just try to keep it as lean as possible.
- 15:39Ben Crocker: My way of thinking about it is that Datastar gives you everything you need and nothing you don't.
- 15:44Ben Crocker: And that's how we try to kind of keep it lean and fast.
- 15:48Michael Kennedy: This portion of Talk Python Maze brought to you by Sentry.
- 15:51Michael Kennedy: I've been using Sentry personally on almost every application and API that I've built for
- 15:56Michael Kennedy: Talk Python and beyond over the last few years.
- 15:59Michael Kennedy: They're a core building block for keeping my infrastructure solid.
- 16:03Michael Kennedy: They should be for yours as well.
- 16:04Michael Kennedy: Here's why.
- 16:05Michael Kennedy: Sentry doesn't just catch errors.
- 16:07Michael Kennedy: It catches all the stuff that makes your app feel broken.
- 16:10Michael Kennedy: The random slowdown, the freeze you can't reproduce, that bug that only shows up once
- 16:14Michael Kennedy: real users hit it.
- 16:15Michael Kennedy: And when something goes wrong, Sentry gives you the whole chain of events in one place.
- 16:19Michael Kennedy: errors, traces, replays, logs, dots connected.
- 16:22Michael Kennedy: You can see what's led to the issue
- 16:25Michael Kennedy: without digging through five different dashboards.
- 16:27Michael Kennedy: Seer, Sentry's AI debugging agent,
- 16:30Michael Kennedy: builds on this data, taking the full context,
- 16:32Michael Kennedy: explaining why the issue happened,
- 16:35Michael Kennedy: pointing to the code responsible, drafts a fix,
- 16:37Michael Kennedy: and even flags if your PR is about to introduce a new problem.
- 16:41Michael Kennedy: The workflow stays simple.
- 16:43Michael Kennedy: Something breaks, Sentry alerts you,
- 16:45Michael Kennedy: the dashboard shows you the full context.
- 16:47Michael Kennedy: Seer helps you fix it and catch new issues
- 16:49Michael Kennedy: before they ship. It's totally reasonable to go from an error occurred to fixed in production in
- 16:55Michael Kennedy: just 10 minutes. I truly appreciate the support that Sentry has given me to help solve my bugs
- 17:01Michael Kennedy: and issues in my apps, especially those tricky ones that only appear in production. I know you will
- 17:06Michael Kennedy: too if you try them out. So get started today with Sentry. Just visit talkpython.fm/sentry
- 17:12Michael Kennedy: and get $100 in Sentry credits. Please use that link. It's in your podcast player show notes. If
- 17:19Michael Kennedy: our code talkpython26, all one word talkpython26 to get $100 in credits.
- 17:26Michael Kennedy: Thank you to Sentry for supporting the show.
- 17:29Michael Kennedy: Cool.
- 17:29Michael Kennedy: That's a super interesting philosophy to say you should be able to take, even take
- 17:33Michael Kennedy: stuff out of what we're giving you by default, right?
- 17:35Michael Kennedy: Now, before we move on from sort of introducing Datastar, I do want to point out at data-star.dev,
- 17:42Michael Kennedy: which of course I'll link this notes, there's some cool examples on here.
- 17:45Michael Kennedy: You've got a really nice space 2001 sort of theme with Hal and all that, which is great.
- 17:53Michael Kennedy: I like the aesthetic here, which is very fun.
- 17:56Michael Kennedy: It's got a little bit of a retro gaming feel, which is nice.
- 18:00Michael Kennedy: But what I want to point out is I want to encourage people to go watch your little video.
- 18:03Michael Kennedy: Your video is fun.
- 18:05Ben Crocker: It's really fun.
- 18:06Ben Crocker: This video is all about how Datastar fits in the world of SPAs.
- 18:11Ben Crocker: And one thing we didn't really mention is that Datastar is a full-fledged SPA replacement.
- 18:17Ben Crocker: So again, like that last 10%, often people will think, oh, well, I need to go to React or Vue.js or some single page application framework.
- 18:26Ben Crocker: Whereas we're saying that, no, no, no, Datastar will not only, it's not like a subset or like SPAs are not a superset.
- 18:34Ben Crocker: it's on the contrary. I think Datastar, we think Datastar can do more than SPAs because we are
- 18:42Ben Crocker: driven by the backend and we are focused on hypermedia, which is the language of the web.
- 18:46Ben Crocker: So this, yeah, so this video is kind of throwing, yeah, anyway, everybody should watch it.
- 18:51Chris May: I'd also like to, if you can scroll back up to the top of the page, the Starfield animation was
- 18:57Chris May: one of the things like when Delaney and when everybody who worked on this published it,
- 19:02Chris May: Like I didn't realize how amazing this was
- 19:04Chris May: because if you like right click and inspect that thing,
- 19:07Chris May: it's a web component.
- 19:09Chris May: And so all the JavaScript that's required
- 19:11Chris May: for making all the stars go faster and slower
- 19:13Chris May: and tracking your mouse where, you know, wherever you do it,
- 19:16Chris May: it's all within that web component.
- 19:18Chris May: And data star is essentially subscribing to like,
- 19:21Chris May: where's the mouse pointer
- 19:22Chris May: and passing it into the web component.
- 19:24Delaney Gillilan: Yeah, in fact, if you go to more examples,
- 19:27Delaney Gillilan: you will see that there's,
- 19:29Delaney Gillilan: and then go scroll down to,
- 19:31Delaney Gillilan: or use the hamburger thing.
- 19:32Delaney Gillilan: Yeah, go down to the rocket.
- 19:35Delaney Gillilan: There's the actual star field.
- 19:38Delaney Gillilan: So you can see the entire, the star field,
- 19:40Delaney Gillilan: the entire component is there.
- 19:41Delaney Gillilan: So if you scroll down from there,
- 19:43Delaney Gillilan: you'll see how it actually gets hooked up
- 19:45Delaney Gillilan: and the entire component,
- 19:46Delaney Gillilan: that's the whole thing, it's right there.
- 19:48Michael Kennedy: - That's incredible.
- 19:49Delaney Gillilan: - And the thing is if you start moving around,
- 19:51Delaney Gillilan: like if you scroll up just a little bit more,
- 19:52Delaney Gillilan: so you can see the sliders,
- 19:54Delaney Gillilan: you'll see that they're live, everything's,
- 19:56Delaney Gillilan: if you move it around,
- 19:57Delaney Gillilan: like you move your mouse around the canvas,
- 19:59Delaney Gillilan: you'll see everything's live editing,
- 20:01Delaney Gillilan: everything's thing.
- 20:02Delaney Gillilan: It's the irony of Datastar.
- 20:03Delaney Gillilan: And this is the part that I don't think people quite get.
- 20:06Delaney Gillilan: And it's not that you're trying to like,
- 20:08Delaney Gillilan: we love what Carson has done with HTMX.
- 20:10Delaney Gillilan: We love that all the things they've done,
- 20:11Delaney Gillilan: but it does not do everything.
- 20:13Delaney Gillilan: It doesn't do enough.
- 20:14Delaney Gillilan: It is a library, not a framework.
- 20:15Delaney Gillilan: And the thing is,
- 20:16Delaney Gillilan: the irony is that Datastar actually has
- 20:18Delaney Gillilan: the fastest reactive signal,
- 20:21Delaney Gillilan: like reactive signals.
- 20:22Delaney Gillilan: We are the fastest thing out there.
- 20:23Delaney Gillilan: So it's not just like we did something
- 20:25Delaney Gillilan: that's kind of like VDOM,
- 20:26Delaney Gillilan: or we are like,
- 20:27Delaney Gillilan: we can compete with React.
- 20:28Delaney Gillilan: We demolish them with actual numbers.
- 20:30Delaney Gillilan: So we have the fastest morphing strategy and we also have the fastest signals, which means doing these kinds of things.
- 20:35Delaney Gillilan: It's just a non-issue.
- 20:36Delaney Gillilan: Like this star field thing is 1K.
- 20:38Delaney Gillilan: Like it's just these are the kinds of things that are just a non-issue in this if you do things our way.
- 20:42Chris May: And you're leaning into the web ecosystem by leveraging web components instead of having to like build, have a build time pipeline to, you know, do all the custom JavaScript.
- 20:53Chris May: Like once I realized like you can do these things, it just made, it just clicked.
- 20:57Chris May: And I just make it's I feel like it's so much more fun now to work on the web now that I understand these things.
- 21:04Michael Kennedy: Let's talk through some of the core examples.
- 21:06Michael Kennedy: I feel like there's some similarities to the example section of the HTMX place.
- 21:11Michael Kennedy: But, you know, HTMX doesn't have a star field, certainly.
- 21:14Michael Kennedy: Best place to start is on the homepage.
- 21:17Ben Crocker: Before we get into those examples, just just to kind of take a step back and say, OK, we've mentioned HTMX a few times and we don't we don't even like to compare ourselves to HTMX.
- 21:26Ben Crocker: but it is a good maybe starting point for some people.
- 21:29Ben Crocker: We have a hello world example there,
- 21:31Ben Crocker: if you could find that.
- 21:32Ben Crocker: Yeah, let's scroll down just a little bit more.
- 21:33Ben Crocker: Yeah, you got it.
- 21:34Ben Crocker: One of the maybe differences between HTMX and Datastar
- 21:38Ben Crocker: is that Datastar can receive HTML responses,
- 21:41Ben Crocker: but it also by default,
- 21:42Ben Crocker: or the recommendation is to use server sent events.
- 21:46Ben Crocker: So if you hit start there,
- 21:47Ben Crocker: you're going to see kind of the network response tab,
- 21:50Ben Crocker: and those are server sent events.
- 21:51Ben Crocker: And SSE server sent events are an old technology
- 21:55Ben Crocker: that work just over HTTP.
- 21:57Ben Crocker: And essentially what happens is that the server
- 22:00Ben Crocker: holds a connection open to the browser
- 22:02Ben Crocker: and it's unidirectional.
- 22:03Ben Crocker: So you send a request to the server
- 22:05Ben Crocker: and then the server can stream events back down,
- 22:08Ben Crocker: which is what you're seeing here.
- 22:10Ben Crocker: Now, this is obviously a trivial example, right?
- 22:12Ben Crocker: We're sending one,
- 22:13Ben Crocker: or we're updating the message one character at a time.
- 22:16Ben Crocker: But when you see how simple this is,
- 22:19Ben Crocker: then you can perhaps see potential for this, right?
- 22:22Ben Crocker: And SSE or server-sent events have had kind of a renaissance in recent years with all of the LLMs, right?
- 22:29Ben Crocker: All the chatbots are streaming the responses back to you.
- 22:33Ben Crocker: So this type of technology, while it's not old, sorry, it's not new, it's actually been around a long time, has kind of been underused.
- 22:43Ben Crocker: And Delaney kind of tapped into that and said, well, because I also always thought, well, if I want pure reactivity or true reactivity,
- 22:50Ben Crocker: I need two-way communication.
- 22:53Ben Crocker: So I need web sockets.
- 22:53Michael Kennedy: You need web sockets.
- 22:54Ben Crocker: You need binary and all that kind of stuff.
- 22:56Ben Crocker: Yeah.
- 22:57Ben Crocker: Yeah.
- 22:57Ben Crocker: There's problems with those, which we can get into.
- 23:00Ben Crocker: SSE is much simpler.
- 23:01Ben Crocker: It works over HTTP 1, 2, and 3.
- 23:05Ben Crocker: And as you can see, it's just plain text.
- 23:06Ben Crocker: There is no complicated handshake.
- 23:08Ben Crocker: If you change the interval to zero and hit start,
- 23:13Ben Crocker: you're going to see a different type of response, which is,
- 23:16Ben Crocker: and I don't know if you saw the content type change,
- 23:18Ben Crocker: but content type now is text HTML.
- 23:20Michael Kennedy: Oh, intro.
- 23:20Michael Kennedy: Oh, interesting.
- 23:21Ben Crocker: Yeah.
- 23:22Ben Crocker: So this is what HTMX would do by default.
- 23:24Ben Crocker: You send back HTML responses, whereas here the content type
- 23:28Ben Crocker: is text event stream.
- 23:30Ben Crocker: And this allows you to hold that connection open
- 23:33Ben Crocker: for as long as you want.
- 23:34Ben Crocker: It can be open and closed, or it can stay open until the words
- 23:39Ben Crocker: hello world have been spelled out.
- 23:41Ben Crocker: Or you can keep it open indefinitely.
- 23:44Ben Crocker: So we're going to see some more advanced examples
- 23:46Ben Crocker: where the SSE connection is held open for longer.
- 23:50Ben Crocker: So I think wrapping your head around this example
- 23:55Ben Crocker: taps you into the potential of Datastar.
- 23:57Michael Kennedy: MARK MANDEL: Yeah.
- 23:58Michael Kennedy: And one of the things that--
- 24:00Michael Kennedy: well, when I looked at Datastar, I'm like, OK,
- 24:03Michael Kennedy: there's some interesting aspects here.
- 24:05Michael Kennedy: And we'll get into them, how you can set up--
- 24:08Michael Kennedy: when I click the Start button, it might replace
- 24:10Michael Kennedy: a piece of the page-- hey, that sounds familiar--
- 24:13Michael Kennedy: with HTML, not through JavaScript, right?
- 24:15Michael Kennedy: but it didn't specify anywhere what part of the page to replace or not.
- 24:21Michael Kennedy: Like, how does it know?
- 24:22Michael Kennedy: And so with Datastar, you lean more on the server for many things,
- 24:28Michael Kennedy: including deciding what part of the page that the server created in the first place to update.
- 24:32Michael Kennedy: I really like that.
- 24:33Michael Kennedy: I think that that's super neat.
- 24:35Michael Kennedy: It lets you not just have sort of closer to one source of truth,
- 24:39Michael Kennedy: but also just you can pass down multiple things.
- 24:43Michael Kennedy: is like, we need to update this pane on the right,
- 24:46Michael Kennedy: this text, and this element all in one response.
- 24:50Michael Kennedy: There's a lot of interesting aspects
- 24:52Michael Kennedy: to what you're talking about here.
- 24:54Ben Crocker: JOHN MCWHORTER: Anyone who's familiar with out-of-band swaps
- 24:56Ben Crocker: in HTMX, well, guess what?
- 24:59Ben Crocker: Datastar is out-of-band by default.
- 25:01Ben Crocker: So it's matching currently based on the ID.
- 25:04Ben Crocker: So you see h3 id equals message.
- 25:07Ben Crocker: And every event that's coming back has an ID of message.
- 25:10Ben Crocker: But guess what?
- 25:11Ben Crocker: you can use any ID you want, right?
- 25:13Ben Crocker: So you can use actually any CSS selector you want.
- 25:16Ben Crocker: But yes, we put the onus more on the backend
- 25:20Ben Crocker: because that is where we believe state should live
- 25:23Ben Crocker: or that's the source of truth for state.
- 25:27Ben Crocker: And you send and you work with state on the front end
- 25:30Ben Crocker: only when and where it makes sense to,
- 25:33Ben Crocker: which is more the web component aspect.
- 25:35Delaney Gillilan: And I'll caveat what Ben said there
- 25:36Delaney Gillilan: in that like state mostly lives in the backend.
- 25:40Delaney Gillilan: And that's the problem is that like state lives where it lives.
- 25:43Delaney Gillilan: Like if the user is actively able to move their mouse cursor,
- 25:46Delaney Gillilan: they own that state of the mouse cursor.
- 25:48Delaney Gillilan: You don't own that,
- 25:49Delaney Gillilan: but most of the state from your database should be in the backend.
- 25:52Delaney Gillilan: The one thing that's interesting about the SSE compared to how most people
- 25:56Delaney Gillilan: think this stuff, I will say I fell into this trap too, right?
- 25:59Delaney Gillilan: Cause I did the live view crazy stuff is that your job as a web developer is to
- 26:03Delaney Gillilan: get strings to the browser as efficiently, as fast as possible.
- 26:06Delaney Gillilan: Cause like the browser is going to deal with that,
- 26:09Delaney Gillilan: that into html and all that there's nothing faster than giving it html right so the thing that i i
- 26:14Delaney Gillilan: know i lost for a long time is that sse i thought oh it's this big string thing how is that better
- 26:20Delaney Gillilan: than binary but the irony is that because it's so regular because there's already things like
- 26:25Delaney Gillilan: compression built into the browser there's streaming things there's things that are so
- 26:28Delaney Gillilan: much easier to do here in an efficient way that the irony is if you if you you don't have to care
- 26:33Delaney Gillilan: about all these things but if you just follow our way of doing it your python app will be faster
- 26:38Delaney Gillilan: than most people's like compiled,
- 26:40Delaney Gillilan: you know, like low level language thing
- 26:42Delaney Gillilan: because you're getting orders of magnitude
- 26:44Delaney Gillilan: in the algorithms
- 26:44Delaney Gillilan: and how we're doing stuff from the hood.
- 26:46Delaney Gillilan: So I don't know if you're interested
- 26:47Delaney Gillilan: in like the deep down stuff
- 26:49Delaney Gillilan: or just like how you use it as a Python developer.
- 26:51Delaney Gillilan: But the irony is that you now have tapped into this.
- 26:53Delaney Gillilan: It seems so simple.
- 26:54Delaney Gillilan: You're like, oh, this is just a different text response.
- 26:56Delaney Gillilan: How can this be orders of magnitude faster?
- 26:58Delaney Gillilan: Like, again, I don't know how much
- 26:59Delaney Gillilan: you want to get into the weeds of that
- 27:01Delaney Gillilan: compared to just it's fun to use, right?
- 27:03Michael Kennedy: Yeah, I really like the philosophy
- 27:05Michael Kennedy: of having so much of it controlled by the server.
- 27:08Michael Kennedy: It just felt disheartening.
- 27:10Michael Kennedy: It's like, okay, so what you're going to do
- 27:11Michael Kennedy: is you're just going to create some JSON responses
- 27:14Michael Kennedy: on your server,
- 27:15Michael Kennedy: and then everything is some crazy build series of steps
- 27:19Michael Kennedy: to end up with, I don't know,
- 27:21Michael Kennedy: Vue or React or something on the front end.
- 27:23Michael Kennedy: And there's just so much power and flexibility
- 27:26Michael Kennedy: to write really cool server code.
- 27:29Michael Kennedy: But, you know, like a lot of the trends have been,
- 27:31Michael Kennedy: yeah, that's kind of just there to support the rest of it,
- 27:34Michael Kennedy: you know, and so I don't know, this really appeals to me.
- 27:37Ben Crocker: question that comes up often is like, OK, well, how do I format this? Because it has its own syntax.
- 27:44Ben Crocker: Very simple to read, obviously, right? An event name and then these data lines. And you can just
- 27:48Ben Crocker: have as many data lines as you want. And that's your HTML. If you scroll up, though, we do have...
- 27:54Ben Crocker: So you do need to format this, but we essentially have all of these SDKs, including Python, you'll
- 28:01Ben Crocker: see there. And the Python SDK is actually, I would say, one of the most intricate ones we have.
- 28:07Ben Crocker: Spatuel King, he's a member of the community, or Chase, I believe is his first name, his real first
- 28:13Ben Crocker: name, and many other contributors did an amazing job on that. So lots and lots of Python frameworks
- 28:18Ben Crocker: are supported. You can maybe speak more to this, Chris. And really, the SDKs are very simple,
- 28:24Ben Crocker: because all they do is they take a function, a patch elements or patch signals function,
- 28:30Ben Crocker: and you just dump in the HTML that you want swapped into the DOM or the signals you want
- 28:34Ben Crocker: output on the page and it just does the formatting for you so so it's really just there's three
- 28:39Chris May: functions i think in total that every sdk has to implement and it's such a time saver you know um
- 28:45Chris May: i doved into server-sent events a lot with htmx and when you get the syntax wrong it is so painful
- 28:52Chris May: to debug because pretty much can't it just doesn't work you know or whatever it's harder to debug and
- 28:58Chris May: so to have the helper syntax it's just a dream well and also just so people are aware i like
- 29:04Delaney Gillilan: because I was originally going to try,
- 29:06Delaney Gillilan: the irony is I was trying to get server sent events
- 29:08Delaney Gillilan: like their plugin up to snuff like years ago.
- 29:11Delaney Gillilan: Like I would highly recommend not using SSE with HTMX
- 29:14Delaney Gillilan: because the problem is that the entire model
- 29:16Delaney Gillilan: of how you build things is very poll based
- 29:18Delaney Gillilan: and it's built out of band.
- 29:19Delaney Gillilan: It's like a weird concept,
- 29:21Delaney Gillilan: like the idea of updating,
- 29:22Delaney Gillilan: like it is not built with that in mind.
- 29:24Delaney Gillilan: So I know that they're trying to move towards that
- 29:25Delaney Gillilan: in the future,
- 29:26Delaney Gillilan: but the whole way that you interact with it
- 29:28Delaney Gillilan: is based on polling.
- 29:30Delaney Gillilan: And the thing about our way
- 29:31Delaney Gillilan: is that not only are you doing push events,
- 29:33Delaney Gillilan: But the thing is that really does change the semantics of the language.
- 29:36Delaney Gillilan: So first of all, you get like 40X compression by doing our way.
- 29:40Delaney Gillilan: But also you only send data when you need to instead of polling.
- 29:43Delaney Gillilan: So now you're using less resources.
- 29:45Delaney Gillilan: You're using less network.
- 29:46Delaney Gillilan: It changes the whole dynamic in a deeper way that you can literally save 5,000X in your network bandwidth.
- 29:54Delaney Gillilan: It sounds crazy, but it's just a reality.
- 29:57Michael Kennedy: Right.
- 29:57Michael Kennedy: Another thing, Delaney, that's really nice about that is the latency.
- 30:00Michael Kennedy: That's something that drives me crazy about polling.
- 30:03Michael Kennedy: general is just like okay well we don't want to hammer the server too hard so let's make this you
- 30:09Michael Kennedy: know one second two second but then it's like well i click this button and then it updates and you're
- 30:13Michael Kennedy: like ah if if something happens on the server it's sent right if it wants to one of the things that
- 30:18Delaney Gillilan: ironically because i do a lot of like go or low level language stuff is that i tend to put a debounce
- 30:23Delaney Gillilan: in my server to like five milliseconds so that i get i'm not updating more than you know 200 times
- 30:30Delaney Gillilan: a second even on a monitor because the browser actually break after 500 fps so like the
- 30:36Delaney Gillilan: interesting thing is not that it's basically data starts no longer the issue in your thing if you
- 30:40Delaney Gillilan: are on a low low powered battery device like a mobile on a 3g this is it will just work like it's
- 30:47Delaney Gillilan: stuff that you just don't have to worry about so it does change the semantics of how you build things
- 30:52Delaney Gillilan: just so that you're aware because even things like for example built into the htmx they don't do
- 30:57Delaney Gillilan: automatic exponential back off.
- 30:59Delaney Gillilan: It doesn't have all the verbs.
- 31:01Delaney Gillilan: There's caveats there that I would recommend
- 31:03Delaney Gillilan: not doing it, honestly, if you're going to do it.
- 31:05Michael Kennedy: It's crazy that you're talking about going below
- 31:07Michael Kennedy: the monitor refresh rate.
- 31:09Michael Kennedy: You're not going to see it. This is only
- 31:11Michael Kennedy: 120 hertz.
- 31:13Michael Kennedy: 120 times a second.
- 31:15Michael Kennedy: So why would you pull
- 31:17Michael Kennedy: faster than that? That's wild.
- 31:20Michael Kennedy: This portion
- 31:21Michael Kennedy: of Talk Python To Me is brought to you by us.
- 31:23Michael Kennedy: I'm thrilled to announce a brand
- 31:25Michael Kennedy: new app built for developers
- 31:26Michael Kennedy: created by yours truly.
- 31:28Michael Kennedy: It's called Command Book.
- 31:30Michael Kennedy: You know that thing you do every morning?
- 31:32Michael Kennedy: Open up six terminal tabs,
- 31:33Michael Kennedy: CD into this directory,
- 31:35Michael Kennedy: activate that virtual environment,
- 31:36Michael Kennedy: run the server with --reload.
- 31:38Michael Kennedy: Now, CD somewhere else,
- 31:40Michael Kennedy: start the background worker,
- 31:41Michael Kennedy: another tab for Docker,
- 31:42Michael Kennedy: another one to tail production logs.
- 31:44Michael Kennedy: Every tab just says Python, Python, Python,
- 31:47Michael Kennedy: Docker tail.
- 31:48Michael Kennedy: And you're clicking through them going,
- 31:49Michael Kennedy: which Python was that again?
- 31:51Michael Kennedy: Where my app is running?
- 31:52Michael Kennedy: Then sometime later,
- 31:54Michael Kennedy: your dev server silently dies
- 31:55Michael Kennedy: because it tried to reload while you're in the middle of a code edit,
- 31:59Michael Kennedy: unmatched brace, a half-written import, or something.
- 32:02Michael Kennedy: Now you're hunting through tabs to figure out which process crashed
- 32:05Michael Kennedy: and how to restart it.
- 32:06Michael Kennedy: My app, CommandBook, gives all of these long-running commands a permanent home.
- 32:11Michael Kennedy: You save a command once, the working directory, the environment,
- 32:14Michael Kennedy: free commands like git pull, and from then on, you just click run.
- 32:18Michael Kennedy: You can even group commands together to start and stop everything
- 32:21Michael Kennedy: for a project with a single click.
- 32:23Michael Kennedy: It also has what I call Honey Badger Mode, auto restart on crash.
- 32:27Michael Kennedy: So when your dev server goes down mid-reload,
- 32:30Michael Kennedy: Command Book just brings it right back up and does so over and over until the code is fixed.
- 32:35Michael Kennedy: It also detects URLs from your output,
- 32:37Michael Kennedy: so you're never scrolling through thousands of lines of logs
- 32:39Michael Kennedy: just to figure out how to reopen your web app.
- 32:42Michael Kennedy: And it shows you uptime, memory usage, and all sorts of cool things about your process.
- 32:46Michael Kennedy: The whole thing is a native macOS app.
- 32:49Michael Kennedy: No electron, no Chromium, just 21 megs.
- 32:51Michael Kennedy: And it comes with a full CLI.
- 32:53Michael Kennedy: So anything you've configured in the UI,
- 32:55Michael Kennedy: you can fire off from your terminal with just a single command.
- 32:58Michael Kennedy: Right now it's macOS only, but if there's enough interest,
- 33:02Michael Kennedy: I'll build a Windows version too.
- 33:03Michael Kennedy: So let me know.
- 33:05Michael Kennedy: Please check it out at talkpython.fm/command book app,
- 33:09Michael Kennedy: download it for free, level up your developer workflow.
- 33:12Michael Kennedy: The link is in your podcast player show notes.
- 33:14Michael Kennedy: That's talkpython.fm/command book.
- 33:16Michael Kennedy: I really hope you enjoy this new app that I built.
- 33:20Ben Crocker: Yeah, on the topic of latency and all that, if you go to the examples, there's some we could look at that I think really demonstrate this.
- 33:28Ben Crocker: Well, maybe start with bad Apple just because we're talking about refresh rates.
- 33:33Ben Crocker: OK.
- 33:33Ben Crocker: What's happening is that the back end is streaming down just a bunch of symbols, but it creates this animation.
- 33:39Ben Crocker: And if you were to open the network tab, you would see it actually would be interesting to see.
- 33:44Ben Crocker: You probably have to refresh the page just to.
- 33:46Ben Crocker: Yeah.
- 33:47Ben Crocker: And you're going to see updates.
- 33:49Ben Crocker: That one there.
- 33:49Ben Crocker: Yeah, if you click that--
- 33:51Ben Crocker: This one?
- 33:52Ben Crocker: Yeah, that's the one.
- 33:53Ben Crocker: You click Event Stream.
- 33:54Ben Crocker: There's an Event Stream tab for Event Stream responses.
- 33:57Ben Crocker: You're going to see these streaming.
- 33:58Ben Crocker: I don't know what frames per second we have this set to,
- 34:01Ben Crocker: but you see it streaming past, right?
- 34:03Ben Crocker: Right.
- 34:03Ben Crocker: The first time many people see this,
- 34:05Ben Crocker: this is a surprise that the browser is capable of this.
- 34:09Ben Crocker: But the browser can stream video, so why
- 34:11Ben Crocker: can't it stream a bunch of text?
- 34:12Ben Crocker: I mean, it's not that big of a leap of faith.
- 34:15Ben Crocker: But you can see, it looks like it's about every 10, 20
- 34:18Ben Crocker: milliseconds.
- 34:19Delaney Gillilan: I think we're doing like 30 frames a second, but again, we can do like, we're doing this on a,
- 34:24Delaney Gillilan: basically a free tier server. So like, this is just a non-issue and it's doing all the compression
- 34:28Delaney Gillilan: stuff. So if you notice that your update, even though we're doing like full ASCII development at,
- 34:32Delaney Gillilan: you know, thousands of characters, your updates are actually not updating that. Like you see how
- 34:37Delaney Gillilan: it's transferring, but it's not transferring that much compared to how much it's actually coming out.
- 34:41Michael Kennedy: I can see we got 1.9 megs for the whole page. Yeah. But do you see next to it? What, what was
- 34:46Ben Crocker: actually like the resources so you see the compression well yeah we're probably not seeing
- 34:51Ben Crocker: it there but in the bottom you'll see two two megabytes have been transferred but 10 megabytes
- 34:55Ben Crocker: of resources and so that's oh yeah yeah so it's a 5x compression yeah it's going to be much more
- 35:01Ben Crocker: on the stream i think because it's streaming uh normally you can hover over the size
- 35:07Ben Crocker: and you'll see the uncompressed but i guess it's changing too fast that's pretty wild and you know
- 35:13Chris May: in practical usage, like I have a status screen that I have from my production app at work. And
- 35:19Chris May: it's just amazing to just constantly be seeing these things update. And I'm doing that by having
- 35:24Chris May: the database tell my Python code, hey, refresh. I actually ask it to get all the entries from the
- 35:31Chris May: database and send it down the pipe. And so it's not like I'm doing the optimized thing. I'm doing
- 35:35Chris May: the simple thing and I get all these cool things just updating all the time. And it's just such a
- 35:40Chris May: useful thing, especially for status screens, dashboards, stuff like that.
- 35:44Delaney Gillilan: Speaking of that, go to the DB Mon example. This is one of my favorites because when React
- 35:50Delaney Gillilan: first had their first conference, they said, look at what we're doing. We're able to update at a rate
- 35:54Delaney Gillilan: that no one else can compete with us in how fast they could update the browser, right? If we
- 35:59Delaney Gillilan: actually, yeah, you're still there. So the thing is, if you actually set the FPS to something like
- 36:03Delaney Gillilan: 80, whatever. So that is how fast it's coming from the backend to you. So go ahead. Yeah,
- 36:10Delaney Gillilan: because we just don't want people blasting the server.
- 36:12Michael Kennedy: Yeah, you don't want to walk away.
- 36:14Delaney Gillilan: Yeah, but the point is that this is coming.
- 36:16Delaney Gillilan: See, we're doing stuff in microseconds on a potato.
- 36:19Michael Kennedy: Yeah, let me just describe this a little bit for people listening.
- 36:22Michael Kennedy: So it's like a database monitoring table
- 36:25Michael Kennedy: that shows you how many transactions are the database overloads.
- 36:29Michael Kennedy: So it's updating a grid of maybe 10 or 12 databases
- 36:34Michael Kennedy: with five or six elements,
- 36:36Michael Kennedy: and it's doing that in microseconds, 80 times a second.
- 36:38Ben Crocker: A lot of people see these examples and they think, well, I'm not building this kind of stuff.
- 36:43Ben Crocker: And me included.
- 36:44Ben Crocker: I build crud apps most of the time.
- 36:47Ben Crocker: And there are plenty of examples here that are just cruddy things.
- 36:51Ben Crocker: They're kind of the more boring examples.
- 36:53Ben Crocker: But one example that might be worth looking at is the to-do MVC.
- 36:58Ben Crocker: And if you can figure out how to open that in split screen.
- 37:01Michael Kennedy: Okay.
- 37:02Michael Kennedy: What part do you want me to open up in split?
- 37:04Michael Kennedy: Oh, just this, the example.
- 37:05Michael Kennedy: Yeah, so I can do these two and then I can tile them.
- 37:09Ben Crocker: How's that?
- 37:10Ben Crocker: So this is a CRUD app, but what Datastar gives you is the ability to do multiplayer out of the box.
- 37:15Ben Crocker: And that is like real-time collaborative apps are not easy to do and not easy to scale as well.
- 37:22Ben Crocker: But as you'll see here, when you have like two sessions open, it's going to be near instant.
- 37:27Ben Crocker: You're going to basically be observing the latency on your network connection,
- 37:31Ben Crocker: which is going to be 50 milliseconds to 100, but barely perceivable.
- 37:35Michael Kennedy: So just to describe to people, we've got this TodoMVC, which allows you to, well, it's like a
- 37:40Michael Kennedy: to-do example, which is required to be a legitimate JavaScript framework. But I've opened it in two
- 37:46Michael Kennedy: tabs and I've used Vivaldi's tile. So these are legitimately two browsers. They just appear to be
- 37:51Michael Kennedy: kind of in the same window. And when I enter stuff into it, it literally looks like they update in
- 37:57Ben Crocker: parallel, which is crazy. If you check a few of them, you'll see,
- 38:00Ben Crocker: You can barely tell which one's updating which.
- 38:03Ben Crocker: It happens almost instantly.
- 38:04Michael Kennedy: Yeah, if I look at the other one and I click on one,
- 38:07Michael Kennedy: it feels like that's responding to my click.
- 38:10Ben Crocker: I need to correct myself that it is happening instantly
- 38:13Ben Crocker: because when you click, when you check one of those,
- 38:15Ben Crocker: it's not, and this is an interesting thing we can get into.
- 38:19Ben Crocker: We're not doing optimistic updates.
- 38:21Ben Crocker: It's actually sending a request to the server
- 38:24Ben Crocker: and the server is simultaneously updating
- 38:27Ben Crocker: both of your tabs at the same time.
- 38:29Michael Kennedy: Even if I had just one open,
- 38:31Michael Kennedy: it's still going round trip to the server.
- 38:33Michael Kennedy: That's why it looks like it's simultaneous
- 38:34Michael Kennedy: because it's effectively.
- 38:35Delaney Gillilan: This is a thing that you can,
- 38:37Delaney Gillilan: we can talk for like three hours
- 38:38Delaney Gillilan: and I will yell at most spa developers
- 38:41Delaney Gillilan: because there's this weird thing
- 38:43Delaney Gillilan: that because it's easy,
- 38:44Delaney Gillilan: people will actively lie to users in the spa world
- 38:47Delaney Gillilan: and they'll do optimistic updates,
- 38:49Delaney Gillilan: which means I'm going to make it
- 38:50Delaney Gillilan: so that I'm making this change.
- 38:52Delaney Gillilan: And then if there's a problem, then fix it.
- 38:54Delaney Gillilan: Whereas we say you should do indicator saying,
- 38:56Delaney Gillilan: I'm trying to make a change to this
- 38:58Delaney Gillilan: and then fix it.
- 38:59Delaney Gillilan: Because you don't want, like when you're playing a video game, you can do what's called dead
- 39:02Delaney Gillilan: reckoning and you can do some stuff to net rollback code.
- 39:05Delaney Gillilan: You can do some clever things to hide latency, but you don't want to hide latency when it
- 39:10Delaney Gillilan: comes to like a bank transfer or did I buy that thing or did I get that theater ticket
- 39:14Delaney Gillilan: or any of that stuff.
- 39:15Delaney Gillilan: Like people just have the wrong mental model of how the web should work.
- 39:19Delaney Gillilan: I'm actually going to send you another thing that this might blow your mind even more because
- 39:23Delaney Gillilan: the three of us basically can play.
- 39:25Delaney Gillilan: This is an example where all of us could be playing live with each other right now in an active shared state that's been at the top of the Hacker News and again, runs on a potato.
- 39:35Delaney Gillilan: I don't know if you just put that in your...
- 39:37Michael Kennedy: Yeah, let me drop it over.
- 39:38Michael Kennedy: Hold on.
- 39:38Michael Kennedy: I'm going to put it in the other tab.
- 39:39Delaney Gillilan: So right now, don't touch anything.
- 39:42Delaney Gillilan: I'm going to actively start.
- 39:43Delaney Gillilan: I am purple.
- 39:43Delaney Gillilan: I am literally starting to click right now.
- 39:45Michael Kennedy: All right.
- 39:46Michael Kennedy: So we're looking at a multiplayer game of life here.
- 39:48Delaney Gillilan: I'm seeing that live here.
- 39:50Delaney Gillilan: And if you open up that in the other tab, you would actively see the exact same state.
- 39:54Delaney Gillilan: So everyone in the world, like if you open that up in the other tab,
- 39:58Delaney Gillilan: you cannot get out of sync.
- 40:00Delaney Gillilan: It's not faking it in the front end.
- 40:01Delaney Gillilan: This is literally sending in.
- 40:02Delaney Gillilan: What's even crazier about this, here's the crazy part.
- 40:04Delaney Gillilan: It's actually a rendering demo.
- 40:06Delaney Gillilan: The guy who wrote it is writing in a scripting language, Clojure,
- 40:09Delaney Gillilan: and he's sending down 2,500 divs per frame styled, inline styled.
- 40:14Delaney Gillilan: Now go to your network tab now and look at what's actually,
- 40:17Delaney Gillilan: like look at your network tab and you'll see how little data we're actually sending over.
- 40:21Delaney Gillilan: even though he's updating 2,500 divs per frame,
- 40:24Delaney Gillilan: like if you go to wherever it's updated,
- 40:26Delaney Gillilan: yeah, whichever one's the one that's updated,
- 40:28Delaney Gillilan: there you go, yeah.
- 40:29Delaney Gillilan: So if you look here and look at how much is being sent
- 40:32Delaney Gillilan: versus how many is actually,
- 40:33Delaney Gillilan: like try to, like, this is just a different paradigm
- 40:36Delaney Gillilan: for how you build.
- 40:37Delaney Gillilan: And the thing is, again,
- 40:38Delaney Gillilan: not everybody has to care about these low level things,
- 40:40Delaney Gillilan: but the thing is, is that once you do this,
- 40:42Delaney Gillilan: the idea of CRUD kind of goes away
- 40:44Delaney Gillilan: because in our opinion, you go to a multi,
- 40:46Delaney Gillilan: you make a multi-page app like you would normally do
- 40:49Delaney Gillilan: in HTMX or anything else,
- 40:50Delaney Gillilan: but you keep an open stream
- 40:52Delaney Gillilan: and you just update whatever's happening in your backend
- 40:54Delaney Gillilan: as it's happening.
- 40:55Delaney Gillilan: And it simplifies the world.
- 40:57Delaney Gillilan: And what's also interesting
- 40:58Delaney Gillilan: is because of how we do compression and all that,
- 41:00Delaney Gillilan: you just send your entire page.
- 41:01Delaney Gillilan: You don't need like out of band.
- 41:03Delaney Gillilan: It doesn't even really make sense
- 41:04Delaney Gillilan: because we're so fast that you can just,
- 41:06Delaney Gillilan: you as a Python developer,
- 41:08Delaney Gillilan: you just give us your entire page
- 41:09Delaney Gillilan: and let us deal with it.
- 41:10Delaney Gillilan: And we will come up with the fast stuff.
- 41:12Delaney Gillilan: So Chris should probably talk a lot more to that
- 41:14Delaney Gillilan: because the fat morpher stuff,
- 41:15Delaney Gillilan: it's a fundamental change in how you build web apps, I think.
- 41:18Chris May: Yeah, yeah.
- 41:19Chris May: especially the kind of the mental shift of like,
- 41:22Chris May: because I kept thinking, okay, I need to like send one row at a time.
- 41:25Chris May: And I actually have one status screen that does that
- 41:27Chris May: because we use a Firestore, Google's Firestore as our backend for this app.
- 41:32Chris May: But for some reason, sometimes it just doesn't send every update.
- 41:36Chris May: And so on another status screen, I actually, you know,
- 41:38Chris May: query the whole database table or collection and send it down to Pipe.
- 41:42Chris May: And because sometimes it doesn't send from Firestore,
- 41:45Chris May: I get the entire latest state of all the things that are in flight and updated on my screen.
- 41:51Michael Kennedy: And it just makes things easier.
- 41:52Michael Kennedy: Yeah, it's amazing.
- 41:53Michael Kennedy: Sounds like a good opportunity to subscribe to database query changes.
- 41:57Michael Kennedy: I know some databases you can say, if this query updates, you know, trigger this event and then keep it flowing,
- 42:03Michael Kennedy: like straight from events on the database, straight to your front end.
- 42:06Michael Kennedy: Pretty cool.
- 42:07Michael Kennedy: I do want to go back and just put a little bit of commentary, Delaney.
- 42:12Michael Kennedy: Well, you said optimistic updates.
- 42:15Michael Kennedy: So one of the things that's really common in JavaScript is I click this thing, it changes.
- 42:20Michael Kennedy: I want to mark it as changed.
- 42:21Michael Kennedy: And then I'm going to tell the server, hey, we made this change.
- 42:25Michael Kennedy: It's very possible the server died, that you're not allowed to make that change or whatever.
- 42:29Michael Kennedy: And then you've got to come back and go actually undo that.
- 42:30Michael Kennedy: That really, you know, there's like a weird.
- 42:33Michael Kennedy: So what you're saying is you don't have to worry about that kind of stuff.
- 42:35Delaney Gillilan: We're a framework, not just a library.
- 42:37Delaney Gillilan: The idea is that you have these indicators that not only basically your indicators drive a signal.
- 42:41Delaney Gillilan: Like, again, the details don't really matter.
- 42:43Delaney Gillilan: But the idea is that you have instantaneous,
- 42:46Delaney Gillilan: like within the same frame updates of,
- 42:48Delaney Gillilan: hey, I'm going off to do something.
- 42:50Delaney Gillilan: Like usually you make a spinner or you say,
- 42:52Delaney Gillilan: I'm going to do this to gray out the field
- 42:53Delaney Gillilan: or I'm going to do,
- 42:54Delaney Gillilan: like there's all kinds of things you can drive.
- 42:55Delaney Gillilan: Because again, the state of what the local stuff is
- 42:59Delaney Gillilan: while the change is there, that lives in the client.
- 43:02Delaney Gillilan: Like that is part of Datastar.
- 43:04Delaney Gillilan: It has all the right tools to make it
- 43:06Delaney Gillilan: so that you can disable it or gray it out
- 43:08Delaney Gillilan: or say, I'm going to put a spinner next to it.
- 43:10Delaney Gillilan: Like you can do all those things.
- 43:11Delaney Gillilan: But the thing is you're not lying to your user.
- 43:13Delaney Gillilan: That's my whole thing.
- 43:14Delaney Gillilan: And people say, well, that's not really a lie.
- 43:15Delaney Gillilan: It's like, yes, it is.
- 43:16Delaney Gillilan: You're literally lying to people.
- 43:18Delaney Gillilan: Like, please stop.
- 43:18Delaney Gillilan: It's a DX issue.
- 43:20Delaney Gillilan: The reason why people do it is because it's convenient, not because it's correct.
- 43:24Ben Crocker: And again, like you can do optimistic updates.
- 43:26Ben Crocker: You can do SPA-like things using Datastar.
- 43:29Ben Crocker: We don't recommend it because Datastar is more than just this tech.
- 43:34Ben Crocker: It's also like a way of doing things.
- 43:37Ben Crocker: What I wanted to point out here is that you might imagine that, you know, this is something that when you click edit,
- 43:43Ben Crocker: it turns it into a form.
- 43:44Ben Crocker: So you might like load the form into the page, hide the form,
- 43:47Ben Crocker: and then just do a show hide approach.
- 43:49Ben Crocker: But the hypermedia approach is kind of like the REST approach
- 43:53Ben Crocker: where you can only take the next action at any given time.
- 43:57Ben Crocker: So if you open the network tab,
- 43:58Ben Crocker: I just want to kind of walk you through this briefly.
- 44:00Ben Crocker: If you cancel that, when you hit edit,
- 44:02Ben Crocker: you will see a network request to the server.
- 44:04Ben Crocker: And what comes back is that form.
- 44:07Ben Crocker: So it's real time as in like what you're seeing now
- 44:10Ben Crocker: is the actual state reflected on the backend.
- 44:13Ben Crocker: And when you save, you're also going to see the same thing.
- 44:16Ben Crocker: You're going to see a network request to the server
- 44:18Ben Crocker: and it gets the true current state
- 44:22Ben Crocker: as it has been saved is now all comes back down.
- 44:24Ben Crocker: So it's like you don't even need optimistic updates
- 44:28Ben Crocker: most of the time.
- 44:28Ben Crocker: And when you do use it,
- 44:30Ben Crocker: it's because you're trying to cover up poor performance.
- 44:33Ben Crocker: You're favoring perceived performance
- 44:36Ben Crocker: over true performance.
- 44:37Chris May: One of the things I hear a lot is people saying,
- 44:39Chris May: but it's so much slower.
- 44:41Chris May: But I think people are used to
- 44:43Chris May: or think it's much slower than it is
- 44:45Chris May: because the web, the spa life
- 44:47Chris May: that we see around us feels so slow.
- 44:51Chris May: But anytime I've seen people try to lean
- 44:53Chris May: into just using the network,
- 44:55Chris May: it's so much faster than you expect.
- 44:57Delaney Gillilan: Well, and also you have so much less our way.
- 45:00Delaney Gillilan: Your usage of network can be easily 100x less,
- 45:03Delaney Gillilan: which means you have less contention,
- 45:04Delaney Gillilan: which means when you do send something,
- 45:06Delaney Gillilan: it's there immediately.
- 45:07Delaney Gillilan: And also because you're not doing polling
- 45:09Delaney Gillilan: with polling, you have to send to the server and the server sends back. If you just send from server
- 45:13Delaney Gillilan: when something updates, now you've just halved your RTT, right? Your round trip has just halved.
- 45:19Delaney Gillilan: So you half it and you're doing like a thousand less of something. All of a sudden, things opened
- 45:23Delaney Gillilan: up for you in weird ways, right? It's a fundamentally different way of thinking about the problem.
- 45:29Delaney Gillilan: Another example that we like to bring up a lot is there was a while back, someone did a million
- 45:33Delaney Gillilan: checkbox demo and they had a whole write-up on it, right? And they basically had to take it down
- 45:38Delaney Gillilan: because it was just too expensive to run.
- 45:39Delaney Gillilan: We have a version that's not just checkboxes,
- 45:41Delaney Gillilan: but color checkboxes.
- 45:43Delaney Gillilan: So you can actually make ASCII art and stuff like that.
- 45:45Delaney Gillilan: And it's a billion.
- 45:46Delaney Gillilan: And it runs on the same server
- 45:47Delaney Gillilan: that was running that Game of Life demo.
- 45:49Delaney Gillilan: It's on the same server.
- 45:50Delaney Gillilan: It's actively, and it's been on top of Hacker News.
- 45:52Ben Crocker: It's a $5 VPS as far as I know.
- 45:54Delaney Gillilan: Yeah, it's a $5 one.
- 45:56Delaney Gillilan: It runs all these demos all the time,
- 45:58Delaney Gillilan: active, top of Hacker News,
- 45:59Delaney Gillilan: and it's never gone down.
- 46:01Ben Crocker: What's really interesting about that demo
- 46:03Ben Crocker: is that it becomes a backend optimization challenge, right?
- 46:07Ben Crocker: You're no longer trying to optimize the front end.
- 46:09Ben Crocker: You rely on the browser and the browser API to take care of that for you.
- 46:14Ben Crocker: And now you're doing, I don't know, you're optimizing your database.
- 46:17Ben Crocker: You're optimizing your queries.
- 46:20Ben Crocker: I actually threw the link to that in there.
- 46:22Ben Crocker: Because it's a nice demo to look at when you realize there are a billion of these being stored in a SQLite database somewhere.
- 46:31Ben Crocker: So you can scroll anywhere on the board.
- 46:33Ben Crocker: And it's like a 30,000 by 30,000 something grid
- 46:37Ben Crocker: because the square root of a billion
- 46:39Ben Crocker: is some weird number, as it turns out.
- 46:42Ben Crocker: And obviously this is, or not obviously,
- 46:44Ben Crocker: but this is multiplayer.
- 46:45Ben Crocker: So if I was to view this
- 46:47Ben Crocker: or you were to open a different browser tab,
- 46:49Ben Crocker: then you would see the exact same thing.
- 46:51Ben Crocker: The board is the same everywhere.
- 46:52Ben Crocker: That is crazy.
- 46:54Delaney Gillilan: The one thing that I will say that's hard,
- 46:56Delaney Gillilan: I don't know, Chris can really probably speak to this more
- 46:58Delaney Gillilan: and it sounds like a weird thing,
- 47:00Delaney Gillilan: Like, Datastar ends up in reality being like five or six things on your page, and it just
- 47:05Delaney Gillilan: gets out of the way.
- 47:06Delaney Gillilan: All of a sudden, like, most Datastar, you're going to get to a point where you try it,
- 47:09Delaney Gillilan: and you're like, that's it?
- 47:10Delaney Gillilan: Like, you will feel weird about every other approach once you really try it.
- 47:14Delaney Gillilan: Like, just try it, and you will see every other approach is wrong.
- 47:18Delaney Gillilan: Like, it's not because I made it.
- 47:20Delaney Gillilan: Like, I wish someone would have made this because it just, it's so simple.
- 47:23Delaney Gillilan: It feels like cheating in a weird way.
- 47:26Delaney Gillilan: That's hard to explain.
- 47:27Delaney Gillilan: it really it's a weird like i don't know what we all were doing i was part of the problem like right
- 47:31Delaney Gillilan: like i was like oh well google and everyone facebook and all the other guys have this figured
- 47:36Delaney Gillilan: out like this has to be the best approach so that's the weird thing is it's so simple i don't know what
- 47:41Delaney Gillilan: like crystal probably it sounds like i'm selling it but it's just i don't know it's weird it's so
- 47:45Chris May: exciting it's so amazing and yet it's it's using all these boring technologies and like yeah like
- 47:50Chris May: i remember i showed my wife this my status board and she's like oh yeah that looks really cool and
- 47:55Chris May: I'm like, oh yeah, because you don't understand what everything is going on behind it, you know?
- 47:59Michael Kennedy: Yeah, exactly.
- 48:00Michael Kennedy: It's like, it used to be so complicated.
- 48:03Michael Kennedy: So let's do, we got a little bit of time left.
- 48:05Michael Kennedy: Let's do this.
- 48:06Michael Kennedy: I think it might be fun to talk through kind of some of the attributes and what it looks like,
- 48:13Michael Kennedy: kind of program with this a little bit and then what it looks like on the server.
- 48:15Michael Kennedy: How's that sound?
- 48:16Delaney Gillilan: Would it make sense?
- 48:17Delaney Gillilan: Like there's a good example of a kind of a meta framework for Python called Stario,
- 48:21Delaney Gillilan: which they just got their V2.
- 48:23Michael Kennedy: Okay.
- 48:23Delaney Gillilan: Just launched.
- 48:24Delaney Gillilan: I don't know if that is a more Python-esque way of doing it.
- 48:27Delaney Gillilan: It depends on how you want to.
- 48:28Michael Kennedy: Let's start with some of the Datastar attributes,
- 48:31Michael Kennedy: and then we could talk about that.
- 48:32Michael Kennedy: How's that sound?
- 48:33Michael Kennedy: Like, just, you know, what does it look like to say to,
- 48:36Michael Kennedy: you know, I want to connect a button to Datastar actions
- 48:41Michael Kennedy: on the back end or wired up and so on?
- 48:43Michael Kennedy: We've talked about a lot about, you know,
- 48:45Ben Crocker: the back end driving the front end through patching elements,
- 48:48Ben Crocker: which is kind of the lower half of what you're looking at.
- 48:51Ben Crocker: To access that, you need to have a click listener or some sort of event listener to trigger that.
- 48:58Ben Crocker: And datastar, as the name suggests, uses data-star or asterisk attributes.
- 49:05Ben Crocker: So these are part of the HTML spec data set.
- 49:09Ben Crocker: And we just leverage that.
- 49:10Ben Crocker: And we have a small grammar that you'd find on the reference page with all of the data-attributes.
- 49:19Ben Crocker: And data on is just registering an event listener on the current element.
- 49:23Ben Crocker: So data on colon click is just obviously registering a click event handler on the button.
- 49:30Ben Crocker: And what's happening is that then Datasar also gives you actions.
- 49:34Ben Crocker: So that at get is an action to send a get request to the server.
- 49:38Ben Crocker: You pass in the path, which is slash endpoint there.
- 49:42Ben Crocker: And then the server takes care of the rest.
- 49:44Ben Crocker: So what you're seeing is a div underneath with an ID.
- 49:48Ben Crocker: IDs are obviously unique in HTML, so they're ideal.
- 49:51Ben Crocker: And Datastar just uses that fact.
- 49:55Ben Crocker: And what Datastar is going to do from the backend is it's going to, yeah, just send back down that div with some text content inside of it.
- 50:03Ben Crocker: And then what Datastar does is it mutates the incoming DOM into the existing DOM.
- 50:10Ben Crocker: I'm sorry, it morphs.
- 50:11Ben Crocker: So it uses a morphing strategy.
- 50:14Ben Crocker: So rather than doing a straight swap, which is what HTMX does, it will actually morph the incoming HTML into what's currently on the page.
- 50:23Ben Crocker: That's kind of what opens up the door to these kind of broad, like where you send the entire document down, but only what changes get swapped in.
- 50:30Ben Crocker: But in this case, it's more of a fine grained thing.
- 50:34Ben Crocker: So only that div is going to get swapped out.
- 50:36Delaney Gillilan: And the reason why that morph matters is because you, since you aren't replacing it, things like
- 50:41Delaney Gillilan: focus and like where your input is and all that stays the same. So when you, even though you update
- 50:46Delaney Gillilan: the whole page, you're actually not actually changing the state and that's really important.
- 50:51Delaney Gillilan: So you do declarative development. You just say, I want it to look this way and it just does the
- 50:56Delaney Gillilan: right things to do it. It's from a mental ball. It's almost like having the BDOM in the backend.
- 51:00Delaney Gillilan: You just say, here's what I want this page to look like. And it does all the work, but we don't do
- 51:03Ben Crocker: BDOM. We don't do any of that stuff. We do the fast thing. So in terms of what your backend would
- 51:08Ben Crocker: send, if you can just scroll back up, it's that text that you were looking at. Let's look at the
- 51:14Ben Crocker: raw version because, yeah, so that's the HTML. If you scroll down to the next text, it's a code
- 51:19Michael Kennedy: field. Yeah. There's a section that has like event, data star, patch elements, and then what the
- 51:24Michael Kennedy: elements are and so on, right? This is like the SSE stream. Yeah. And that would be the raw events
- 51:29Ben Crocker: that you would send down.
- 51:31Ben Crocker: But if you look at the next one
- 51:33Ben Crocker: where we have a Python example,
- 51:35Ben Crocker: you would see like,
- 51:36Ben Crocker: well, how do you do that in Python
- 51:38Ben Crocker: without actually writing,
- 51:39Ben Crocker: you know, the raw format out?
- 51:41Ben Crocker: And that's how you would do it there
- 51:43Ben Crocker: using the Python SDK.
- 51:44Ben Crocker: Let's dive in a little bit
- 51:45Michael Kennedy: to the SDK itself.
- 51:48Michael Kennedy: So I got so many things open.
- 51:51Michael Kennedy: Hold on.
- 51:52Michael Kennedy: We got another link for you.
- 51:53Michael Kennedy: No, I'm kidding.
- 51:54Michael Kennedy: You know what?
- 51:55Michael Kennedy: I'm just going to go.
- 51:55Michael Kennedy: I'm going from the homepage.
- 51:56Michael Kennedy: There we go.
- 51:57Michael Kennedy: There you go.
- 51:57Michael Kennedy: Chris, maybe you could talk us through this.
- 51:59Michael Kennedy: I think before I throw it to you, though, yeah, there's a lot of framework support here.
- 52:03Michael Kennedy: So if you're a Django person, a FastAPI person, even fast HTML, it's interesting,
- 52:08Michael Kennedy: Litestar, Quartz, Sanic, or Starlette.
- 52:10Michael Kennedy: There's a bunch of different ones here, but maybe just talk us through this, if you'll, Chris.
- 52:16Chris May: I'm trying to remember.
- 52:16Chris May: I'm not as familiar with the example, but as you can see,
- 52:20Chris May: this one method is, I think, where the magic happens.
- 52:22Chris May: I'm trying to remember which tool.
- 52:24Chris May: This is a Quart.
- 52:25Chris May: Yeah, the Quart is the examples in Quart.
- 52:27Chris May: So, you know, they first define a route, a home route slash, and it returns HTML and it's just in the string there.
- 52:34Chris May: Right. And then that.
- 52:35Chris May: This could be a Jinja or Chameleon or whatever template.
- 52:38Chris May: Like it's just whatever. It doesn't matter.
- 52:39Chris May: But somehow they get it. Yeah.
- 52:40Chris May: Makes the example easier to see in one go.
- 52:42Chris May: And obviously you see that it's pulling Datastar from the CDN and then it on the load, it gets it sends a request to the slash updates endpoint.
- 52:54Chris May: See what comes from that.
- 52:56Chris May: And so down below that, you have the slash updates endpoint, which has a decorator called data, data star underscore response.
- 53:03Chris May: And that just does a couple of nice things like sets the HTTP headers and whatnot to be the service and event protocol.
- 53:10Chris May: And then what I like to the first line says signals equals await read signals.
- 53:16Chris May: And so that's another helper that essentially says when I have a request coming in,
- 53:21Chris May: data star has a specific way of sending the state of the front end to the back end.
- 53:25Chris May: So the back end can do whatever it needs.
- 53:26Michael Kennedy: Right. We haven't even talked about signals yet. They're like kind of a data binding set of JavaScript data that loads, you know, reactive data loads on the front end, right?
- 53:35Chris May: In some ways, the Alpine JS kind of,
- 53:38Chris May: I don't want to say equivalent,
- 53:39Chris May: but it covers similar functionality.
- 53:41Chris May: And so if you have data on the front end
- 53:44Chris May: that the backend would like to know,
- 53:45Chris May: that's an easy way to get it.
- 53:47Chris May: And then essentially what happens
- 53:49Chris May: is we get into this loop, this while true loop,
- 53:51Chris May: and Datastar will just start sending down
- 53:53Chris May: server sent events in text
- 53:56Chris May: by using the sse.patchElements function,
- 53:59Chris May: or I guess it's a method technically.
- 54:01Chris May: And all it's doing is sending a string
- 54:03Chris May: that has the current date time dot now in ISO format down.
- 54:07Chris May: And then we wait, we sleep for a second,
- 54:10Chris May: or is it a second?
- 54:11Chris May: I guess it's a microsecond.
- 54:12Chris May: I keep forgetting which one.
- 54:13Chris May: Yeah, that's a millisecond.
- 54:14Michael Kennedy: No, no, it's second.
- 54:15Michael Kennedy: And sleep is seconds.
- 54:16Michael Kennedy: Sleep is seconds.
- 54:17Michael Kennedy: It takes a float.
- 54:18Chris May: So once it sleeps, it sends another server sign event.
- 54:21Chris May: With this time, it's instead of sending the HTML down,
- 54:24Chris May: we're sending a signal.
- 54:27Chris May: So essentially changing, say, you can say,
- 54:28Chris May: like the JavaScript value or script data
- 54:31Chris May: onto the front of the page.
- 54:32Michael Kennedy: Right, right.
- 54:33Michael Kennedy: So it's showing that you can send the HTML and let Datastar patch it, or you can basically
- 54:38Michael Kennedy: from the server set one of these signal things that will be reactive on the front end, right?
- 54:43Ben Crocker: Yeah.
- 54:43Ben Crocker: You said it much better than I did.
- 54:45Ben Crocker: Thanks.
- 54:45Ben Crocker: It's a long way of saying it's a clock, right?
- 54:48Ben Crocker: Yeah.
- 54:48Delaney Gillilan: Also the thing, just for people that aren't used to thinking about this way, especially
- 54:51Delaney Gillilan: if you're doing Python, like all a signal is, is instead of saying that here's, I'm
- 54:56Delaney Gillilan: setting a variable, you're saying I'm setting a relationship that says like, kind of like
- 55:00Delaney Gillilan: in an Excel document when you set a formula for a cell,
- 55:04Delaney Gillilan: it's the same idea.
- 55:04Delaney Gillilan: You're setting up a relationship saying,
- 55:05Delaney Gillilan: when this thing and this thing changes, update this.
- 55:08Delaney Gillilan: And it does smart things to do that efficiently.
- 55:10Delaney Gillilan: But the idea is it's a relationship.
- 55:12Delaney Gillilan: It's declarative.
- 55:13Delaney Gillilan: So kind of like with SQL,
- 55:15Delaney Gillilan: you think of SQL as a declarative language, right?
- 55:17Delaney Gillilan: You don't care how it creates an index.
- 55:19Delaney Gillilan: You just say, create index.
- 55:20Delaney Gillilan: Same thing happens here.
- 55:21Delaney Gillilan: You just say, hey, I want when this thing changes,
- 55:24Delaney Gillilan: this other thing to change.
- 55:25Delaney Gillilan: And the problem is that declarativeness
- 55:27Delaney Gillilan: is not built into JavaScript.
- 55:28Delaney Gillilan: It's not built into the browser,
- 55:29Delaney Gillilan: but we just made the web a little bit more declarative.
- 55:32Delaney Gillilan: That's all we did, basically.
- 55:33Michael Kennedy: Right.
- 55:34Michael Kennedy: Declarative is generally pretty good.
- 55:36Michael Kennedy: It's a good way to work.
- 55:37Michael Kennedy: It keeps things simple
- 55:38Michael Kennedy: and lets the underlying system have at it.
- 55:40Michael Kennedy: So a couple of things,
- 55:42Michael Kennedy: well, we still got a little bit of time,
- 55:44Michael Kennedy: but to wrap things up a little bit.
- 55:46Michael Kennedy: Editors.
- 55:47Michael Kennedy: I think having good editor support
- 55:49Michael Kennedy: is really important for adoption.
- 55:52Michael Kennedy: You know, drives me crazy
- 55:53Michael Kennedy: when I go and try to work with JavaScript, CSS,
- 55:56Michael Kennedy: attributes or whatever,
- 55:57Michael Kennedy: and I'm like, they're not here.
- 55:59Michael Kennedy: No help.
- 56:00Michael Kennedy: So you all have nice extensions and plugins for common editors Python people might use, right?
- 56:06Ben Crocker: Yeah, we have VS Code, which you're seeing here, and PHP Storm.
- 56:12Ben Crocker: Or sorry, I use PHP Storm, but all JetBrains editors.
- 56:16Ben Crocker: PHP Storm, PyCharm, WebStorm, all of them things.
- 56:19Ben Crocker: So it's in the JetBrains marketplace, so it'll work for, I believe, all JetBrains IDEs.
- 56:25Ben Crocker: I believe so.
- 56:25Michael Kennedy: You also have the AI editors covered.
- 56:28Michael Kennedy: Do we?
- 56:29Michael Kennedy: In the OpenVSX registry, all the ones that have been kicked out from VS Code, this is where they all have to go to get their installs, right?
- 56:37Michael Kennedy: That explains why people requested this from me.
- 56:41Michael Kennedy: Yeah, if you're doing cursor, Antigravity, windsurf, like all those things, they were all kicked out of the VS Code registry.
- 56:50Michael Kennedy: That's not a complaint.
- 56:51Michael Kennedy: I mean, it's a Microsoft product.
- 56:53Michael Kennedy: They built it.
- 56:54Michael Kennedy: They don't have to build all the other ones.
- 56:56Michael Kennedy: But that's why they're here, right?
- 56:57Ben Crocker: We keep those up to date.
- 56:58Ben Crocker: We do those ourselves, the SDKs.
- 57:01Ben Crocker: I mean, Delaney wrote the Go one, I wrote the PHP one,
- 57:04Ben Crocker: and the rest are just community contributions.
- 57:07Ben Crocker: We've had contributions to these too, to the IDE extensions.
- 57:11Ben Crocker: We maintain these primarily.
- 57:13Ben Crocker: Yeah, and these are great.
- 57:14Ben Crocker: These just, you know, save on typing, but more importantly, save on making typos.
- 57:20Ben Crocker: You know, they show you all of the available data attributes.
- 57:23Delaney Gillilan: Maybe Chris can speak more to is that the irony is, though,
- 57:26Delaney Gillilan: you won't need that many tags to actually do your work.
- 57:29Delaney Gillilan: So it's not like a tailwind thing where you're like,
- 57:31Delaney Gillilan: oh, I rely on it to autocomplete.
- 57:33Delaney Gillilan: It's just...
- 57:33Chris May: Yeah, absolutely.
- 57:34Chris May: In fact, it's one of those things
- 57:35Chris May: where I discover more things I can do with Datastar
- 57:38Chris May: because as I'm typing data dash and I'm like,
- 57:40Chris May: oh, I didn't actually remember
- 57:42Chris May: that there's a attribute to do whatever it is.
- 57:45Chris May: I don't remember.
- 57:46Chris May: Like, I can't remember at this point.
- 57:48Chris May: And then I went to the documentation like,
- 57:49Chris May: oh, check this out.
- 57:50Chris May: This is so much more I can do.
- 57:52Chris May: But yeah, I find I love the plugin,
- 57:54Chris May: but I find I don't use it too much
- 57:55Chris May: just because I'm not writing as much HTML with it.
- 57:58Michael Kennedy: While I'm sitting here on this open VSX registry,
- 58:02Michael Kennedy: do you all have advice for making Datastar work well
- 58:05Michael Kennedy: with agentic AI and Claude Code, Cursor, et cetera?
- 58:08Delaney Gillilan: There's some active research going on
- 58:10Delaney Gillilan: like in Oslo at a college
- 58:13Delaney Gillilan: that's doing, ironically, using Datastar
- 58:16Delaney Gillilan: to do some stuff around like how LLMs work with code bases.
- 58:22Delaney Gillilan: And the reason why is because the entire code base
- 58:24Delaney Gillilan: fits in basically every context, even the nano ones, like the entire code base fits there.
- 58:28Delaney Gillilan: And what they found, we've gone back and forth a bit, is that almost all of them are completely
- 58:33Delaney Gillilan: overfitted. So if you just want to make a website with agentic stuff, go do React,
- 58:38Delaney Gillilan: because that's what it's built for. And it's overfitted to such a degree that if you try to
- 58:43Delaney Gillilan: use the spec correctly and to say, here's all the sorts of data star, go use it to build websites,
- 58:49Delaney Gillilan: it will fall over almost in every regard.
- 58:51Delaney Gillilan: So it's one of those things where you don't need that much,
- 58:54Delaney Gillilan: but it will ironically show you how bad things like Claude and Codex and stuff
- 58:59Delaney Gillilan: are at just using the current context to solve things.
- 59:03Delaney Gillilan: Hopefully that gets better, but we have something around,
- 59:05Delaney Gillilan: like we have a slash docs page that you can feed into your LLM,
- 59:08Delaney Gillilan: but I'll say that we do not focus on that at all
- 59:11Delaney Gillilan: because you're basically fighting against what the training already happened.
- 59:15Delaney Gillilan: So you're better off, like if you want to use,
- 59:18Delaney Gillilan: if you want to make better size,
- 59:19Delaney Gillilan: you want to be fast and efficient
- 59:20Delaney Gillilan: and all that stuff,
- 59:21Delaney Gillilan: we're 100% the right thing to do.
- 59:22Delaney Gillilan: If you just want to like one shot something,
- 59:24Delaney Gillilan: go use React and stay in that world.
- 59:26Michael Kennedy: You want to vibe code it?
- 59:28Michael Kennedy: Hey, I've got something.
- 59:29Michael Kennedy: I feel like this might resonate with you, Delaney,
- 59:32Michael Kennedy: especially the way you just described it.
- 59:34Michael Kennedy: Have you all seen the Kai Lintit Senior Engineer
- 59:37Michael Kennedy: Tries Vibe Coding?
- 59:39Michael Kennedy: This is an amazing video.
- 59:41Michael Kennedy: And like half of the video is like,
- 59:43Michael Kennedy: no, no, no, not in being installed.
- 59:46Michael Kennedy: What are you doing?
- 59:47Michael Kennedy: It reminds me very much of like, it's just like, nope, that's not what I told you to do.
- 59:52Michael Kennedy: I know that's what you think the most common thing is, please stop.
- 59:54Delaney Gillilan: Yeah.
- 59:55Delaney Gillilan: And the thing is that it's not that I actually like a lot of the stuff, but I treat it as
- 59:58Delaney Gillilan: an autocomplete or like it can write code faster than I can when it comes to like, hey, change
- 1:00:03Delaney Gillilan: this in 27 different places.
- 1:00:05Delaney Gillilan: And I forget which files I did it like.
- 1:00:06Delaney Gillilan: There's value to it, but people are trying to use it to learn.
- 1:00:10Delaney Gillilan: It's a complete, it actively is working against you.
- 1:00:13Delaney Gillilan: Ben has done an amazing job with the guide.
- 1:00:15Delaney Gillilan: Like, please, like, it's fine to use the LLMs to help, like, guide your process and to, like,
- 1:00:20Delaney Gillilan: knock stuff out quickly once you have a baseline.
- 1:00:22Delaney Gillilan: But you have to know when to say no.
- 1:00:24Delaney Gillilan: And he has done it.
- 1:00:25Delaney Gillilan: The guide takes half an hour, less than a half, like, probably 15, 20 minutes to read
- 1:00:29Delaney Gillilan: and then, like, an hour to actually work through.
- 1:00:32Delaney Gillilan: Please try it first before you try to throw it at the LLMs.
- 1:00:35Delaney Gillilan: It's not because I hate them.
- 1:00:37Delaney Gillilan: It's more that they are just overfit to the, like, the sea of badly written SPA code.
- 1:00:42Delaney Gillilan: That's, unfortunately, that's the situation we're in.
- 1:00:45Michael Kennedy: Yeah, especially with JavaScript, the agentic AI is very trained.
- 1:00:49Michael Kennedy: It wants what it wants.
- 1:00:51Michael Kennedy: All right.
- 1:00:52Michael Kennedy: Let's talk, speaking of being near the guy,
- 1:00:55Michael Kennedy: if I go over here to more, there's a pro section.
- 1:00:59Michael Kennedy: I'll let you all give a shout out to pro.
- 1:01:02Michael Kennedy: I know you have a really strong sales pitch here.
- 1:01:04Michael Kennedy: You were talking about earlier.
- 1:01:06Michael Kennedy: Now, what is this data, Datastar Pro?
- 1:01:08Ben Crocker: It's been about a year since we released the beta one of Datastar.
- 1:01:14Ben Crocker: We are taking our sweet ass time for a very good reason, which is that we want version one to be the last version or like the last major version.
- 1:01:23Ben Crocker: We don't really want to force people through breaking changes and major updates because that's really just a pain.
- 1:01:30Ben Crocker: And I think like Python has done a great job with that and Go as well.
- 1:01:36Ben Crocker: And like there are some ecosystems where you just don't make breaking changes.
- 1:01:39Ben Crocker: That's the norm. And that's what we want to be.
- 1:01:41Ben Crocker: And the JavaScript ecosystem is, you know, the antithesis to that.
- 1:01:45Michael Kennedy: They're like, here, hold my beer.
- 1:01:47Michael Kennedy: I'll show you breaking changes.
- 1:01:48Michael Kennedy: Yeah.
- 1:01:48Michael Kennedy: Have you heard of LeftPad?
- 1:01:49Delaney Gillilan: To give you an idea of how far we take that, we don't have npm.
- 1:01:53Delaney Gillilan: Like we don't actually even submit to npm.
- 1:01:55Delaney Gillilan: We have no package.json in our JavaScript framework.
- 1:01:59Delaney Gillilan: We actually, like, there's none of that stuff.
- 1:02:02Delaney Gillilan: It does not exist in our ecosystem.
- 1:02:03Delaney Gillilan: So we take it very seriously when we say it's funny to have a JavaScript framework that
- 1:02:07Delaney Gillilan: actively hates the JavaScript ecosystem.
- 1:02:09Michael Kennedy: And you guys, I think also it's worth pointing out
- 1:02:11Michael Kennedy: that you don't have a strong build step,
- 1:02:14Michael Kennedy: tree shaking, web packing story, right?
- 1:02:17Michael Kennedy: You just dropped-
- 1:02:17Delaney Gillilan: No, we do.
- 1:02:18Delaney Gillilan: The thing is that, like for example,
- 1:02:21Delaney Gillilan: Vite is kind of the well-known way to do this stuff.
- 1:02:25Delaney Gillilan: But guess what?
- 1:02:25Delaney Gillilan: Under the hood, it uses esbuild.
- 1:02:27Delaney Gillilan: And esbuild is a go thing.
- 1:02:29Delaney Gillilan: We build a lot of our stuff in go.
- 1:02:30Delaney Gillilan: So it's literally embedded in our,
- 1:02:32Delaney Gillilan: like we just use the esbuild directly.
- 1:02:33Delaney Gillilan: We don't need 20,000 things from npm.
- 1:02:36Delaney Gillilan: We just use the go tools inside of our binary
- 1:02:38Delaney Gillilan: because that's the fast thing to do.
- 1:02:40Delaney Gillilan: So we don't need all of that.
- 1:02:41Delaney Gillilan: So we have no dependencies, nothing,
- 1:02:43Delaney Gillilan: and we don't even use npm or any of that at all.
- 1:02:46Ben Crocker: Yeah, so the reason I mentioned the beta
- 1:02:48Ben Crocker: is during the beta phase, which lasted about six months,
- 1:02:51Ben Crocker: we, Datastar gained a lot of traction,
- 1:02:54Ben Crocker: a lot of interest, and people had a lot of requests.
- 1:02:56Ben Crocker: And we were like, yeah, we see,
- 1:02:58Ben Crocker: and because it's plugin-based,
- 1:03:00Ben Crocker: you can always just add another plugin.
- 1:03:01Ben Crocker: You can add it yourself,
- 1:03:03Ben Crocker: or we can build a plugin and add it to Datastar.
- 1:03:05Ben Crocker: But we were very adamant about keeping the open source Datastar framework as tight as possible.
- 1:03:15Ben Crocker: Like I said, it should do everything you need, but nothing you don't.
- 1:03:18Ben Crocker: So how do we do that while adding plugins?
- 1:03:21Ben Crocker: So during that beta phase, we started thinking about, well, do we have multiple versions of Datastar?
- 1:03:26Ben Crocker: Do we have a marketplace of plugins?
- 1:03:28Ben Crocker: Or how do we manage that?
- 1:03:30Ben Crocker: And at the same time, we were also asking ourselves, because Delaney and I both, we have full-time things that we're doing.
- 1:03:35Ben Crocker: And this is a side project, but we're almost doing it full time alongside our other full time things. So how do we make this project sustainable? Because it doesn't stop at Datastar. You probably see Rocket and Stellar CSS on that page in the navigation sidebar. Those are like projects that build on top of Datastar. So Datastar is just the foundation. And Rocket kind of takes it to web components and Stellar CSS is a CSS framework that builds on top of these concepts.
- 1:04:05Ben Crocker: So we're trying to fix not only JavaScript web components, but also CSS.
- 1:04:10Ben Crocker: So we have a long-term vision.
- 1:04:12Ben Crocker: How do we make that sustainable when we're both busy people anyway, and this just takes
- 1:04:18Ben Crocker: so much of our time and the project appears to be growing?
- 1:04:22Ben Crocker: So at that point, we decided, well, how do we want to even run this?
- 1:04:25Ben Crocker: So we decided we don't want to found some company and do VC like we're, if anything,
- 1:04:31Ben Crocker: anti-VC funding.
- 1:04:32Ben Crocker: So we founded a nonprofit organization in the U.S. called Star Federation, and that's what backs this project, including Rocket and Stellar CSS.
- 1:04:44Ben Crocker: To help fund that organization, we decided let's have Datastar be the open source framework, but then something called Datastar Pro, which is like all those plugins that we think are good ideas, but that most people don't need.
- 1:04:58Ben Crocker: We'll put those into Datastar Pro, and that can kind of grow over time.
- 1:05:01Ben Crocker: It's a collection of plugins that you might want if you're using Datastar in a professional setting.
- 1:05:07Ben Crocker: But, you know, if you're just using Datastar, you don't actually need it.
- 1:05:11Ben Crocker: And so that's what we tell people.
- 1:05:12Ben Crocker: Most people don't need it.
- 1:05:13Ben Crocker: It's a collection of plugins and it's a Datastar inspector, which sits on your page.
- 1:05:19Ben Crocker: You get access to the bundler and now you get access to Rocket and Stellar CSS, which is a work in progress.
- 1:05:26Ben Crocker: Yeah, that was, I think, a good decision.
- 1:05:28Ben Crocker: Like there was definitely some uproar initially that, you know, some plugins were taken away, but those plugins were never taken away.
- 1:05:35Ben Crocker: They still exist in the repo if anybody needs them.
- 1:05:38Ben Crocker: What the result is, is that we have like some money coming into a bank account, which is not even used to pay maintainers.
- 1:05:46Ben Crocker: We use that for running costs and like for, you know, podcasting software.
- 1:05:53Ben Crocker: And if we need to travel to conferences, which we've yet to do.
- 1:05:56Ben Crocker: But essentially, it's like a way of having some money into the bank so that we can justify all of the work that we do in maintaining Datastar and pushing that forward.
- 1:06:06Michael Kennedy: But the V1 thing.
- 1:06:07Michael Kennedy: 100% free sounds great until that means it becomes abandoned where, you know, and like people can't work on it anymore.
- 1:06:14Michael Kennedy: And I think it's fair.
- 1:06:16Delaney Gillilan: There's one thing that's kind of interesting about the model, because especially with the tailwind stuff that's been going on lately.
- 1:06:21Delaney Gillilan: One of the things that we talked about, and people get very angry about this, but for example,
- 1:06:26Delaney Gillilan: Rocket is a web component layer that you basically just write Datastar in a declarative way,
- 1:06:31Delaney Gillilan: and it dynamically generates web components for you on the fly.
- 1:06:34Delaney Gillilan: And it's a great way to build web components.
- 1:06:36Delaney Gillilan: It'll save you tons of hours.
- 1:06:38Delaney Gillilan: And people won't pay for features.
- 1:06:39Delaney Gillilan: They pay for convenience.
- 1:06:40Delaney Gillilan: So the thing is, people said, well, I want you to generate out the content and make that
- 1:06:46Delaney Gillilan: open and available.
- 1:06:46Delaney Gillilan: And we said no, because basically the way we look at it is that almost like PICO-8,
- 1:06:51Delaney Gillilan: or any kind of game engine, you pay for the game
- 1:06:54Delaney Gillilan: and then all the mods are free.
- 1:06:55Delaney Gillilan: So all the rocket components and all this stuff
- 1:06:58Delaney Gillilan: is gonna be free, but the core engine is not free.
- 1:07:01Delaney Gillilan: It's a paid thing.
- 1:07:02Delaney Gillilan: And the reason why is if it becomes successful,
- 1:07:04Delaney Gillilan: if we do our job and we make it so it's easy for everybody,
- 1:07:07Delaney Gillilan: the Star Federation will do better over time.
- 1:07:10Delaney Gillilan: Whereas Tailwind's model of they're competing
- 1:07:12Delaney Gillilan: against every other person in that space,
- 1:07:15Delaney Gillilan: whereas it just does not work.
- 1:07:16Delaney Gillilan: So our thing is if we do get successful
- 1:07:18Delaney Gillilan: and we do get more people,
- 1:07:20Delaney Gillilan: then it's self-sustaining as in you paid for this little engine
- 1:07:24Delaney Gillilan: and now you get all the ecosystem around it of open source.
- 1:07:27Delaney Gillilan: So you can do open source in a way,
- 1:07:29Delaney Gillilan: but you have to find a core engine that is not open source.
- 1:07:32Delaney Gillilan: Otherwise it will fail in the modern world.
- 1:07:34Michael Kennedy: Let's close this thing out with two super quick things
- 1:07:37Michael Kennedy: because I know we're over time.
- 1:07:38Michael Kennedy: Roadmap.
- 1:07:39Michael Kennedy: Ben, you talked about taking your sweet time to 1.0.
- 1:07:42Michael Kennedy: Is there a forward-looking roadmap?
- 1:07:44Michael Kennedy: Are you guys done or what are things?
- 1:07:46Ben Crocker: The release counted RC1, I think it was about six months ago.
- 1:07:51Ben Crocker: and like the release has just been slowing down, slowing down.
- 1:07:54Ben Crocker: So that stagnation in like just releases with fixes
- 1:07:57Ben Crocker: is a good sign to me that we're very, very close.
- 1:08:00Ben Crocker: At this point, like the switch from release candidate to stable
- 1:08:05Ben Crocker: is just literally like just, you know, dropping the RC.
- 1:08:09Ben Crocker: There's no like features that are going into it.
- 1:08:11Ben Crocker: There's no big changes.
- 1:08:13Ben Crocker: We're taking our time because like I said,
- 1:08:15Ben Crocker: it's easy to put something up slightly prematurely
- 1:08:18Ben Crocker: and get some defaults wrong.
- 1:08:20Ben Crocker: I mean, that's what happened with HTMX 2 was just like fixing some defaults that they decided they got wrong in version one.
- 1:08:27Ben Crocker: So we're trying to avoid a situation like that.
- 1:08:30Ben Crocker: And the only way to do that is to just let it simmer, let people use it, let people dog food it.
- 1:08:35Ben Crocker: And us, too, we're actively using for many projects using data ourselves and discovering every now and then, oh, this default is probably we're trying to avoid foot guns.
- 1:08:46Ben Crocker: So we're trying to make it so that the defaults give you the best possible experience that you need zero configuration, ideally, but you can configure as needed.
- 1:08:55Ben Crocker: But getting those defaults right is really the only thing stopping us from, not right, but locked down is the only thing stopping us from a V1 stable.
- 1:09:05Ben Crocker: I don't like to give timelines.
- 1:09:07Ben Crocker: In fact, it's one of our things that I tell Delaney, never promise a timeline.
- 1:09:12Ben Crocker: But I could see us in the first half of this year,
- 1:09:16Ben Crocker: just flipping the switch.
- 1:09:18Michael Kennedy: But it sounds like you might be able to use the RC
- 1:09:20Michael Kennedy: and you might more or less be safe, yeah.
- 1:09:22Delaney Gillilan: In fact, we recommend people rename the RC
- 1:09:25Delaney Gillilan: and they change the name to React-Foo
- 1:09:28Delaney Gillilan: so that they just drop it in their React projects
- 1:09:30Delaney Gillilan: because the entire framework is smaller than most components.
- 1:09:34Delaney Gillilan: Just start hiding it places.
- 1:09:36Delaney Gillilan: Yeah, don't even name it Datastar.
- 1:09:38Michael Kennedy: A stealth takeover of the spa world.
- 1:09:41Michael Kennedy: Awesome. I love it.
- 1:09:42Michael Kennedy: All right, let's wrap up the show with a final call to action
- 1:09:46Michael Kennedy: for people who want to use Datastar, learn more, get started.
- 1:09:50Michael Kennedy: Chris, I'll let you go first so Ben and Delaney can have the final word.
- 1:09:54Chris May: The first thing I was thinking of is because I get asked so much about
- 1:09:59Chris May: how long it takes to connect to the server and things like that,
- 1:10:03Chris May: there is a portion in the DjangoCon talk I gave in, I think it was 2023,
- 1:10:08Chris May: where I showed a video of five phones, five Android phones, trying to do the same thing,
- 1:10:14Chris May: shopping for eggs, I believe it was. And essentially one of them is an HTML driven
- 1:10:20Chris May: multi-page app and it smokes the single page applications, the native apps and everything.
- 1:10:25Chris May: And so I put a link in our chat. Maybe you'll be a part of the show notes. It's a deep link to go
- 1:10:30Chris May: straight to that portion of the talk because it is like that video reminded me like, this is what
- 1:10:36Chris May: I want to build. I want to build websites that are fun for people to use. And, you know, Datastar
- 1:10:43Chris May: enables me to use real-time interactions with way less complexity than I ever thought
- 1:10:50Chris May: possible. So I guess the two things I would say is, one, check out the deep link if you're at all
- 1:10:55Chris May: interested. And number two, definitely try out something, you know, just even clone the Python
- 1:11:00Chris May: repo and just try some of the examples and see what it's like. Yeah, I'll definitely link to that.
- 1:11:05Chris May: Cool. Thanks, Ben.
- 1:11:06Ben Crocker: I also gave a conference talk last year.
- 1:11:08Ben Crocker: There's a recording, so I'll send you the link to that,
- 1:11:10Ben Crocker: which really walks through my journey of Datastar
- 1:11:13Ben Crocker: and how Datastar has truly opened my eyes to what's possible.
- 1:11:18Ben Crocker: I feel like I talk a lot about how Datastar is a journey of unlearning
- 1:11:23Ben Crocker: old and bad patterns, deeply rooted ones in what I think web development is.
- 1:11:29Ben Crocker: And these days, as I mentioned,
- 1:11:32Ben Crocker: I never would have thought that I'd be developing in Go,
- 1:11:35Ben Crocker: but I see like all like the,
- 1:11:37Ben Crocker: like I think even Python
- 1:11:39Ben Crocker: is getting better concurrency support, right?
- 1:11:41Ben Crocker: So I think you talked about that recently, Michael, here.
- 1:11:44Ben Crocker: So now I'm seeing with Datastar,
- 1:11:47Ben Crocker: I can do so much more on the backend.
- 1:11:49Ben Crocker: I can be so much more creative on the backend
- 1:11:51Ben Crocker: and that's what interests me.
- 1:11:53Ben Crocker: So it's just fun.
- 1:11:55Ben Crocker: What can I say?
- 1:11:56Ben Crocker: It's fun.
- 1:11:57Chris May: I'm still really jealous of that presentation too.
- 1:11:59Chris May: Well done with it.
- 1:12:00Michael Kennedy: Yeah, certainly send me the link.
- 1:12:01Michael Kennedy: I'll put it in the show notes and well done.
- 1:12:03Michael Kennedy: Delaney.
- 1:12:04Delaney Gillilan: The irony is that like, I don't consider myself a web dev at all.
- 1:12:07Delaney Gillilan: It just happens to be something I do a little bit of.
- 1:12:09Delaney Gillilan: The thing that is the, when I first started making this public, I was like, Hey, I think
- 1:12:14Delaney Gillilan: I'm onto something like someone proved me wrong.
- 1:12:16Delaney Gillilan: I was, I'm a little bit more like kind of, I always say like in the jujitsu world type
- 1:12:21Delaney Gillilan: stuff, like you want someone to roll with you, not because you're trying to up them.
- 1:12:24Delaney Gillilan: It's that like, they're trying to help you find weaknesses in your game.
- 1:12:27Delaney Gillilan: Right.
- 1:12:27Delaney Gillilan: So I want there to be an active, like someone proved me wrong.
- 1:12:31Delaney Gillilan: And I'm at the point now where I feel so confident.
- 1:12:34Delaney Gillilan: I will put money on it.
- 1:12:35Delaney Gillilan: I've tried going out to people out in the dev Twitter and all that.
- 1:12:38Delaney Gillilan: I guarantee you, and I'm happy to put money up on this,
- 1:12:41Delaney Gillilan: if you could do it the Datastar way,
- 1:12:43Delaney Gillilan: whether you're using React or HTMX or any other approach,
- 1:12:46Delaney Gillilan: it will be less code.
- 1:12:47Delaney Gillilan: It'll be faster.
- 1:12:48Delaney Gillilan: It'll be cheaper.
- 1:12:49Delaney Gillilan: And it'll be simpler to understand.
- 1:12:52Delaney Gillilan: I will take up anybody anywhere on that thing.
- 1:12:55Delaney Gillilan: Basically, it's not a boast.
- 1:12:56Delaney Gillilan: It's just the facts on the table.
- 1:12:59Delaney Gillilan: And it's a paradigm shift that I want the world to know about
- 1:13:02Delaney Gillilan: just so that people understand,
- 1:13:04Delaney Gillilan: hey, there's going to be someone
- 1:13:05Delaney Gillilan: that comes up with something better than I did, right?
- 1:13:06Delaney Gillilan: Like I'm standing,
- 1:13:07Delaney Gillilan: the reason why we have the fastest signal library in the world
- 1:13:10Delaney Gillilan: is because we listen to the people
- 1:13:11Delaney Gillilan: that are really good at that.
- 1:13:12Delaney Gillilan: We use alien signals.
- 1:13:13Delaney Gillilan: The reason why we have the fastest morphing library
- 1:13:15Delaney Gillilan: is that we listen to people and said,
- 1:13:16Delaney Gillilan: hey, there's people that care about this stuff
- 1:13:18Delaney Gillilan: and are working towards it.
- 1:13:20Delaney Gillilan: It's not that there's anything special here.
- 1:13:22Delaney Gillilan: It's that it's trying to build an ecosystem
- 1:13:24Delaney Gillilan: of like people that care about performance
- 1:13:25Delaney Gillilan: and people care about the details.
- 1:13:27Delaney Gillilan: And if you do that,
- 1:13:28Delaney Gillilan: then everything gets better.
- 1:13:30Delaney Gillilan: So it's not just where are we at now,
- 1:13:32Delaney Gillilan: but if anyone thinks they can do better,
- 1:13:34Delaney Gillilan: please join us.
- 1:13:34Delaney Gillilan: We want to hear it.
- 1:13:35Delaney Gillilan: But like, I'm done having the vibe code,
- 1:13:38Delaney Gillilan: or not the vibe code,
- 1:13:39Delaney Gillilan: but like the vibes around like,
- 1:13:41Delaney Gillilan: well, this doesn't feel like a spa
- 1:13:42Delaney Gillilan: or like a spa has its place.
- 1:13:44Delaney Gillilan: A couple of episodes ago,
- 1:13:45Delaney Gillilan: there was a Cody from the Litestar stuff said,
- 1:13:48Delaney Gillilan: there's a time and place for HTMX or Datastar.
- 1:13:50Delaney Gillilan: And he's just, that's just not true.
- 1:13:52Delaney Gillilan: It's just like hypermedia is the way to build things
- 1:13:55Delaney Gillilan: for a hypermedia client, which is the browser.
- 1:13:57Delaney Gillilan: So I will, anyone that can show that it's wrong,
- 1:14:01Delaney Gillilan: please let us know.
- 1:14:01Delaney Gillilan: Like we're here to help.
- 1:14:02Michael Kennedy: I would love to see this paired with some Electron JS apps
- 1:14:06Michael Kennedy: to make your desktop apps a little better too.
- 1:14:08Michael Kennedy: So anyway.
- 1:14:09Chris May: Seriously, oh my God.
- 1:14:10Michael Kennedy: That's a different episode.
- 1:14:11Michael Kennedy: So I just want to say thank you, Delaney, Ben and Chris.
- 1:14:15Michael Kennedy: Thank you all for being here.
- 1:14:16Michael Kennedy: And congrats on Datastar.
- 1:14:17Michael Kennedy: It looks like a super project.
- 1:14:18Michael Kennedy: I'm looking at some projects or an app running right over there
- 1:14:23Michael Kennedy: on my left that I kind of wish I'd built Datastar.
- 1:14:25Delaney Gillilan: Well, and the thing is to make sure to not think that it's just used, like, yes, we talk
- 1:14:29Delaney Gillilan: about the real-time stuff, but it's better for even just normal crud stuff.
- 1:14:32Delaney Gillilan: And that's kind of hard to, like, it's not as sexy to talk about, but it's better at
- 1:14:36Delaney Gillilan: that too.
- 1:14:36Michael Kennedy: Well, it's also 80% of what gets built.
- 1:14:38Michael Kennedy: So it's important to like point it out, right?
- 1:14:40Michael Kennedy: Yeah.
- 1:14:41Michael Kennedy: All right.
- 1:14:41Michael Kennedy: Bye everyone.
- 1:14:42Michael Kennedy: Thanks for being here.
- 1:14:42Michael Kennedy: Thank you.
- 1:14:44Michael Kennedy: This has been another episode of Talk Python To Me.
- 1:14:46Michael Kennedy: Thank you to our sponsors.
- 1:14:47Michael Kennedy: Be sure to check out what they're offering.
- 1:14:49Michael Kennedy: It really helps support the show.
- 1:14:50Michael Kennedy: Take some stress out of your life.
- 1:14:52Michael Kennedy: Get notified immediately about errors and performance issues in your web or mobile applications with Sentry.
- 1:14:58Michael Kennedy: Just visit talkpython.fm/sentry and get started for free.
- 1:15:03Michael Kennedy: Be sure to use our code talkpython26.
- 1:15:06Michael Kennedy: That's Talk Python, the numbers two, six, all one word.
- 1:15:11Michael Kennedy: This episode is brought to you by CommandBook, a native macOS app that I built that gives long-running terminal commands a permanent home.
- 1:15:18Michael Kennedy: No more juggling six terminal tabs every morning.
- 1:15:21Michael Kennedy: Carefully craft a command once, run it forever with auto restart,
- 1:15:24Michael Kennedy: URL detection, and a full CLI.
- 1:15:26Michael Kennedy: Download it for free at talkpython.fm/command book app.
- 1:15:30Michael Kennedy: If you or your team needs to learn Python,
- 1:15:32Michael Kennedy: we have over 270 hours of beginner and advanced courses
- 1:15:35Michael Kennedy: on topics ranging from complete beginners to async code,
- 1:15:39Michael Kennedy: Flask, Django, HTMX, and even LLMs.
- 1:15:42Michael Kennedy: Best of all, there's no subscription in sight.
- 1:15:45Michael Kennedy: Browse the catalog at talkpython.fm.
- 1:15:47Michael Kennedy: And if you're not already subscribed to the show
- 1:15:49Michael Kennedy: on your favorite podcast player,
- 1:15:51Michael Kennedy: what are you waiting for?
- 1:15:53Michael Kennedy: Just search for Python in your podcast player.
- 1:15:55Michael Kennedy: We should be right at the top.
- 1:15:56Michael Kennedy: If you enjoyed that geeky rap song,
- 1:15:57Michael Kennedy: you can download the full track.
- 1:15:59Michael Kennedy: The link is actually in your podcast blur show notes.
- 1:16:02Michael Kennedy: This is your host, Michael Kennedy.
- 1:16:03Michael Kennedy: Thank you so much for listening.
- 1:16:05Michael Kennedy: I really appreciate it.
- 1:16:06Michael Kennedy: I'll see you next time.
- 1:16:18Chris May: I'm out.