My agents spent months rebuilding a client-side router Remix didn't have. So I migrated from Remix V3 to TanStack Start. And in this video, I'm going to show you the problems that I had with Remix and how Tanner Linsley got me migrated in a single PR. And no, I'm actually still not using React. Let's start with the actual problem. So here's a problem that I had. My friend Aaron Francis very kindly sent me this video showing this terrible experience on my community page where it was like the community page was being embedded in itself repeatedly somehow. It was super weird. Ended up being something involving caching. And so, you know, I fixed it, no big deal. Stopped cache community pages from nesting in site shell. Okay, great. But then I had a number of other problems. So here we had route load handle update infinite loops. And that was a Sentry issue that Sentry caught. So that was nice, and it managed to get it automatically fixed and everything. So no big deal, right? But then we also had document head metadata needed to be sync on SPA navigations. Yeah, OK, that's a pretty normal thing that you need to have. And also, never flash a loading state on route changes. Fix the load latch. Move every client route onto create route data. Document no flash navigation. So communicating these principles so that future agents wouldn't ever run into a flash of loading state on route changes. Yeah, I don't love that. Paint forward-backward style and already the restored scroll. So we've got a problem when going forward and backward in history, not looking the way that it should. I remember this one, too. So ultimately, that leads to this PR from Tanner Linsley. Migrate the web app to TanStack Start, Router, Query, and Redact. And stop doing all of these fixes. These are not like the only fixes that I had to do around the router. In fact, there were like 38 PRs that involved the router, all because Remix V3 doesn't ship a client-side router. Instead, they recommend that you use the platform, which is great. And most modern browsers now support the platform where there's a platform abstraction or library that you can use to stub out the navigation API, and it's a fabulous API. But in my experience, I just had to keep on fixing all of these problems with my own client side router that grew to like 19 files and like 1200 lines of code, even in a single file. These PRs kept on touching those files. And so eventually I complained to Tanner and I said, listen, Tanner, I keep on having to fix all of these bugs. I'm so irritated by it. And he said, hey, like, why don't I just try to get TanStack Router working with Remix? and then like you've got the client-side router. Well, that didn't actually work quite right. It was hard to get Remix working with TanStack Router for a variety of reasons. And so he said, okay, well, let's just experiment and see what happens if we migrate the entire thing from Remix to TanStack Start. And here's the results of that work. It was 394 commits, 2,288 files changed and over 193,000 lines modified. So it wasn't a small amount of work and we're going to go into the details of how we safely verified that this actually was working and we safely shipped it and made sure that everything was good and also like the particulars around Redact and everything as well. But before we do that, we need to hear from our sponsor, because when you flip a whole app over like this, you want to make sure that you know the second something breaks. The more we adopt AI coding agents, the more critical it becomes that we have observability that can catch and fix errors in production. That's why I use Sentry. And no, this isn't just a pitch. This is actually how I work every single day. So let me show you a couple examples of what I mean. Just minutes ago, this issue popped up and Sentry ran its root cause analysis on it. So we get more than just the trace, but an actual analysis to figure out what the real problem was. And then a webhook woke up my coding agent, which took a look at that root cause analysis and ultimately opened up this pull request to fix it once and for all. And this sort of thing happens all of the time. I have this execute loop detected error. And here's a disaster recovery backup problem and a Cloudflare queues problem and an N plus one query. So you get like these performance issues that show up as well, and an out of memory error that showed up here too. All of this stuff is critical and user facing, and it's the sort of thing that you only really see when you deploy things to production. So I'm grateful I have Sentry to catch and fix problems like this in production. And it's free for solo developers and Sentry is giving me $100 in credits to give out. Just use the promo code DODDS or go to kcd.link/sentry. So one of the things that we did to make sure this was safe is Tanner sent me a link to a page that looked just like this. It was on kody.codes and it literally just had a single button. You'd click on it and you would opt into TanStack Start. That set a signed cookie so that the worker could route between the TanStack Start app and the Remix app. And so that way we could test out the TanStack Start app in the production environment to make sure that nothing was broken from that user experience standpoint. And nothing was. Everything actually worked super duper well. And so we decided that everything's looking good from our manual testing, everything's looking good from the measurements and everything. So let's go ahead and cut over. And one of the interesting things from that cut over was that we're not using React, we're using Redact, which is an experimental thing that Tanner has created to just see if we can get a smaller version of React that is faster or whatever, just make React better. and how he did that was effectively just tell an agent go re-implement the entire API surface, except leave out all of the current features, which a lot of us OGs in React space feel like React was really, really great until they started getting all over these concurrent features. And yes, those features definitely solve problems and it's not invented stuff, but it's not problems that the vast majority of us were facing and that made React a lot more complicated. And so this is what like Redact's goal is and it's smaller and ends up being better for our particular use cases. So we've got some growing pains obviously with Redact because it is so new and there are like a couple patch files even inside of Kody, but Tanner is very actively working on filling in any of the gaps with Redact and it's been an overall positive experience for me. And so that's why we're shipping Redact on Kody. Now, what was the fallout? What were the problems? Well, we did have a couple of small issues. So for one, when people had like the application open and we shipped things, we had to trigger a reload on everybody's computer because all of the assets, like everything changed. And so we ran into a couple of problems in that regard. And then we also had some SSR issues with emotion and hydration mismatches, which again was just caught by Sentry and triggered a automatic fix. So not a huge deal there either. And actually Tanner even added component stack traces to make tracing down the actual problem much easier. And unfortunately we didn't actually do live testing of the before state for some things. And so that is unfortunate because I can't actually tell you the actual production numbers for performance and that sort of thing. But I did have an agent go through and just check all of the numbers because I know that you're going to be interested in this. So here are a couple of things. First, we no longer have loading flashes per navigation. That's just not a problem that we have anymore. But also with Remix V3, our origin Worker startup CPU took 111 milliseconds with Remix but with Start and Redact, it's 44.5 milliseconds. So we're starting up faster. The warm time to first byte was 37 milliseconds. It's now 10 milliseconds. So that's awesome. And warm time to first byte when you're signed in, like you go to the account page, went from 69 milliseconds to 39 milliseconds. So also an improvement. Lighthouse mobile performance score went from 75 to 98. the LCP went from 5.29 seconds to 1.15 seconds. But it wasn't all just good. We also had the cold load client JS, or gzipped, go from 181 kilobytes with Remix to 258 kilobytes with TanStack Start and Redact. That said, on the account page when you're signed in, it went from 367 kilobytes with Remix to 273 kilobytes with TanStack Start with Redact. And so it wasn't like all just bad as far as the the payload to the client But we also had a little bit of a slowdown with nested navigation with Remix V3 It was 133 milliseconds to 158 milliseconds with Redact and TanStack Start And a lot of these gains at least on the server side come from the fact that TanStack Start is easier to code split. So the origin Worker's entry modules went from 934 kilobytes to 140 kilobytes gzipped. And the total server JS stayed about the same size. So startup and time to first byte benefit from that. And it's a build choice as much as a framework one. And going with Redact rather than React actually saved us 48 kilobytes of JavaScript. So that helped with the server startup time as well as the client load time. And this whole process took about 29 days from like Tanner opening up the pull request to us merging and then cleaning up all of this stuff after the fact. You kind of do this longer migration to make sure that you can roll back if you need to. And so we finally did actually clean things up on November 9th and it's all fully TanStack Start now. So what do we learn from this? Well, there are a couple of things that I would tell you if you're considering doing something like this. First, you want to watch what your agents are building. Are you building out framework features or your own application features? If it's framework features, then maybe there's a framework that's already built and battle tested that you could use instead of you're like building your own framework. And so like TanStack Start is great but TanStack has like a whole suite of other things that you should definitely take a look at if you're not already using those things for your JavaScript applications. The next thing is you want to decide on qualitative ground. So use numbers as guardrails and keep those numbers like that that matters and when you are going through and and making migrations and stuff like this, then you'll be able to compare whether things actually are improving things. I had to reconstruct those to kind of justify the decision that we made here. But yeah, you want to measure those things. And it's more than just the quantitative things though, it's the qualitative things as well. And so that's why you want to be thinking about what your agents are working on. And then you want to have a canary in production behind a tiny allow list or like a feature flag sort of thing, that way you can actually test things out for real users before you end up doing a switch over like something like this. This was a huge migration and I really appreciated Tanner putting the time in to make sure that we could actually test this in a production environment with the actual production data before we rolled it out to all of the users. And then you probably also want to work in the deploy skew recovery before you do the cutover. We've kind of ran into that problem and had a lot of users who ran into broken pages and that's not a really hard thing to do. Just tell your agent to build into deploy skew and then you won't have to worry about that sort of thing. And yeah, one thing that was really helpful for us as well is that Tanner just kind of totally owned this migration and also you need to budget for that cleanup as well. So as you're building out that migration, you want to have some record of the things that need to be cleaned up. So I gotta say thank you to Tanner for migrating us over because since that migration, I have not worked on any framework related things or my agents haven't had to work on framework related things. I can just rely on the framework that Tanner put together and now I don't have to worry about it. And I just think that that is awesome. I can focus back on the features again. So frameworks do still matter. This has been Better with Kent where you and I get better together. Please like comment and subscribe and share this with your friends. Thank you so much for getting better with me