Pod Insights Syntax - Tasty Web Development Treats 992: Migrating Legacy Code Just Got Easier About this episode Wes and Scott talk about migrating large codebases with AI — how to plan framework and language moves, establish patterns, handle templating changes, test thoroughly, safely deploy, and more.
Show Notes
00:00 Welcome to Syntax!
01:46 Why migrate to a new language or framework?
05:09 How to approach a large code migration
08:47 Establishing patterns before using AI
10:35 Moving from pug to JSX
12:06 Building a detailed migration plan
15:18 Testing every part of the application
15:51 Brought to you by Sentry.io
16:58 Deploying and catching issues with Sentry
19:12 Converting express requests to web standard requests
19:34 Other codebases that could benefit from AI migrations
21:36 Sick Picks + Shameless Plugs
Sick Picks
Scott: WisprFlow
Wes: displayplacer
Shameless Plugs
Phases Podcast
Hit us up on Socials!
Syntax: X Instagram Tiktok LinkedIn Threads
Wes: X Instagram Tiktok LinkedIn Threads
Scott: X Instagram Tiktok LinkedIn Threads
Randy: X Instagram YouTube Threads
Transcript Speaker names marked ? are inferred from speaking time and the show’s known hosts — they are not voice-verified.
0:00 Wes Bos? Welcome to Syntax. Today, we're talking about migrating and moving languages or frameworks, moving your code to something else with the help of AI. How do you possibly even do that? You've got a big monolith application that's been sitting around for many, many years, and you've dreamt of moving this thing over to something else. You simply cannot just type into the box, move it to X, Y, and Z, move it to a different language, move it to a different framework. It doesn't work that way just yet, at least, but the cost of moving has never been lower with all of this stuff. So I recently moved my own course platform over from, it was on Express for probably 10 years, maybe 12, and I moved it, I finally moved it over to Hanno,
0:43 Wes Bos? and then I also moved a whole bunch of other stuff at the same time. And we're going to explain, like, what the approach is to moving something like this over, which seems like maybe a bit of a daunting move, and how to get into it, how to test it, how to plan for it, all that good stuff. Let's get on into it. My name is Wes. With me is Scott. How you doing?
1:04 Scott Tolinski? I'm doing good, man. Chilling. I'm not sick. I'm not hurt. I am a-
1:10 Wes Bos? Rare, a rare Scott win.
1:12 Scott Tolinski? Yeah, I, wait a minute, when you got, when you got little kids, you're an action junkie like me, it's easy to dive into any of those things. So, no, I'm ready to hear about this. I do do a number of these things, migrating things. I migrated now from Tori to Electron. It went great. So I think this is a perfect use case for AI, as long as you keep a handle on how things are.
1:34 Wes Bos? It's a probably, probably one of the best use cases of AI that I can think of is like, it's very deterministic. It can be very, it tested very well, but certainly a lot can go wrong. So let me explain it. So I have a course platform, which I sell courses on, I have free courses on, there's, I think, 10 or so different marketing websites that are on it. There's a whole administration area. There is a whole viewing experience. There's stats. There's an admin area. There's, there's roles and all. There, you know, like, there's, there's everything you would expect from like a course platform. And I've been, been building this thing for many, many years, and I've- Kept the stack relatively the same.
2:17 Wes Bos? I've upgraded lots of stuff over the years, but like the one piece that was sort of the backbone of it was it used Express JS as the like controller router, sort of the whole thing lives as an Express server rendered or API endpoints that it's been hitting. And I have wanted to move that off of Express for many, many years. I think I had something like 60 or 70 different like routes and endpoints. And I've always just looked at it and I think this is the reason why Express is still so popular. I've always looked at it and go, that's a lot of work.
2:57 Wes Bos? That's a lot of repetitive work for something that doesn't have a whole lot of benefit to me. You know, like at the end of the day, I would simply just be, it would be exactly the same. But I'm at a point where I just like, I want to upgrade it because a lot of the new stuff that I want to do is all based on web standards, you know? Like what is that? It's request and response are standardized with the fetch API, right? And it uses fetch API, uses web streaming, uses asynchronous storage, uses form. All of these like web standards that we've been talking about for so many years. Everything uses them, whereas when I first started it, everything was based on the standard of connect. Connect JS, connect middleware, you know? That was, that was express, that was, what else was built?
3:42 Wes Bos? Fastify uses, was using that as well. Several other, other, these frameworks were using that sort of standard. And I wanted to move off of it. So that I wanted to move off of Express. And then along that I was also, all of these sites that I have done over the years, a lot of these courses are deprecated, they're not used anymore, but I still want to keep the like landing page up. People still want to visit them. And all of those were written as PUG as a server template, right? So PUG is a templating language. It used to be called Jade, now it's called PUG. And it's, it's like a weird indentation based templating language. I was really into it at the time. I absolutely loved it. Thought it was so clean.
4:24 Scott Tolinski? Coffee script era, right?
4:26 Wes Bos? Yeah, it was, it was, I, when I started this thing, it was all done in Coffee Script. We talked about that maybe like six years ago. I moved from Coffee Script to TypeScript. But I absolutely hate it now and I wanted to move off of it. So there's that. The emails were written in Pug. The viewing experience and the admin experience, that's all been a React application for probably eight or nine years now. And I didn't touch any of that stuff. That's all gonna stay in, in React. But the, the core thing of much of the server rendered templating is in Pug. And all of the logic and controllers and stuff, the API endpoints, the auth, the middlewares, everything, that's all done in, in Express.
5:06 Wes Bos? And well, I needed to get it, get away from that. So let's talk about how, how we approach, how I approach a move like this. So first thing is you need to make your tech choices upfront, right? Investigate the possibility. Is this thing even doable? For the longest time, I was looking for something that would let me run like web standards, Hanno routes. So Hanno is like, is sort of like the modern Express. And it's, it's super fast. You can run it anywhere. It's a really nice API. And of course, most importantly, it's, it's built on web standards. And it's similar enough to Express that I could see myself making like that lateral move from one to another. So I, I thought like, yeah, okay, obviously that's, that's going to be the one for me. I'm not going to move to something absolutely different. A lot of people are asking like, why didn't you move it to like,
5:51 Wes Bos? like Svelte Kit or like 10 Stack Starter or something like that? And I, if you're doing a big move like this, it needs to be a lateral move, which is feature to feature parity. You, you can't like also start introducing a whole bunch of new features at this point. Because when you try to migrate something and start to put new features in, that's just way too big of a move, in my opinion. And that, those types of projects never, ever get shipped.
6:18 Scott Tolinski? I noticed myself with AI, sometimes I get impatient and I'm like, I'm doing something. And whether that is a refactor and I want to start working on something else and it like as a feature. Or I've noticed something about the refactor that I then want to change again. And it, it takes a tremendous amount of restraint to say, no, wait, actually, let's get this into a stable place. And then modify, and then stable, and then modify, rather than let's take everything out of the cupboard and then try to put it back in. Yeah.
6:52 Wes Bos? Do it all at once. It's so tempting, so tempting to do it, but you it simply just makes a mess. And it's those types of projects will never ship. So I was like looking for a long time, like a way that I could move this gradually. Meaning that like, I would love to have some routes in Hono and some routes in Express and sort of just move them over one at a time. As I was going through it and I never found anything like that. There is the opposite where you can run a Hono app. Inside of Express, I believe, but I wanted the opposite, meaning that I want to take all my Express routes and turn them into Hono. What I had been doing over, probably over the last year, year and a half is anytime I added new code, I tried to do it in a way that was like web standards.
7:34 Wes Bos? So that means instead of sticking things onto like in middlewares in Express, the way that you sort of hot potato data from one middleware handler to the next, like if you're populating a user, you might have a middleware that populates a user. The way that you do that is you stick it on the request. So you say request dot locals dot user or request dot user equals and you stick it on there. And then you know, the next, the next like middleware down the line, or the one that actually ends up rendering out your template. You know, they'll, they'll have access to that data because you stuck it in the request and they can then pull it out. I don't think they have that sort of concept in Hono. They might, but I move, I've been moving everything over to using a sync local storage, which essentially is
8:18 Wes Bos? you can stick stuff in like a local store. And then any function that gets called down the line will then be able to pull that out of a sync local storage. It's sort of just out of the air. You can just pull it up and then you have access to the data you want. So I've been working on using that API for over a year and I had probably four or five things converted. Like I rewrote my whole checkout recently. I redid a bunch of the auth stuff. So all of that stuff was in a sync local storage and I had a and like, that's sort of my next point of how you tackle this thing is you gotta move over a few things yourself to figure out what this is going to look like. You need a couple really clear explanations as to how the new routes should look. So I moved all of those over to sync local storage.
9:03 Wes Bos? I made sure that any data that was being extracted, you know, like body params, all of that stuff. I just made sure that it was extracted high up in the controller, meaning that you're not using any Express specific APIs inside of your business logic. You know, you're not using like. Request dot, I don't know, whatever the weird things are that were non-standard. I made sure that I wasn't using any of those and I was just throwing them into variables before I went ahead and used them. And then other standards, form data, et cetera, et cetera.
9:34 Scott Tolinski? I will say, like, you kind of briefly, briefly hinted at this. Something that you pointed out in another episode is that AI does really well when you have established patterns.
9:46 Wes Bos? Yep.
9:47 Scott Tolinski? And being able to manually establish some patterns can go a long way into actually getting successful patterns in the long run.
9:57 Wes Bos? Yeah, exactly. I think the reason that this move was so easy for me was that I had been coding it myself. I have these patterns that I know this is exactly how I want it to look. And then when I did that first prompt of like, let's start planning and I want to move it over, it did like a huge scan of the code base and it says, oh, I see you have already started to move several of the routes over. And I was like, perfect. That's exactly, that's exactly what I wanted is I wanted to realize that some of the newer stuff that had been written recently looks exactly how we want it to look. So there's that. And then also there's the templating angle as well, right? Like I gotta get off of pug. This stuff is really frustrating to work on.
10:41 Wes Bos? So what I did, again, probably about a year ago as well, is I wrote a TSX, JSX templating engine for Express, which, uh, most bizarre thing ever. I might be the one of the only people in the world that needed this, but I basically, in Express, you can have different templating languages, right? You can have handlebars or pug or whatever. So I wrote a custom one that allowed me to use JSX. And in fact, it actually used React as well, but not like the type of React that you're thinking of where it gets hydrated on the, on the client and whatever. Simply, I just wanted to use JSX tags so that in the future I can move this whole
11:25 Wes Bos? thing over to a React application, you know, like some sort of meta framework. But I wanted to at least get to a point where I could just start using JSX, TSX as I was already using it. And then by adding that, I was able to simply go to any template I had. Rename the extension from .pug to .jsx. Obviously, change the templating language in there. But I was able to use all the stuff that I was used to. I would like the locals, local variables that were passed in, parameters, and as well as any of the React stuff that I wanted, which was, worked really, really well. I was pretty happy with that implementation. So the third step we have here is like, you gotta make a plan.
12:10 Wes Bos? And this is probably took the second amount of time, most amount of time. The actual writing the code, almost nothing. But the actual planning and the testing were the two things that took the longest. So what I did is I made a plan. I went into the LLM and I said, like, I want to move this thing over. I've already done some of the moving over the controllers. I already have a JSX, TSX templating engine. So like, you can kind of see that this is, this is the direction I want to go in for the rest of it. And we need to go through every single controller, every single endpoint, every single piece of this code base and make a plan for how we're going to do it.
12:54 Wes Bos? So it took quite a while, went through every single instance, went through every single controller, looked through every single piece of middleware and scaffolded out a plan. I went back and forth, I don't know, probably 20 or 30 times, making sure that we have everything, making sure we look at things like auth, rate limiting, CSRF tokens, JWT tokens, all of, all of that kind of complicated stuff, going back and forth through it. Then, once I felt like it had a pretty good idea of the entire surface area of the application that needed to be moved over, I asked it to make a manual checklist for testing. And I think, I think that this was really important because it then kicked out a list of, I think, 150 checkboxes
13:39 Wes Bos? of things that needed to be tested.
13:43 Wes Bos? That was really good because I understood, okay, it understands the surface area, right? You can look at the plan and it will say, do X, Y, and Z. But if you ask it to make yourself a checkbox of things to test, and it kicks out 150 items, you realize, oh, it actually does understand that when somebody wants to merge two accounts, then we created a token, and then that token gets emailed to them with a link, and you got to make sure that that is then rendered in the email properly. And then when somebody clicks on that link, it will render out the new template. You know, like, there's all these little edge cases of things that need to be covered. And at that point where it made that huge list for me, I felt pretty confident in letting it rip because
14:28 Wes Bos? it understood all of the like nitty gritty little pieces. Then, I like, you let it rip, and it honestly just ran for, I don't know, maybe three or three or four hours, which is not very long considering how much code it had to move over and rewrite. A lot of that was not the like endpoints, because all of that business logic of like what to do mostly stayed the same, you know? Send a password reset email, approve somebody, buy something. All of those endpoints, none of the business logic there changed, aside from taking in request parameters, bodies, whatever, doing the business logic and then sending back the data. So very little of that actually changed.
15:12 Wes Bos? It was more just about like what the actual route signatures looked like and making sure all the types and everything lined up. What did take a whole lot of time was actually testing it, right? Like, you can have the unit tests and all that stuff till the cows come home, but like, really, this type of thing is kind of scary. And we had to go through every single feature of the entire platform and just go through one by one, checking that it still worked, seeing if anything popped up. And there was, I don't know, maybe 20 or 30 little things that popped up here and there. A lot of them were just templating problems, because moving from PUG to JSX was not as straightforward.
15:52 Scott Tolinski? See all of the errors in your application, you'll want to check out Sentry at sentry.io/syntax. You don't want a production application out there that, well, you have no visibility into in case something is blowing up and you might not even know it. So head on over to sentry.io/syntax. Again, we've been using this tool for a long time and it totally rules. All right.
16:16 Wes Bos? And a lot of the cases, my like pug templates were just huge things that covered everything. And I didn't want that to be in my JSX. I wanted to like convert them to components. So I did make sure that a lot of it got moved into reusable components rather than just like partials in pug and whatnot. So lots of work on the templating part. Surprisingly, most of the like business logic worked really, really well. All the auth worked really well, first try, which I was pretty happy with. So it took, well, it took a couple hours for the code to go through. It took maybe a week, week and a half to actually, to get to a point, not like full-time work, but just to get to a point where you felt comfortable
16:57 Wes Bos? deploying this thing. And then on a Monday morning, I merged the PR, let the sucker go.
17:03 Scott Tolinski? Yes.
17:04 Wes Bos? And then immediately the Sentry emails start coming in.
17:10 Wes Bos? And like, that's always the most hilarious thing is that like the emails from Sentry come in so quickly. And I was able to, luckily, all of the emails, all of the problems were related to progress tracking. So as you're watching a video, there's progress that goes kind of back and forth. And there were people, I think there was like 40 people watching videos while I deployed it. So they were on like the UI version of the old one and it was still sending API hits to the API like forward slash account, forward slash progress, you know, tracking their progress. That's why I needed to make sure that the API endpoint stayed the same.
17:52 Wes Bos? And there was something weird where it wasn't loading the progress properly, but those were relatively easy fixes, but I was thankful to have Sentry, sentry.io/syntax to tell me what those issues were very quickly so I could fix them and not too many people lost their progress in watching their video.
18:10 Scott Tolinski? Yeah. Man, that's a scary migration to do in that kind of way. And I will say, man, I've done so many of these types of migrations by hand. It's scary to do it by hand, too. So having tools like that, that can alert you to stuff going wrong is important.
18:28 Wes Bos? Now that it's, now that it's like moved over, I'm like so excited because like now the world is my oyster in terms of like, now I'm thinking, hmm, can I, can I move it to CloudFlare? Can I move to Drizzle? Can I, like, there's so many more options that I have available to me now, now that this thing, this move has been done. And I feel like I can do a lot more with whatever features I wanna, wanna scaffold out. So AI is so, so good for this type of stuff. I was so happy with it because I don't know if I would ever would have moved off of X. I probably eventually would have done it, but I was just, I didn't want to do it for the longest time. You know, I didn't, really didn't want to have to do it.
19:12 Wes Bos? Oh, one more thing I forgot to say is that I wrote like a middleware that converted the express request and converted it into a standard web request. And that's how I was able to move a lot of the stuff over beforehand where I wrote like this little converter function. And then, once that was all done, I could delete that function from, from the codebase.
19:34 Scott Tolinski? How many codebases do you think are out there that could benefit from this type of thing? Like, a serious process, you set up some guardrails. I think the, the planning and the patterns are like the biggest keys to success. And then the, the testing and verification, you have all that.
19:50 Wes Bos? Yeah.
19:51 Scott Tolinski? You, you can monitor the output, you could read the code if you know what you're doing. And it's important to, to be able to do stuff like this, yeah.
19:59 Wes Bos? Like, I wonder how many people are on like an Angular one codebase? Or how many people are on like a, like still already have SASS? And they, they want to use some of the new CSS nesting features? Like SASS to CSS nesting, that would be easy. That would be an easy one, right? You'd have to plan a little bit, you'd have to see which SASS features you're using, plan out what to do with those SASS features, you know, because it's not perfect one-to-one parity. How, how are you gonna tackle, how are you gonna re-implement this if it's, that feature's not supported in CSS nesting? But there's just so many different. Use cases where now moving from one to another is such an easy thing.
20:37 Scott Tolinski? Yeah.
20:37 Wes Bos? Not super easy, obviously, right? People have
20:39 Scott Tolinski? Effortless, works first try.
20:41 Wes Bos? People have like 10 times, 100 times bigger applications that are written in Java Spring, you know? And you're not going to just the one shot move that thing over. But it certainly is a viable solution versus having to try shoehorn streaming into an application that was never built for it.
21:02 Scott Tolinski? Sick. Well, I loved hearing your process here and some of the stuff is going to go along with some, some topics I want to get to you talking about soon about using more deterministic tools for ensuring things like this work because I do feel like that is the place to get when you have a good testing suite that passes or you have these types of things that are guardrails for the AI writing quality or whatever it is. I think those are the types of things that are going to get us from a place of just slop, slop, slop to maintainable systems, migrated.
21:35 Wes Bos? Totally.
21:36 Scott Tolinski? So, yeah. Well, thank you so much for sharing that, Wes. Let's get into sick picks and shameless plugs. We haven't done shameless plugs in a while, but I've been feeling like shameless plugging something. So sick picks, I have a sick pick for you, which is Whisper Flow. I've been using a lot of voice dictation. I had a crazy allergic, this is back to me being sick about something. I didn't even talk about this on the show. I had a crazy allergic reaction to my sinus surgery medication and it like caused some major inflammation in my wrists where they were like, they felt like they were broken and my wrists are still recovering from that, believe it or not. I got really bad RSI from it. So I've been doing a lot. I, dude, I'm just, yeah, this is just my life.
22:19 Scott Tolinski? I, I, I've been doing a lot of voice to, to text and I was getting just so frustrated with the voice to text in Super Whisper. And the Super Whisper folks are great because they've reached out to me and were like, okay, how can we make this better? So I just was getting really frustrated with Super Whisper not being reliable for me. I would hit the button. Sometimes it would show the bars, sometimes it wouldn't. People were like, oh, if it's slow, you gotta go in and change which model that you're using. It's like, I don't, I don't care about models. I don't care about like settings. I wanna hit my voice dictation button and I want it to work and I want it to work every time.
23:00 Scott Tolinski? I was suggested Whisper Flow as being a good option and it really checks the boxes of just works. You hit the button, it works. The little indicator is small, it's visible, it works every time. I don't have to worry about the model. I don't have to worry about any of that stuff. It's fast, it's efficient. So if you're doing voice dictation a lot, I found it to be much nicer, obviously, than the built-in system-wide one. And in general, it's, it's been very reliable for me, which is something that I abs- It, it has never once not triggered, not pasted, not done my text, which is like, that, that's how it's gotta work.
23:44 Wes Bos? Yeah, yeah. I've tried these things so many times and I've always just go back to the built-in macOS one. And like, the macOS one I don't like because I would love to be able to give it a dictionary of like common words that I say in coding. Cause there's Super Whisper and whatever, those things are way better at that. But I also, I love that the built-in macOS one will stream what you're saying, so you can see it.
24:09 Scott Tolinski? I know.
24:10 Wes Bos? And then you can like, oh, if something is wrong, you can just click where you want to go. You can delete stuff and then you can just keep talking. So like, why, why do you use these things versus the built-in one?
24:22 Scott Tolinski? Simply because it's more accurate. I can say the word century and it knows that I'm saying century and not sentry. I, I, it can do my last name correctly, which is, you know, right? My last name isn't even hard, but AI, it scoofs up my last name or the, the dictation one. And I also just find like the, the macOS dictation would just be inaccurate enough that, I kid you not, I bet there are times when I'm sending you guys messages on Slack that it has just weird words in it. And those are almost a hundred percent of the time because I'm doing it on my phone via the, the dictation that's on the phone, rather than something like Whisper Flow or Super Whisper, which are getting like actual, the actual words I'm really saying.
25:06 Wes Bos? Interesting. Just more accurate. I need to, I'll give him a shot again because I would like to provide a whole bunch of things that I often, words that I often say, you know, or like,
25:18 Scott Tolinski? Yeah.
25:19 Wes Bos? You could even, like, what would be cool is if you could hook it up with like OCR as well. So like based on the app that you're on, it could like look at your code base and like, fill it with words that it sees on screen. That would be kind of cool.
25:31 Scott Tolinski? And Whisper, Whisper Flow has a cursor plugin and apparently works well with coding, but I have never done that because I don't use cursor and there, there isn't like something for me. I, I don't know how well I would do with that, actually coding with voice. I did get into the accessibility, like macOS accessibility has like window control with voice. And so I was like, show numbers, 42, enter. And I'm like talking to my computer like that, whatever. And then dictating
26:02 Wes Bos? Yeah.
26:03 Scott Tolinski? Whisper Flow. And it was like, the days when my wrists were at their worst, it was very usable, but definitely, definitely took some getting used to. I'll tell you that. I accidentally like archived and deleted some open code sessions because I told it the wrong number at the wrong time and stuff. So
26:19 Wes Bos? Oh, no.
26:20 Scott Tolinski? It's getting a little chaotic. Yeah.
26:21 Wes Bos? All right. I'm gonna sick pick another app as well. Um, this is called Display Placer. Um, this is a CLI that allows you to save your display settings. And this is a problem that I have. If, if anyone uses a dock and a Mac, um, and you have multiple monitors, you may know that every time you plug into a different USB port, they ID them, all your monitors separately. And then anytime that they come online in a different order, they also ID them differently. So I have this problem where every time I plug my dock in, it thinks that my monitors are always wrong and I have to go and turn them and replace them exactly where I want. And then I have this, uh, prompter, which I have off a lot of the time.
27:06 Wes Bos? And then when I turn it on, it thinks it's a different arrangement. It drove me nuts. So I got this little CLI called Display Placer. And then there's a raycast like UI for it. Basically, you can save your common things, your common layouts, which I really like because I have, I have a desk at the cottage, I have a desk here, I have, sometimes I have different displays on and off. Sometimes I like a larger resolution, sometimes I like it zoomed a bit more up when I'm recording. So I have like six or seven different presets and I can just type into it and hit presets. It's not perfect, maybe once in the last couple of weeks, I've had to manually go and change it again.
27:45 Wes Bos? But it is way better than having to like manually go in and do my monitors every time I plug into my dock.
27:52 Scott Tolinski? Yeah. Man, what annoying little things, huh? Real quick, before we get out of here, I do have a shameless plug. My wife started a podcast, I've talked about it on here before, phases.fm. Her most recent episode is Growth Mindset for Kids. And it's really talking about how to raise resilient kids who don't give up. Because, man, it's really easy that like when kids get frustrated with stuff that they can just quit or do something else, or we want to raise resilient kids. So my wife is a doctor of psychology and she has a new podcast about making parenting topics scientific, but also fun and easy. So check it out at phases.fm. And it's available on all podcast players, all that stuff. So check it out.
28:37 Wes Bos? Is it great? What domain name? I can't believe you got that.
28:42 Scott Tolinski? I know.
28:43 Wes Bos? Such a good name.
28:44 Scott Tolinski? I jumped on it so quickly. I, when I saw that that existed and the YouTube and all that, I just jumped on it as fast as possible.
28:53 Wes Bos? Sick, phases. All right. Thanks everybody for tuning in. Catch you later.
28:56 Scott Tolinski? Peace.
Previous 991: Vite’s bet on Cloudflare (VOID Framework) Next 993: It’s Been A Hell Of Week Page updated October 30, 2026 · transcript and summary are machine-generated