Vibe coding a visual email editor with AI, Laravel & Vue
I live-build a fully functional block-based email editor using Laravel, Vue 3, and Maizzle with AI as my pair programmer. Watch how I use Claude, GPT, and Junie to scaffold components, wire up real-time previews, and build something I’ll actually use every week.
Everything I said
All right, we're gonna vibe code. We're gonna vibe code an entire tool, basically. I guess it could, you know, it could be a SaaS at some point, but this is a tool that I'm gonna be using internally. Every week, I send a newsletter. It's a very good newsletter. You should go sign up. I'll leave a link below. Every week, I send a newsletter, and it has, like, you know, five discrete blocks, five chunks, five sections, and instead of, like, manually writing out each of those each time, we're gonna build a block email editor.
This is what we're gonna build. Look, this is it. So I'll be able to click Heading and say, like, uh, my latest video, and I can change the size. You know, that's cool, whatever. But then, this is where it gets very cool. I can just say, "Hey, here's the URL to my latest video." Boom. Look at that. It pulls the thumbnail. It adds all this, uh, it adds all this formatting so that it works well in email, and I can add, you know, a little markdown below it.
I can say, "It was very good." And I can say, "Actually, let's italicize that. It was very good." And this email preview on the right-hand side, this is not, uh, this is not just, like, view components, and it's rendering. No, this is actual... If we inspect it, it's actually going out to an email rendering server so that it adds all this wonky stuff on here.
And look how it inlines all the CSS, because that is required. That is required for email. So this is round-tripping. We'll close this. This is round-tripping out to an email server that is run by Mailzul. So we're running it locally, but Mailzul is the one that is going to be building up our emails. But here, we can say, "Hey, just send..." Oh, and we can reorder.
I forgot we can do that. We can move that up and down. We can say, "Hey, here's the URL," and then we're gonna send it to the Laravel application and say, "Grab all the stuff you can about this URL." Uh, in the future, we can grab view counts and titles and descriptions from the YouTube API, then pass it over to Mailzul, "Render me a good email." And you know what? We're gonna vibe code the entire thing.
Now, I've been a developer for more than twenty years, so my vibe coding is a little bit different, and I hope a little bit more realistic. We're gonna have AI write a massive chunk of code, and then we're gonna clean it up just a little bit. Write a massive chunk, clean it up just a little bit. So this is a behind the scenes of how a working developer actually uses AI.
We're gonna use Claude Code, Claude, ChatGPT, and and JetBrains' Junie. We're just gonna use them all, because I have no allegiance to any of these things. So this is a long video. If you like it, please let me know. I wanna know if you want to see more of this AI content from an actual working developer, not an AI hype person.
So please leave a comment and let me know, and hopefully, you will enjoy this full video, full build, behind the scenes, nothing cut out. Let me know what you think. All right, let's get started. Most of this application is going to be a Vue.js, um, but it's gonna be within a, a Laravel container.
So we're gonna do laravel new email view. That's fine. That's fine. We're not gonna do any tests, 'cause we're vibe coding. We're, we're, we're just building an internal tool here. So let's hop over to the drawing board and see, um... Here's, here's what I want. Uh, let's start with one button. I want, uh, we'll do Heading.
I want Heading, and le- let's make that as small as we can. So instead of, like, having a freeform, uh, email editor, I want a block editor, and it's gonna be, uh, pretty, pretty blocky. Um, I don't actually want, like, a Notion-style editor.
I want, I want something that is way more constrained, because like I said, we only have so many blocks that, uh, that we're gonna use. So first thing I'm doing here is I'm just gonna kinda draw it out. I want, um, I want the left-hand panel to have all the blocks, and then we'll have a, uh, we'll have the full-- This can go full length down here.
Then, in the middle, we're gonna kinda have, um, I don't know, like, the place where you... So I guess, on the left, this would be called the Drawer, and then in the middle, this is, like, the actual email that we're building, and then over here on the right, I want, like, a, uh, a preview section.
So let's just pull this guy over here, and we'll do that. And so over here, we'll have, uh, Components. These are all of the things that you can add to the email. And, um, part, part of the reason for doing this is I want something that's, like, you know, besides those, uh, those are really primitive.
I want something that's, like, um, we'll say Signature, and that's just, like, the signature for every email. And I want, um... Maybe that's a bad example. Maybe I wanna put in, like, our latest YouTube video. And so all I do is I put in a link, and then the system, whatever that is, fetches the thumbnail, fetches the title, fetches a little bit of the description, and puts that into an email.
So instead of saying, um, "Hey, let me write all the markup for that," I'm just gonna provide an interface that is, "Give me the URL." And what's another one? Um, we could have one down here that's, like, Course Promo. So maybe we wanna throw a promo in for one of our courses, of which we have many. So if you're looking to learn SQLite or Postgres or how to screencast, there's a coupon code down below.
Um, but it would be nice to have, like, these kind of set up, and we can just pick, like, "What course do you wanna promote?" And then that creates this entire block, right? So then, over here, we're gonna have, uh- The, I don't know, like, the, the builder, and then finally here we'll have the, uh, live preview.
And w- what we're gonna have to do... Uh, maybe I'll save that for a second. So you can imagine, um, somebody comes in here to build a new email, right? They look at all of the components that I have provided for them, and they say, "Great, I wanna add a heading." And then heading pops over here and it says, like, uh, "What is the text?" The text is some sort of input, and the, um, heading size is some sort of input.
You know, H1, H2, H3, whatever. Um, and so that becomes, that becomes a set of forms. And then we have, you know, you add a tweet, and what is the URL? Uh, what is the URL for the tweet? And all the user has to do is provide the URL, and then we get this super fancy complicated markup over here.
Um, and we've got, uh, I don't really wanna, you know, we've got a bunch of fancy markup over here. That is what we're building. So what I'm gonna do is, um, let's hop back to-- So it looks like that is, yep, that's fine. So we're just getting the site all set up here, and we can CD into email.
Maybe. Okay. Herd open email. Great. We have our Laravel application right here, so let's open this in PHP Storm and start cleaning some stuff out. Um, we want routes web, and we can get rid of all of that, and we'll change this to builder.
It doesn't need a name. This is basically the route that we're gonna be working with. We're just gonna have this one route here, and then we can come out to resources and pages. Oh, they changed it all to be lowercase. That's interesting. Um, and you know what? We're gonna change a lot of this, so that's fine.
We're gonna get rid of all of that, and we're gonna change dashboard to be builder, and we're gonna get rid of that. And ch-ch-ch-ch, I think I don't want-- I think I want welcome to be builder, 'cause I don't want the authenticated layout. So we're gonna change that to be builder.
And if we get rid of all of that and just put a div of hey in here. Are we off to a good start? Oh, we need to run, um, NPM run dev. All right. We've got our shell. We just did that by doing, uh, Laravel new.
We don't need the link. And I'm actually-- I'm not gonna use script setup. Um, so there's a bunch of stuff in here that I don't really need, um, but that's fine. Use appearance, use initials. This is all new. I'm not gonna use any of these components, I don't think.
That's fine. We gotta start vibing. Um, all right. Let's take, let's take this, and here's what we're gonna do. We're gonna take that, we're gonna open chat. We are gonna close the sidebar, so you don't see all of my embarrassing history, and we're gonna come in and let's change this to 4-0, paste that picture, and then let's start.
I'm building a Vue.js application. I've attached the layout for what I'm looking for. On the left-hand side, I need a set of components, um, and each component has, uh, each component has a name and an icon. Some of the components are going to be heading, paragraph, uh, YouTube video.
You can see more in the image. When the user clicks on one of those components on the left-hand side, that serves as a sort of, um, that sor- serves as a sort of, uh, prototype, and then we'll create an instance that goes in the builder section in the middle. So what we're doing is we're building, uh, we're building an email builder.
And so when the user clicks on a component, it should be added to the email as a block, and then each component gets to define, uh, each component gets to define its own inputs. So, for example, when the user clicks on heading, the heading component, when it is added into the middle section, should turn into a form where the user can type in the text for the heading and pick, um, from a dropdown the heading sizes, you know, H1, H2, H3, and
that gets stored in, uh, a JSON blob. We do not need to render the email at all. All we're doing is creating this giant JSON blob of blocks. Each block has a type, and each block has a, um-- can define its own content.
And so, ig- for example, the heading block will define a size and text. The tweet block will just define a URL. Um, so as the user is typing, we're updating, we're updating that content. Um, and then let's add, on the far right-hand side, let's add a, um, let's add a JSON debugger view, so we can see the source of the email as we're building it up.
Um, and then we will have to issue an API request to render the actual email, so don't worry about that part yet. Now, take all of that information that I just gave you and write up a, um, write up a detailed prompt that I can feed back to, uh, ChatGPT so that it can build out this Vue.js component for me.
That's pretty important. Vue.js version three, no TypeScript, and options API. Okay, let's see if this works. So that is Super Whisper.
When I hit, um, when I hit, what is that? Option+Space, I get that, and then, like, it just transcribes. So now, let's, um, run that through ChatGPT and see if it gives me back a pretty good, uh, a pretty good document. Yep. Yep. Yep.
Mm-hmm. Perfect, perfect, perfect. Okay. Um, we-- let's not add dragging just yet. We do need to be able to drag to resize, but we're not gonna do that just yet.
So, uh, doo, doo, doo, doo. Yes, I do wanna split them out. So let's take this entire, uh, let's take this entire thing. Mm, mm, mm. Copy you. We're gonna come over here and open a new plain text.
All right. And here's the thing. We're not actually gonna feed it to ChatGPT. Um, options API, no TypeScript, visual email builder, consists of three columns. All right. Um, please build the main component in, um, pages/builder.vue. It consists of three columns.
Okay. Yes. Yes. Yes. Use a single file Vue component for each block type. Yes. Um, builder. Yes. Yes. Yes. All right.
Yep, cool. Didn't mean to delete that last one. All right. This is a good document now. So what I am going to do is I'm going to... Let's put it in, um, requirements.txt. And now I'm gonna open a new tab, and we're gonna open Claude.
Yes, proceed. And I think we're using-- Yeah, we're gonna use the cheap one. We're not gonna use O-Opus. And here we go. In this directory, you will find a Laravel application, uh, that uses Vue.js on the front end and, um, Inertia in the middle. Some of the Vue.js components are using the composition API and TypeScript.
I do not want you to use those. I want you to use the options API and just use regular JavaScript. I've written up a requirements doc that you can find in requirements.txt. The first thing I want you to do is I want you to read that document, and then come up with a plan to build out, um, the component that is specified in that document.
Okay, I expect that will take quite some time. There we go. All right. Let's see what it did. Um, convert builder from Vue or from TypeScript.
Yep, that's fine. Block types, yep. Editing blocks, JSON debugger. Yes, yes, yes. Yes. All right. Main builder Vue. All the state and coordinates, three columns. Yeah, that's exactly what I said. Okay.
Well, are you working? Um, let's see. Pages, resources, pages builder. Yep, I think it died.
So we're just gonna try again. Sometimes it does that. Sometimes it's just like, "Nope, I'm gonna, I'm gonna do the thing now," and then it just doesn't do the thing. Um, all right. So it's rereading it. It's coming up with the... Yep, yep, yep. Um, okay, sounds good.
I don't know. Uh, here is-- Let's go back over here. The reason I said we're not going to, we're not going to render- Uh, we're not gonna use the view side to render the stuff. Um, there it's go- it's writing, is because email is the worst. That- that's why. Email is the worst, and we have to, um, we gotta be really careful about how we create emails.
So what we are going to do is we're going to use this. We're gonna use Mailzle. So instead of just, like, naively outputting HTML, which will not work in email clients, we're gonna use Mailzle to build out the HTML, which is gonna be a little bit of a weird round trip, I will admit.
So here's the plan. Um, so inside of, uh... Let's do it this way. We've got, mm, yeah, okay. We're gonna take you, move you over here, and zoom in a little bit. We've got our builder.view, right? And that is going to output, uh, that's gonna output a bunch of JSON blocks, and those JSON blocks are gonna look, uh, they're gonna look like this.
So each block is going to have a type, and we'll say the type is, forget the, uh, the quotation marks. The type is paragraph, right? And then the, um, I don't know, what do you wanna call it? Uh, we should probably call it props. I think that probably makes the most sense. The props are going to be something like this: text, "Hey there." And then we'll have, you know, size.
We can say text xl or something like that. I don't know. So that'll be one block, and then we'll have a block that is also, um... So the block could be, you know, tweet, and the prop is URL, and then, you know, it's like x.com/1234, and that's, that's not gonna exist there.
Um, so imagine that's wrapped in an array. This is what, uh, this is what these JSON blocks will look like, okay? So these JSON blocks are going to come out of our builder. That is going to be the result of this part in the middle, and then, uh, we're gonna get these JSON blocks out. We're gonna send those JSON blocks.
We're gonna send them to, um, this is for the rendering pipeline. We're gonna send them to the Laravel application. Okay? So we're gonna post to the Laravel application these blocks, and the reason we do that is because, for example, we need to go out and look up, we need to go to X, and we need to pull the content of the tweet and the images, yada, yada, yada.
We need to pull all of that, and I'm doing that on the server side with Laravel. Um, and then where does Mailzle come in? Well, that is a good question. Let's get you guys out here. Mailzle comes in below that. So then, this is weird, but I think this is, I think this is the right way to do this.
Um, the Laravel application, the Laravel application is going to call out to Mailzle, and what it is going to do is it is going to say, um, build email, and then it'll pass in, uh, a UUID. You know, build this email. Okay? So it's gonna say build email 12345.
And inside of Mailzle, there is a way... This is getting a little weird, isn't it? Um, so builder's gonna make a post request to the Laravel application with the JSON blocks. The Laravel application is going to shell out to Mailzle and say, "Build this email." Mailzle, in fact, Mailzle is going to call back, I think.
This may change. This may be stupid. Um, but it's impossible to say right now. Uh, Mailzle's gonna call back and say, "Hey, what are those blocks?" So we could do this in one of two ways. We could pass the blocks through the command line, um, straight to Mailzle, or we could have Mailzle phone back to the application.
I think we're just gonna have Mailzle just get the identifier and then phone back to the application, which I'll show you why in a little bit. But then Mailzle's gonna say, "Hey, give me all those blocks again," and then Mailzle is going to take those blocks and dynamically render. It's going to render an email with safe HTML.
That's the plan. Um, and then that email gets, um, fed back to stay with me. Stay with me. That email gets fed back to the Laravel application like this. So the rendered body of the email gets fed back to the Laravel application, and then you guessed it.
That gets fed back to builder.view as the rendered preview. So that's the entire, that's the entire life cycle is we're gonna post the blocks. The Laravel application's gonna tell Mailzle, "Render those blocks." It's gonna render the email back to Laravel, and then, um, then it will return the response back out to this part right here.
Okay? That's the plan. Let's go back, and I think this is probably stalled. Yes, keep going. Um, oh, man. Should've told it to use Tailwind. I thought it would, I thought it would know that by now. That's fine. Um, that's fine.
We'll just go back and say, "Hey, do it better. Make Tailwind. Make Tailwind out of it." That's fine. Okay, so the reason I think we're gonna have Mailzle phone out is 'cause if we look at this documentation, and we look at fetch, hmm- That's interesting. Um, there is a-- there's a, like, fetch URL or a fetch element inside of Maisel as you're building these.
So you can use it to fetch, uh, a JSON endpoint and then iterate over it, and I think that's what we're gonna do. I could be wrong. Um, I don't want that. I want, um-- Let's see, components. Each-- No, I just want components in general. Um, configuration components?
No, development component. Um, so you can have components in Maisel that's, uh, that are X like that, and you can also... This, look at that. Source equals. And so we can write components in Maisel and say, "Hey, the source lives at alert.html." And so every view component, um, every one of these over here has a corresponding Maisel component.
So that's kinda how, that's kinda how we're gonna sync the two sides together. Let's see where you're at. All right. Uh, all right, let's see what you did. If we come over here, are you-- Um, all right, not a bad start.
Um, okay, good, it doesn't work. Whoo, that was gonna-- I was gonna be like, "Yeah, my job is actually over." Um, okay. Of course, it doesn't work, and that is-- If we're vibe coding, that is not my problem. Um, okay, so let's do this. Since we're vibe coding, it's not my problem that it doesn't work.
I just need, um-- Well, where'd this-- Oh, okay. Here we go. And so now I hop back to Claude, and I said, "I clicked on one of the buttons and got this." Whoops. Um, let's try that again.
Oh, man, and Shift + Enter is not, um... I need to run terminal setup again. Yeah, there we go. Okay. Um, uh, now we gotta give it the context. I'm working in builder.view, which is an email builder.
Uh, on the left side are the, uh, blocks that are available for building emails. I clicked on one of the blocks, and I got this error. Can you fix it? Okay, let's see what that says. Honestly, it looks pretty good. Um, it's off to a pretty good start.
Besides not working at all, it's off to a pretty good start. Um, yeah, that's fine. So it looks like it missed... Yeah, okay. Okay.
All right, let's see if, let's see if that was true. It thinks it's, it's fixed, but, hey-o, look at that. That, frankly, looks pretty good. That's an email builder, folks. Look at that.
Man, it's pretty good, not gonna lie. Um, okay. All right, here's what we're gonna do now. Um, yep, we're gonna leave that guy open. Git net, and then we're gonna open this in GitHub. Add repository, WIP, just so we can go back and fix anything.
All right. Um, this looks like it's off to a pretty good start. I need you to wrap, um, I need you to wrap everything that is not the component type or the block type, I need you to wrap that in an object with the key of props. So the, um, a, a block JSON should look like this.
'Cause I wanna separate, um, I wanna separate the props from everything else 'cause I think I'm gonna s- I think I'm gonna spread the props over the component. So it should look like that.
And that way, I don't know, we can have meta or whatever. Doesn't matter. But I'm just telling it that it should look like that. I don't know if props is the right word. Oh, that's fine though. We are actually-- We're gonna look at the code.
I'm not gonna fully, I'm not gonna fully vibe code this 'cause I can already tell it's doing some weird stuff. Um, like, that's very stupid. Um, okay. There we go. That looks better. Yep, and if I click you, you go away, and I can add multiple of the same type, and it scrolls.
Cool. All right. Yes, that is much better. Now, let's go take a look, 'cause I think it, I think it did something stupid. Um, yeah, look at this. Come on. What are you doing? Yeah, that feels right.
Um, this is, this is actually, this is actually very close. Oh, I need to have it redo all that. Um, can you update everything in builder.vue to use Tailwind instead of using the Vue JS scope styles? And
then, um, it-- the, the stupid thing that it did, which, I mean, it's a machine, so it's not really its fault, um, we shouldn't be, we shouldn't be v-if-ing like this. Where are we? We're in, uh... Yeah, this is the middle column. We shouldn't be v-if-ing. We should be using dynamic, dynamic components.
Um, so we need to clean that up a little bit. Did we get rid of all the styles? We sure did. Yep. It should be identical, and it is. Okay, cool. Um, in builder.vue in the middle column, let's not use, uh, let's not do v-ifs on those components.
Instead, let's use dynamic components, so that anytime we wanna add a new block, all we have to do is, um, add it to some sort of registry somewhere. Okay? And, like, this stuff right here, .vue, which is spelled wrong, and vifs, which is spelled wrong, I don't think it matters at all.
'Cause you know it's not really reading, it's just tokenizing, so I don't think it actually matters. Um, all right. Let's go back to chat, and let's do this. Um, can you write me a detailed prompt for the following setup? I am in a Laravel application, and I want to install Maisel JS, um, and put it in a directory called Maisel.
Inside of, inside of that directory, that's where the package.json should live and all of the Maisel configuration. We need to create, um, we need to create a few components and... Hmm. No, I don't think this is right.
I think that's too far. Nope, nope, nope, nope. I think, uh, add a new block type. Let's take a look and see. First of all, does it still work? It does. We need to add drag and drop here in a second, but that's fine. Does it still work? It does. Um, all right.
This is looking much better. So instead of v-if-ing over it like an idiot, it said, "Let's use dynamic components." That feels much better. Let's go look at one of these components and see, um... I don't want any of these. That's fine. That doesn't matter. Stay focused. Uh, a heading block. How does this look?
Um, okay, so first thing I'm seeing is we are duplicating, we're duplicating this in every... See, look. That's not, that doesn't make any sense. We shouldn't be doing that. And then what does this look like? Local block, watch block, new block. Hmm.
I don't like that at all. Ooh, I definitely don't like that. So the first thing I'm gonna have it do, localblock.text. No, I don't like that style at all. That's fine. Um, okay. So we need to extract a block wrapper. We need to extract a block wrapper that is gonna contain the paragraph and the X, um, and then I need to clean this up.
I don't like this whole local block block. We should just be-- It should just be events and props. We don't need to, we don't need to copy it like that. Um, okay, that's fine. Let's start by saying not spotlight. Can you please create a block wrapper component, um, that handles the X button and the title and a little bit of the UI for each individual block?
You can put that block wrapper at the builder.vue layer, and then each block can become simpler in that it doesn't need the heading, and it doesn't need the red X to clear it out. Okay. Can you please install, um-- Can
you please create a new Maisel.js project and put it in the Maisel directory which does not yet exist? Gotta make sure. I, I think it would find it, but let's just go ahead and make sure that that is spelled right.
Put it in the mailzyl. Boy, it's kind of a tough one to spell, isn't it? Yeah. Okay. Um, all right, that's looking like it's getting simpler. Okay, that's still working.
NPM install mailzyl CLI. Eh. Meh. Fine. Create a new Mailzyl project in the Mailzyl directory. Uh, mailzyl new mailzyl.
Yep, that seems right. Great, I love this. It's gotta figure it out itself. Template basic. Uh, NPX create template basic. Yeah, that seems fine. Oh, it's interactive. Um, no.
Let's just do it ourselves. Uh, NPX Mailzyl. What did, what did it wanna run? Let's just check the docs. Ooh, this is not vibing. I'm checking the docs. What am I doing? Um, NPX create Mailzyl. So it's an interactive thing. NPX create Mailzyl.
Uh, yep, that's good. No. Yes, that's good. Default. Yes. Okay. That is still... That is still cooking.
All right, so if we check now, let me check the Mailzyl directory. Cool. We've got a whole, uh, we've got a whole Mailzyl project there, and so if I run, uh, I probably need to CD into Mailzyl and run NPM run dev. I bet that's gonna give me a URL. And boom, there's an email.
God, it's a good-looking email, isn't it? I didn't write it. It's a good-looking email, though. Um, okay, cool. So we have our email builder working now. That's our email builder. So if I come back and take a look at emails, transactional, you can see it, um, it uses safe email stuff, right?
And the nice thing is, like, look at this. Uh, let's look at this, "We're happy to have you on board." M0MB6, okay? Remember this. M0MB6. And we go to the browser, and we reopen that. "We're happy to have you on board." Inspect element, and M0MB6.
Now, if we run, if we stop this, we do NPM run prod. I think it's NPM run build in the Mailzyl directory, and then we come back in here, build production, transactional, and I think it was, like, happy was the word. Now look at that. There's no MB0.
There's no whatever. It's all been inlined. Everything has been turned into inline styles, which, you know, is very different than Tailwind. I know that the Internet wants, wants you to believe they're the same thing, but these are very different. So this has all been inlined. Um, it's done a bunch of wonky stuff up here, like it's added a few other things with importance.
It's done, like, all of this weird stuff. So this is email, right? We've got tables, which we haven't seen in a long time. Um, this is why we're using Mailzyl, because I ain't writing all that. Let's check Claude. Block wrapper. All right, says it's finished. If we check this.
Wake up. Uh, GitHub logo dark. Who, who needs GitHub logo dark? Email resources. Um, Vite CSS analysis. Hmm, what's going on here? Let's see.
Um... I don't feel like... I don't feel like anything should've changed. Okay. Here's the trick.
We'll stop it, clear it, make sure nobody else is running. NPM run dev. Huh. That worked, and that worked. Thanks, JavaScript. So that all looks nice. Now, did it actually... If we go back to the builder, block wrapper, and we open block wrapper.
Hey, that does look better. So then if we were to make this just a little bit tighter. Yeah, it fixes it on all blocks. Okay, good. Here's the thing. This is, I mean, this kinda counts as vibe coding, 'cause I'm not really writing much of the code, but I'm still going in at each step and being like, "No, this sucks.
Do it better." Because I think as we go, uh, I think as we go, that's- That's gonna help us. Like, that's gonna serve us in the long run if we can, uh, keep it as clean as possible as we're vibing. So maybe it's not pure vibe coding. Uh, maybe we can call this, uh, vibe pairing, because this is being my pair programmer.
But either way, I feel pretty confident with this, so let's keep going. All right, we're gonna try something, uh, we're gonna try something a little complicated here. We've spent 86 cents so far. It's a brave new world. Um, all right. Let's try this. In builder.view, you will find a three-column layout.
Um, in the middle column, that's where we add all of the blocks for the email that we're currently building. I would like, um, I would like those to be sortable by dragging. So whenever a user clicks on the, uh, block wrapper on, on the header part, we should start dragging, and we should show a bright blue indicator for the, um, the drag or, or I guess the drop indicator.
So a person can pick up a block and drag it into a different position, and a blue indicator will show, uh, the user where they're about to drop it. And then we need to reorder the blocks in the view component. Man, if there's one thing I don't wanna write, it's, uh, it's drag and drop.
So hopefully, hopefully this will work, um, 'cause drag and drop is a freaking nightmare. Now, I am going to un-vibe code something right here. So we'll do route get, um, preview. We'll do route any. It's gonna be, it's gonna be a route post at, at some point.
Uh, is that right? Yeah, it's gonna be a route post at some point, but sometimes in development, I just do a route preview. And so what we're gonna do here is we need to, um, receive, receive the blocks from the front end, um, and then we...
Come on, do something better. We need to, uh, shell out to Mazl.js, run, um... Boy, I guess, I guess we really could pass those blocks through. I mean, why not? Yeah, let's pass the blocks through.
Um, so we're gonna run in, uh, let's run Mazl, I think is our directory name, build.js, which doesn't exist. Um, and we're gonna save Mazl to dictionary with, um, blocks equal and then JSON encoded blocks.
Uh, I don't know if it's JSON encoded or not. Um, and we're gonna say that blocks is equal to request, which I can pipe in here. Nope, wrong one. Request, uh, request, request, um, I'll just do input blocks.
Um, and we want to use the process facade to run that, then get the output from the process and return it as an HTML response. All right. Junie. Junie's turn.
All right. Um, can you complete the to-dos in this, uh, it's a file. Focus up, Aaron. It's a file. Um, all right. To-do. Close enough. Let's run that bad boy. All right. While he or she is working, I guess Junie. Junie?
Junie. That's, uh, probably a woman's name. Um, yes, don't ask me again. So, doo, doo, doo, doo, doo, that is, um, that is running. I gotta make sure I'm still, I'm still recording here. Um, I'm pretty sure I'm recording. That would be a real bummer.
Hey, we're still recording. God, can you imagine? All right. So it is adding the draggable functionality, drag and drop. Okay. Do we want to have anybody-- How about we do this? Why don't we ask chat? Um, why am I typing?
This is, this isn't 2024. Can you please write me a Mazl.js component for a header? The props are text and size, and the size could be H1, 2, 3, 4, 5, or 6.
And you can use Tailwind because Mazl uses Tailwind, but if, uh, if there's anything email safe you need to do in the markup or the CSS, please take that into consideration. Okay. That looks...
That doesn't look right. I don't know if Mazl has... What do you need? Um, sure. NPM run dev is already running. I don't know if Mazl has liquid tags like that. Expressions, maybe?
No. Layouts, templates, components, expressions. Yeah, it doesn't have liquid tags. Those are liquid tags. Maisel doesn't support liquid tags. Please go read the documentation if you need to. Turn on search and paste the docs.
Let's do this. Let's use the big dog. You're absolutely right. I hate it when it does that. Um, we're gonna yoink you, and we're gonna paste you right there. Okay. It seems to think drag and drop is good, but in fact, I think we've got two dev servers running now.
Cost us a wicked twenty-four cents. All right. Um, make sure that this is-- Yep, Veet is not running. Hmm. I'm not sure that that worked.
In fact, I am sure that that didn't work. Um, okay, so let's go back. All right, that didn't work, so let's go back to Claude and say, "In builder.view, you will find, uh, a set of components in the middle column that we're supposed to be able to drag and drop. There are a couple of problems that I need you to diagnose.
The first is I don't ever see any drop indicators. I'm-- Uh, when I click on the header, I see that I'm able to drag, um, but it doesn't seem like the drop is working. Can you make sure that the drop zone is on the entire container, and then we're calculating where it should be dropped based on, um, I guess the user's mouse position?
Uh, and then the other issue is I want to drag-- When I, when I start dragging, I want the entire element. Right now I just have the header as the ghost element, but I want the entire element as the, uh, the ghost element." Okay, we'll let that cook. And then I think Junie is done.
Cool. Let's, uh-- That's fine. Let's just accept this. We are not going to-- I'll do that myself, make the build executable. We can import. We can simplify that. Process failed. Failed to build email. That's fine.
Um, I kinda just wanna return some HTML that can display. Let's-- Yeah, I know that, uh, this is super bad API-ing, but, uh, let's do it like this. We're gonna just-- Because I just wanna throw this into-- Do you need something? I just wanna throw this into this right-hand panel over here that says like, "Failed to render." I know I could catch an error, but hey, let's vibe, let's vibe
a little bit. Um, so we'll say, uh, "Failed to render." Um, that's fine. Who cares? So if, uh-- All right, we're gonna get the blocks from the front end. I do-- It, it's JSON encoding them. Um, so that's fine with me. Uh, but we don't need to rename it, just overwrite it.
That's fine. All right, use the process facade. Yeah, I don't need your comments. Um, yeah, timeout. We'll make it a sixty-second timeout. If it failed, return that. Yeah, I'm not actually the, um-- No, none of this is right.
HTML is actually going to be, uh, process get process output, so we don't need that. We don't need your comment. All right. Well, that just got a lot simpler. So, uh, base path is Maisel. That's correct. We need build.js, which doesn't exist yet, um, and blocks.
Do you need anything? Uh, all right. This says, this says it worked, so we'll see. Um, so we need to go create build.js. Failed to render. Preview. We can simplify you. Okay. You say that you fixed that. Do I believe you?
Well, maybe. So let's see. Um, well, well, there's an-- there's, there's something. Hey. I mean, because of my recording resolution, we don't have a lot of space here, um, but I think that's working.
So if I say that one's ASDF, this one's QWER, and this one's one two. Now if I bring you, it's a little... Look at that. It's, um, it sure is jittery, isn't it?
Why, why do we think that that is so jittery? That's closer. Um, let's give it a little bit of positive encouragement here. I think that that mostly worked, but there are a few things I want to refine. If I hold the dragged element in the same position, I notice that the, uh, bright blue indicator bounces, like it's, um-- it shows that it's a
viable drop target, and then it disappears, and then it comes back, and then it disappears. So I think we need to make sure that we are-- we have the, um, the drop zone is like the entire... not the, not the individual blocks, but the entire middle part of the column. We also don't need to add a ring indicator around, um, around the blocks that are underneath the drag.
We only need that bright blue line that shows which two blocks it will fall between. We, we don't need, we don't need to highlight the block that we're currently dragging on top of. So if you could make the, uh, drop zone a little more robust, and then if you could remove the ring, uh, underneath the dragged element, that would be good.
Hmm. Hmm, okay, cool. I got it. Um, all right. Now, Cloud, listen here. What we are going to do, um... So Mazl has, um, Mazl has a development server, and then you can build it, of course, by running npm run build.
But what I wanna do is I don't wanna do any of that. I wanna use the API. Look, you can render it, and then you can dump out the HTML. You better believe it, my dude. That is exactly what we wanna do. All right. Let's tell Cloud, in this directory, you will find a directory called Mazl.
Uh, that is the place that we're gonna build our emails. In the Mazl directory, I want you to create a new file called build.js, and we're gonna use the Mazl API instead of the Mazl CLI to render an email. Here are the docs for the Mazl API.
I want you to read these first. Um, there are the docs. The structure of the build.js should be, um, it will be run via command line, and it should accept, it should accept, uh, one argument, and that argument is, um, named build.
So maybe it's actually a f- uh, an option, but the, the option will be dash, dash... Nope. That was all wrong. Cancel recording. The structure of build.js is, um, it should be run from the command line, so we need to make it executable, and it'll just be run by saying, uh, node build.js.
And it will accept, uh, one option called blocks, and that's going to be a JSON encoded, uh, array. When you receive that array, I want you to parse it into JSON. And then what?
And we're gonna pass that through to, um, we're gonna pass that through to Mazl. Oof. I'm losing it. I'm losing it. Uh, what, what are we gonna do with that? Where are we gonna put that? Oh, we can put it as, um... I think we can put it as page level.
Yeah. Yeah, yeah, yeah, yeah, yeah, yeah. So we're gonna pass it through to the configuration, uh, through to Mazl via the configuration as a page level prop named components. Ugh. That is, uh, that was a, that's a big prompt. Um, okay, let's see.
Can you fetch that? Yes. I told you that you could. Um, okay. Now, changes made. One drop zone in middle column. Yeah, that's what I told you. Uh, removed ring indicators, mouse position. I think I told you to do that the first time, but hey, you're still learning, big guy. All right. Let's do a couple of short ones.
Well, that looks a lot better. Yeah, that looks a whole lot better. Let's add one refinement here. That looks so much better. Good job. Um, the only refinement that I wanna make is let's, in fact, um, let's in fact have the drop border always present, but only, um, only turn the opacity to one hundred when it's active.
Because right now, the drop zone indicator is causing a layout shift. So let's go ahead and, um, leave that element present, but leave the opacity at zero unless it is the active drop indicator. Okay. I think that will be a good fix for that.
This is kinda fun. I kinda like vibe coding. I don't know if this is vibe coding. Is this vibe coding? It feels like vibe coding. I feel vibey about it, um, so maybe it's vibe coding. All right. How are you doing? You probably need some, uh, permissions.
Okay. Yep. So now, these are awfully big. We actually need to change that formatting a little bit. That's better. I wish it were, I wish it were centered. I don't know why it's not centered. I feel like that's a me thing. I could probably fix that. Cool. I dig.
Um, all right. What are you up to? Uh, yep, that's fine. Yeah, just the swans, honestly. Um, okay. This is pretty good. Um, how about this?
Why don't we do this? Uh, for the element that is being dragged, can you put a transform scale .95 on it, so that when we pick it up, the, um, the ghost that's left behind gets a little smaller? That might look cool.
Does it look cool? I think it looks cool. Does it look cool or does it look stupid? I think it looks stupid. That's what we call an oopsy-doopsy. So let's go to builder, uh, look for .95.
Where do we think that was put? That was put in builder... Oh, scale .95. Scale 95. Yep. You know, it was a good try. Okay. Yeah, that feels better.
Okay, cool. Let's go check out, um, let's go check out the build.js. D- what did you say about this? Did you say we're all good here? Executable, blocks, Maisel's render, page level props, error handling. Um, okay, cool.
Um, in fact, let's just take that and, um, hey, why not? Can you go ahead and run and see if it works and diagnose any errors if it didn't work? Mm.
CD into Maisel run. Yes. Oh, wow, it looks like it spat out a, an email. Yeah, that's right, it's not being used at all. Yep.
Yep. This is actually... Ugh. See, it's doing this thing again, which I think is very stupid. Um, but that's fine. This is close. So, um, it spat out an email. We can run it ourselves. We can run, uh, node, let's see, Maisel build. Oh, I gotta get the blocks too, don't I?
Mm-hmm. Oh, that's interesting. Why didn't it work for me? All right. Well, let's go look. Build, what did you do? Yeah, I don't actually-- I don't care about that.
What did you import? Cool. Those all seem reasonable. Blocks. Yep, needs a block. Let blocks. Yep. Read transactional. Um, we're gonna make a new email called dynamic. Yeah, don't ask again. That's fine.
We're gonna get rid of the front matter and, hey. So now if we change this to dynamic and we try... Oh, I bet CD into Maisel, NPM run.
No. I bet it's all relative. I bet that's why. Build. Oh, Aaron. Let's just come back here. There we go. There's our hey. Uh, yep, there's our hey. Cool. All right. Load the base config.
Um, that might be helpful. Or, you know what? Um, I think we'll just, we'll build our own config. Console log, result HTML. This, honestly, that worked pretty well. Um, okay, so we don't need that.
We don't need that. We don't need that. Okay. So process exit one will alert us that it did not work. And then... Okay, so what we need to do now is we need to, um- Let's do this. We're just gonna short-circuit this for a second, then we're gonna come back to, uh, doo, doo, doo, doo, doo.
We're gonna come in here, and we're gonna say that blocks is actually equal to this. We're gonna have a type of, um, heading with a props of, uh, text is, "This is a heading," and a size of H1. Okay.
So this will put us into the Mazl one, timeout of 60. It'll build it, and it should return. So if we hit this in the browser, that's why I made this an any, so I could, uh, instead of a post, so I could test it. What are we calling this? Email.test. And what did I call that? Preview? Failed to render. Why?
Um, process output. Output is nothing. Error output. Node, no such file or directory. Base path Mazl. Uh, what am I doing?
I'm, I'm coding when I should be vibing. Um, I tried to run this. You know what? Should I just put node there? Uncaught token import.
What? What's going on? Build.js. Node build.js. Okay, so it works in both. Um, all right, let's just...
There we go. I tried to run this and got this error. All right, so while that is running, I actually kinda wanna see what it thinks is the problem here.
It's probably not available in the path. Um, yeah, that's why, 'cause we're using a, a goofy node. Um, Herd, Herd lets you set up, um, Herd lets you set up Node per project, and so it does these alias things.
Um, so yeah, we'll see what, we'll see what it figures out. We need to figure out components. So here's a button component. Th- these shipped, these shipped with Mazl. Um, so I didn't write any of these. But we need to add a, let's just take the button, and we need to add a header.
I think I called it heading component. Um, and did I have... Yeah, I think I did. No. Why would you import React from React? Why would you do that? Um, don't use React. This is a vanilla JavaScript, uh, component for Mazl.
I will paste the docs in so that you can go read them so you can understand it better. It's a little shade. Throwing a little shade there 'cause that is, uh, a little bit frustrating. Don't use React, come on. Okay, Junie, what did you say?
You put Node. Yeah, um, let's make the node path configurable, uh, through an ENV variable so that I can set, uh, the full path to Node because it's not available where we might think it is.
I don't know. Okay, so that's gonna make that. Yes, you can get out of here. God, why does it continue to do switches instead of make something that's, like, truly dynamic? Um, that's fine. We'll take it, and we'll do it better. So heading, you're the heading now.
Font family? No, forget that. Uh, uh, all right. Uh, we're gonna just take H1, and we're going to make it dynamic. Email safe styles. Yeah.
In fact, that's kinda the whole point of, it's kinda the whole point of Mazl is that it does that for us. Okay. So Mazl is gonna inline all of that. And we're gonna say, "Size is props.size or H1." So I think what we can do is just
put size there I think we can do that. Now, if we were to come back to dynamic and we were to put, um, component. Oh, it thinks-- Yeah, it thinks you're done. That's fine. If we were to put component source equals, uh, components heading, componentsheading.html, where the text
equals hi there, and the size equals, let's make it an H2. Uh, we can do self-closing. Now, if we were to run our old... Actually, let's just get rid of the wrapper altogether, so we can see this more clearly. Oh, yeah.
Blocks equals nothing. Um, what's wrong with that? Why didn't that work? That's fine. Hey, son of a gun.
That worked. Now, I'm curious why we're not getting inline styles. Um, but that's okay. We're not, we're not there yet. Yep, you're dead to me. Um, I think you fixed node path, node path.
Mm, you're not really supposed to read from the ENV here. Um, app.php. This is what I don't get about vibe coding, if I may. Um, you're not supposed to read from the ENV. And how, like, if I didn't know that, I would've just let it go, and then it would've broken later.
You're supposed to put it into the configuration, um, and read it out of the config. Uh, config app.nodepath, which then means we can just do that.
Um, and where was it? Which node? Yoink. Node path equals... Okay. So what do you become now? Do you become the correct node build blocks?
Cool. So I think we can go back to doing it out here. Ah, F. Um. Oh, that just really crashed. Cool.
See, but why does it think that we didn't pass in, why does it think we didn't pass in the blocks? Um, maybe this is a question for the vibes. 'Cause boy, that looks like blocks to me, doesn't it? So if I go to build.
Not args block. Console.log, uh, args. Maybe I should just let the vibes take over. Yeah, let's do this.
Um let's ask our friend. Do we have any clouds running? No. All right, um, I'm trying to execute the build.js from the, uh, from the web, and I'm getting an error that I don't fully understand about the usage of build.js.
You can, uh, hit this URL, and you should see, um, you should see the error come back, uh, because I put a DD in the web.php. But I'd like you to diagnose this and fix it for me. Okay, you can hit this URL.
There we go. All right, let's see what cloud has to say about the situation. Uh, yes, that's fine. Yeah, it's not HTTPS. I see the issue. I feel like
this is somehow a red herring. Huh, maybe not. Maybe it fixed it. Ooh, this is one where I'm just like, "Yeah, I don't care. Whatever you got, w- like if you fixed it, you fixed it." Um, oh.
Oh, oh, oh. Blocks equal blocks. Huh, that's interesting. Very interesting. Hi there. So we are now previewing emails. Now, the question is- Um, what does Maisel's production...
Yeah, that's what I want. I want those things. Um, okay. So I want those to be inlined, so we're gonna come down here to the config.default, and we're just gonna start doing it like this. Yeah, I don't actually want to import. I'm just gonna, uh, I'm just gonna inline. So if I run this again, and I inspect you, sure didn't
work. Um, I wonder why, I wonder why. Am I reading this wrong? I should, I should make chat do it. But let's see. I just wanna learn real fast. Um, CSS. Oh, I just- I'm just gonna yoink that. That's exactly what I'm gonna do.
You, you're mine. And we'll come over here. And locals, I need to keep... Actually, I told it that that should be a page-level thing, so it did that wrong. Um, and we need the Tailwind preset email, email preset.
Okay. So I think what we've just done, and the proof will be in the pudding, I think what we've just done is... Oh, I need to figure out how I'm gonna do, uh... I still need to figure that out. I need to figure out how I'm gonna tell Tailwind which tokens to preserve. Tell Tailwind which tokens to preserve.
Wrong one. So now if I check... Still, hmm. That's curious to me. CSS inline. Mm-mm-mm.
Um, all right. Off to chat we go. In builder.js, I'm trying to run, uh, the render function such that it will inline all of the CSS. Oh, I know exactly what the problem is. Um, I didn't put Tailwind in there at all.
That's the problem. Okay. That was very silly of me. Because I changed this to just be that, it has no idea what CSS I'm trying to use, so I need to do it like this. Now, if we...
Yeah, something changed. Okay. Here's what we've learned. Um, we need to... All our styles are getting purged. That's what we've learned. Everything's getting purged, um, so we need to add content.
But I don't wanna do it like that. So where is content? We'll take you, and we'll come back to our build script, and content. Now, this is gonna be close, but this is not going to be right. Um, so let's go ahead and do this.
Emails. Emails and templates. No, emails and components and layouts. So we need, uh, components and layouts. Um, okay.
So the problem is Tailwind was purging, Tailwind was purging everything. Boom. We've got mother freaking email rendering happening. Um, okay. We're getting closer. Now, what does our H1...
Yep, yep, yep. Now, if I were to add... Here's something. If I were to add a class of, um, text red 100, which you can imagine, let's make it a little darker. You can imagine that would be a thing. Yeah, exactly. Because look, it totally got purged because this token of text red 100 exists nowhere, because we're piping it in.
In fact, we didn't even class equals, um... We're not actually using the real stuff yet. That's the big problem. I think it's just props equals... I don't know, frankly. I have no idea. Um, components is blocks. What if I just put, uh, page.components out?
Cool. All right. Let's do this for real now. Um, okay. There is a, in the expressions, tags maybe, loops, each. All right. Do I want-- I think I just wanna do this one myself.
For each in page.components, we don't need the index. For each component in page.components, the source is going to be... What is the source going to be? Uh, type? Sure. Um, component.type.
Which is a little wonky, but that's fine. We'll, we'll figure this out later. Um, all right, so that is heading.html, and then I think you can just do props equals component.props. Maybe?
Okay. So what do we think? Oh, I bet we don't have, in the heading, I bet we don't have any... Well, we do have some text. Hmm. The text is not being... props.text.
So I feel like that should be there. Do you see the problem? Because I don't. props.text. All right. Should we ask chat? I think we probably should. Did the size get applied? And if we change the size from the web, does it get changed?
No, it doesn't get changed at all. Is props not right? For components, props, props, props. So you can just pass.
Oh, I'm just passing a string like a big old dummy. Okay. Needs to be... Hey, there we go. Hey, and that's actually all coming from-- I feel like that, uh, H6 is way too big. Is that an H6? Yeah, I mean, it is.
Cool. We got dynamic rendering. Um, I feel like... Oh, classes.h1, that's why. Classes dot, uh, what did we say? Size maybe? There we go. Cool.
This rules. Now, if we go, uh, back to the web, and we say, "Actually, let's make this an H1, and actually, this is a red heading," it's not going to work, okay? And I know the reason, 'cause this token, which is what I was trying to show you earlier, doesn't show up anywhere. If I were to put this token in the HTML and then refresh it, it doesn't get purged, but I can't hard code all those
tokens. So what we can do-- This isn't vibing at all. This is just straight up coding content. Um, it is possible, it is possible to add a, it is possible to add a, uh, raw of JSON.stringify the blocks, and we'll just lie and say that it's HTML.
God, why does it keep-- I don't want it to be compressed like that. So now, boom. I'm the smartest man alive. Look at that. So now, um... Well, I didn't mean to do that, so I'm not that smart. Now, we're looking in all of the, uh, all of the templates and any of the incoming blocks for tokens that might be important for
Tailwind. And if we inspect this, look at that, not a Tailwind class in sight, and we have a full-on freaking email. That's pretty good. Now, at this point, it, it, it truly is just a mere matter of programming, um, which is to say, I feel like all the hard parts are figured out.
Um, mere matter of programming is a, is a term of art, uh, once you're kinda over the hill. So let's make chat do it. I mean, that's what we're here for. So I'm gonna, I'm gonna delete these hard-coded blocks. Um, yep, that's fine. That's fine.
That's fine. Now, we can go back to builder.vue, um, and we can say this. In builder.vue, um, instead of showing the JSON debugger on the right-hand panel, um, I want you to, uh, show the email preview.
You will get the email preview by requesting email.test/preview. You can use, uh, Axios to make a POST request to email.test/preview. You should pass the JSON blocks along, uh, under a key called blocks.
The response should be an HTML document, which I want you to put into the right-hand panel using v-html, and also throw a, uh, throw a pre on it or a v-once or whatever, so that Vue does not, uh, walk that DOM tree at all, 'cause there will be no reactive, uh, content in that DOM tree.
All right, let's see if it can do it. Now, we haven't written, um, we haven't written enough components, so we haven't written components that match up with, like, paragraph, which-- Let's just do paragraph.
Why not? Um, paragraph. Honestly, I don't, I don't think there's anything in paragraph besides text. Um, so let's just do this. Um, now, we may add, like... Honestly, I, I could probably add classes. I could make class, like, a generic thing that any...
I don't know. We'll see. Um, that's good enough for now. So we have heading and paragraph, and I think, um, build the view assets. Um, I'm already running npm run dev. Wow, okay.
Um, let's see if it works. Add some blocks to see. Let's watch. Let's clear you out. All right, so no problems yet. Network, XHR, preview, response.
Uh, I mean, that looks like test. So we need to debounce it 'cause it's, it is, it is kinda slow. Um, why is it only showing T is my question. What are we sending?
Um, we're sending it, and it's coming back. Why is it not showing up in the preview? That's kinda cool regardless. Oh, I bet... Oh, that's interesting.
I bet it's yoinking. I bet it's freaking out because it sends back, it sends back an entire, uh, HTML. So network, response, doc type HTML.
Hmm. Okay. Um, yeah, that seems bad. The response from this endpoint is an entirely new HTML document. Do we need to put this inside of, like, uh, an iframe or something?
Here is a sample response. I think that's what's going on, is you can't have two, you can't have two, uh, HTML elements. So I wonder if it's just gonna, like-- There you go.
It's gonna, it's gonna hard code the HTML. All right. Yeah. Let's see if that works. So add a heading. Hey, that's a email, dog. Look at that. Wah, wah.
That's not an email. What the heck? Oh, that was so cool. What, what, what, what? It, it, it's just, it works. Um. All right, back to chat.
It worked the first time, which was pretty cool. Uh, but after we got new content on, uh, subsequent requests, it didn't work anymore. So can you fix that? I love just being like, "Uh, I don't know what happened.
Can you just fix that?" Ah, cool. There you go. Okay. ASDF quer, and then H1?
Oh, man. That's too bad. Maybe we just need it to destroy... 'Cause it's coming back correct. That's too bad. Yes, why don't you destroy the iframe, uh, or whatever your backup solution is?
'Cause it still doesn't work reliably. Yeah.
Well, it's not gonna be as performant, but the whole thing's not terribly performant 'cause we're calling out to Node anyway. Um, all right, so add a heading. Test. There we go. And the thing that I love about this is that is the actual-- We're not like, we're not like rendering it client side and promising that it's gonna look good in email.
That is it. That is what it's gonna look like. Um, now, did paragraph... Paragraph worked, just worked right out of the box. Um, one interesting thing we could do, this is interesting, isn't it? Is we could, maybe, maybe we'll save this for later.
We could intercept this and, um, make this markdown. Actually, I wonder if, um, I wonder if Mailzel has any... No way. No way. Um, all right.
What do you do? All right, so if I did that, and then I did that, and then I did, hey. No way. I think that's what I really-- I think that's what I'm after.
Because honestly, this is no longer, uh, it's no longer a paragraph, frankly. Yeah. See, look, it's, it's creating paragraphs. So let's do this. Um, we're gonna, we're just gonna drop you, and we're gonna pull you back that way, and we're gonna rename you to be Markdown. And then we need, we need to look at Builder.
Boy, we haven't looked at Builder in a minute, have we? Um, paragraph. Label paragraph. Course promo. This is pretty clean. It's got one central registry, which is what I was after. Yeah, this isn't bad, frankly. Um, but we're gonna change you to Markdown, and you can remain paragraph, and we're gonna change you to Markdown, and that's fine.
Cool. Markdown. Um, this is a test https://example.com. Holy moly. This mother freaking rules.
Um, let's do this. Um, can you add a two hundred millisecond debounce on requesting the preview endpoint? Don't pull in Lodash or anything, just write a simple debounce function yourself. Uh, you can put it in a utils folder or file and import it, but, uh, write the function yourself.
This is awesome. So now we can, um... I mean, now I feel like we're, we're done, frankly. You could watch me write all the blocks to make sure that, you know, we can do it, but I think honestly, we're, we're pretty close to done.
Debounce, yep. We need to do, um, I need to do-- We need to do a copy HTML, um, so that we can copy the HTML of this email. Mm-hmm.
So now if I add a markdown, it's gonna show me that. I should probably have a default there, but that's okay. And then if I did test one, two, three, four, five, six, seven, eight, nine, ten. I feel like that debounce didn't work super well.
Um, where did you put that? Resources, JS, utils, debounce. Debounce. Just freaking, that's its freaking type. I don't want types. I want, um, resources, JS, utils, debounce.
Clear timeout. I think this is just like, I mean, I think this is just standard debounce. Is this a standard debounce? I want it to apply on the trailing edge. No, don't search the web.
That's fine. No, I don't need more control. No. All right. That's fine. It works. Um, all right. We need to ask chat. Can you add a button below the email preview, uh, to copy the HTML, the entirety of the iframe source, and
add that to my clipboard when I click on the button? I think this is one of the last things we need to do. I wanna test reordering. Um. I'll just give this a second to complete. There's that. This is really cool. Um, I'm actually, I'm actually pretty freaking pumped about this.
Um, this is gonna make my life a lot easier. The tweet and the YouTube, uh, and the course promo, those are gonna be a little bit harder blocks to do, um, 'cause I'm gonna have to build out on the m- on the Maisel side, I'm gonna have to build out a lot more, um, because I'm gonna have to go, I'm gonna have to go fetch stuff. Um, and maybe, maybe we'll pick that up here in a second.
Maybe that would be a good thing to do. Um, all right. So let's just fully refresh. We'll do a heading and a markdown, and we'll say, um, "Welcome to my newsletter." I feel like we could do a 500 second, 500 millisecond debounce. This is the body.
Now, if I take you and I move you up, boy howdy, that is an email editor. That's an email editor. We've, we've gone and done it. So if I copy this HTML, and we do, uh, HTML.
I mean, what, what, what, what more do you want from me? Um, let's take this layout. Should probably just add all of that stuff, 'cause I, I bet, I bet Maisel knows what they're doing. Um, so what we're gonna do is we're gonna take our dynamic, and instead of doing that ourselves, we're just gonna do x-main, and we're gonna take the layout that
Maisel came with. Okay. So now if I, heading of, "Hey y'all," and then I copy that HTML and I come out to... No, let's go to an HTML. Yeah, there you go. I mean, what even is that?
That, that's why, that's why we're using Maisel, because what in the world is that? I have no clue what that could possibly even mean. Office document settings. Setting up, uh, pixels per inch for a, for a screen display. We're not printing it. Please don't print emails.
Consider the environment. Um, and then we got some-- That seems wrong. Oh, I bet I-- when I pasted this in, it did that. Yeah, there you go. That's fine. Um, okay, cool. Y'all, we got an email builder. We got an email builder.
This is pretty cool, I must admit. Um, you just watched me do the entire thing. This is what I can use to build my, my newsletters now. Um, so I will go in, I'll go in and update. I'll do one for you. I'll, I'll go in and do the YouTube one for you, um, just so you can see, uh, I guess, theoretically, how we're gonna do these rich blocks.
Um, so I'll just do that one YouTube one, and then I'll implement the Twitter one and the course promo one. I'll implement that behind the scenes. But let's go ahead and do the YouTube one. But before we get into the augmentation, I wanna revisit this just for a second because, yeah, we know what you look like. Um, I think we can make this a lot better and probably a lot faster by turning this into a server.
So instead of, uh, having to boot up Node each time, we're just gonna call out to Maisel and return the response back just like that. So let's get that started. Let's go to, um, Claude and say, "In Maisel/build.js, we are, uh, we're calling this command via the command line.
I want you to create me a server.js where, uh, the server receives the JSON-encoded blocks as a part of a POST request. Make it a Fastify server and add to the package.json, um, a script to run it, and, uh, use nodemon to restart the server anytime there are changes." I
think that's it. I think that is what we want to do. Node.mon. Yeah, they'll, they'll figure that out. Um, and Maisel being misspelled, they'll, they'll figure that out too. Uh, yep, yep, yep. All right, so while you're cooking, we're gonna come back over here, and I've deleted all of that code that calls out to, um, to Node, and we're just going to-- we're gonna tell Junie to remake it.
In this preview route, I want you to use Laravel's HTTP facade to post to localhost 5199, um, and pass the blocks through as a JSON object under the key blocks, and return the HTML response from localhost out to the browser.
I don't know if that was terribly clear, but Uh, they'll figure it out. I bet you need some help. Yes, that's fine. Um, we're gonna have to change this to 5199. Or what did I say over here? 5199, yeah.
Cool. All right, so that is working. The server's being created, and so this will allow, um, this will allow us to keep this running all the time. Now, your question might be, why don't you just do it like that? That-- Boy, that seems a lot easier, right? Just go straight from the front end out to the renderer instead of going through the Laravel application.
I agree, that is a lot easier. However, all of the good stuff is contained in here. So this is where all of my videos, my articles, um, I do scrape tweets to get all the data out of there. That's where all of this information lives, and so we're gonna add a set of augmentors. Uh, so we're actually gonna-- Let's delete this, and we'll say, come into Laravel application, and it is going to, uh, augment,
augment the blocks, and then, then we'll send it out to Maisel and back. So that allows me to say, like, have an article, uh, like an article preview block, and then when it comes into the Laravel application, I can look up the article, grab the title, maybe the first, like, paragraph, maybe the image, and then pass that through to Maisel.
So we're gonna do a lot of interesting stuff here, um, and I think the first one, maybe the only one that I'll show you, is the YouTube block, and what we're gonna do there is we're gonna fetch the, uh, fetch the poster image or, like, the, the thumbnail. Um, okay, so that is good. Are you claiming you're done? I mean, yeah, I guess that's it.
I guess I don't-- Yeah, that's fine. Um, all right. So let's see what you did. 3001 and slash build. So slash build is correct. Let's go to server, find 3001, and change it to, I think we made up 5199, and we'll change you to 5199.
And all right, we have a health check. That's good. Let us start with the health check. So we need to CD into Maisel. CD into Maisel, npm install. Okay. And then what did we call it? npm run server. npm run server. Okay. And we can hit 5199 on health.
Cool. Nice. It wrote a health check for me. That's pretty cool. Now, if we come back to, uh, web, we should be, we should be all good here. Um, this is where we're going to augment blocks based on type, but we don't need to do that right now.
Um, all right. So that kind of worked. Uh, let's put out the, um-- I just want to, um... Okay. Let's modify the... Well, I actually don't know.
Error message. Yeah, let's just, um... Okay. Response is that if response dot-- Not dot. If response successful, return response, uh, HTML. Is that real, or did, did somebody just hallucinate? Somebody hallucinated that.
Response, uh, response JSON, and we wanna grab the HTML. I think that should be better. So then if I were to actually-- I don't know, we can go back to the builder maybe. Add a heading, test.
Hey, look at that. We're back. And that feels much faster to me already. I don't like how it, it bounces around. Uh, I wonder if we could change the debounce. Where is debounce? Debounce. Yep. What do you do? Debounce 200.
I mean, let's just change it to, like, fifty milliseconds and see what happens. That looks pretty great. Um, this I don't-- Here's what I don't like. In builder.view, while we are loading the new email preview, can we just keep the existing preview visible, but maybe change the opacity to, like, seventy-five
instead of, um, instead of showing the generating preview text? Because that's causing the, uh, that's causing the UI to jump around a little bit. I love that I can say builder.view, and it, it just-- Because it's not actually reading text, it's, like, making
tokens or whatever, it just kinda figures all that stuff out. I super like that. Uh, we need to figure out-- We need to augment. So let's augment, let's just augment YouTube only. Um, kinda wanna see this work though. Uh, then we're gonna augment YouTube only, and then that will show us how we can augment everything else going forward.
So if we add a heading. Boy, that just is like, might as well be instant, huh? That is really cool. And then if I did, hey baby.
Look at that. Bold text, markdown, super fast rendering. Um, this UI is a little janky, but we could be forgiven for that. And this is freaking great. All right, let's add, um, let's add YouTube.
Oh, that's interesting. What is your problem? Oh, we don't, we don't have that component yet. Not your problem. That's my problem. Yep. All right, so here's what we're gonna do. Um, YouTube.html.
YouTube, that's barely English. Cool. Um, all right, so let's do this. Let's go to, um, let's go to YouTube Studio, and we're gonna grab a very good video. We're gonna grab this video right here.
Okay, so if we put that in, hmm, we need to, we need to start augmenting. So if we come to web, um, okay. If we DD the blocks, let's see.
Yep, yep, yep, yep. So the type is YouTube. Okay. Here's what we're gonna do. We are going to say, in web.php in /preview, uh, we're accepting the blocks from the front end.
I want to augment these blocks based on the type of the block. I will paste in an example payload so you can see what I mean when I say type. I want you to create a, uh, I want you to create a registry where we can, uh, register block augmenters, and we'll register
them by type. Each augmenter should be its own class that receives the JSON block as it was received from the front end, and then returns a JSON object, uh, that has been potentially modified. In the preview endpoint, we should loop through the blocks and augment them.
Why don't you make that the responsibility of the same class that's doing the block registration so that we can do that in one line in the controller? And here's a sample payload.
Okay. So block augmenter registry. Augmenters, yes, that looks correct. Now, um, get YouTube thumbnail from URL.
Looks like I've asked this question before. Um, cool. All right. The first one on the list is a full-size image, and the other are thumbnails. Let's just see what these look like. All right, so we're gonna take plain text. Okay.
Did we already lose? Yeah. That one. All right. Well, this is, yep, that's working. Let's take these guys and see if this actually works. That looks like it works, although it's got black bars on
the top and bottom. Honestly, that's probably better for email, but I don't know. Looks like four is not real. Three is even smaller. All right, so we'll go with zero. What did it say? It said there's an HQ also.
HQ default. HQ default. Same one. We're just gonna go with zero. Okay. Are you done, block augmenter? So what did you do? Yeah, that's exactly. Uh, sure, yeah, make me a YouTube one.
Go ahead and implement the YouTube augmenter, please. Man, I love a registry. Love a registry. Uh, I love being able to just add something to an array and a whole new set of actions starts happening. Insane that it's registered right here.
Should be registered centrally. That's okay. Um. It-- I didn't even need to look it up. It just guessed it. It just freaking guessed it, uh, what I w- It, it guessed what I wanted it to do, which is really cool.
Um, yes, optionally fetch title description from YouTube API. I have all of that stored locally in the real application, and so that is why we're going through Laravel here. Boy, good for them. Good pattern matching. That rules. Um, and is it updating? Look at that.
Grr. And it wrote it as tables, which is what I need. Hell yeah. All right, um, I don't know. Let's just see if it works. Who can say? Did we lose it again? Let's go. I for- I keep losing the, uh... Yeah.
Whatever. All right, let's go back to the studio. And I just wanna copy this URL as a normal person would, and then is this gonna work? I guess not.
I am curious, uh, I am curious what the augmentation did. So if we go here, and we say, um, let's just do DD augmented blocks, and we'll, uh... Nope, I just wanna replay.
Okay, maybe not. Yep, still got it. All right, let's see what this does. That looks pretty good to me.
I mean, those props look great. It found the video ID. Is this, uh, is this image, does that load? Yeah. That loads. That's very cool. Um, okay, so then we posted it over-- We need to do an else here. Um, we can just, uh, return.
Oh, it should return the whole body. I think it is actually JSON. So if we add YouTube... Boy, I really should save that in...
Oh, that's interesting. It looks like we're not sending a URL there. There we go. I should write that down somewhere, huh? URL is that. All right. Why are you not working?
Do we get any errors over here? Nope, I don't see any. Okay. What if we do it like this? What if we do blocks equals type, uh, YouTube, and props are going to be URL and that, and then we can just
DD augmented blocks. Okay. Props. Boy, that's cool. That part's great. Love that part. Now, um, DD response successful. True. Okay. So I think the YouTube block might be props.videoID.
Hey. All right. So the YouTube block is getting called, but props.videoID, I don't like it. Just put a thumbnail URL in there. But I thought we were passing-- I should just make Claude do this, huh? Um, how does heading work?
Oh, do you have to put the props at the top? Um, it looks like, uh... Oh, maybe it's not props. Yeah. Okay.
For the YouTube Maisel component, are you sure that everything should be preview- prefixed with props dot? Because I'm looking at the markdown component, and it looks like those variables just come in as top-level variables. You're absolutely right.
Come on. Don't do that to me. Just get it right the first time. I'm gonna be pretty excited to see this work.
Okay. Yep, all those went away. It's pretty good. It's a little squashed, but I don't really care about that. And why'd you make the width wider than the height, doofus?
There. I mean, come on. Ah, use your brain. Um, what is, what is YouTube? YouTube video will else. If video ID... Boy,
it sure seems like it is, uh, showing both. YouTube. Yeah. Hmm. That's close. Um, I'm, I'm seeing both the YouTube video with the thumbnail, but then I'm also seeing the part that says, "YouTube video will appear here." So I don't know if our if else tag is wrong or what's going on, but I see the
thumbnail as I would expect, but then I also see the placeholder. Can you investigate that? All right. I think we are pretty close. I think we're pretty close to done. Um, so now, if I were to add...
So let me just take that, so I don't forget it. If I were to add a heading of... Oh, it's hard-coded. Uh, I was very confused as to why that didn't work. Um, okay. Let's get rid of you. And now I'm to add a heading of check out... Boy, that's so fast.
Check out my newest video, and then I can add a YouTube video, boom. God, that freaking rules. Um, let's see why. Uh, it just, it just did it wrong. Oh, it doesn't support else tags.
Oh, that's interesting. Not my problem. Funk yeah. So I can add a heading. Check out my newest Nucit video. Ha. Ha. That is so boss.
Um, so what I would really do, um, I mean, I might, I might really do that, but this YouTube, this YouTube component would pull in the title of the video. It would pull in the publish date, the number of views, but I have to get all that from the API, right? So I'm not gonna do that right here. Um, but you can imagine now, when I click course promo, I can just, I don't need to enter all this.
Yeah, I haven't created that component. I don't need to enter all this. I can just click from a dropdown which course do I want to promote, and then it'll pop up, and I'll pull all the data out of my database like, uh, like I would normally. Um, which is why, again, we're going through Laravel to do this. So this, I am super freaking pumped about.
This is so cool. Um, I'm literally going to use this to start building out, uh, my newsletters from now on. So if you're not on the list, uh, go to aaronfrancis.com/newsletter and sign up. This is... You're, you're gonna start to see it look a lot more like this. I'll make it prettier, of course. Um, but yeah, I can use this, and I can start building up blocks over time, uh, to be exactly the layout that I want.
And all we'll have to do is enter one... Oh, the whole thing is draggable. That's nice. All I'll have to do is enter one URL, and then everything's gonna show up perfectly. I dig this. This is super cool. Um, all right. You just watched me vibe code an entire mini application. So if you're still here, listen.
If you're still here, you're, you're dedicated. You're a diehard. I want to know what you think, um, because there's a lot of content out there for, there's a lot of content out there for, um, AI, but it's all so hype driven, and I don't really like that. So if you like this type of content where it's like, watch me actually do something, please let me know, um, because keeping up with all this AI stuff is a ton of work.
But if y'all like it, then I want to be creating more content like this. So please leave a comment. Let me know. Um, go sign up for the newsletter. It's a very good newsletter, and, uh, you can hit reply to those at any point and shoot me an email. But I'm pretty pumped with this. I think this is pretty great. I will actually use this to save me a bunch of time, and so, yes, AI just eliminated probably two or three days worth of coding.
But now, every week, it's gonna save me maybe an hour, maybe two, uh, of building out the newsletter. So it's very good. You gotta get on board. Um, but I'm still trying to figure out, do I want to be the guy, the developer talking about AI content? I don't know. Maybe. Let me know. But either way, thank you for watching, and until the next time, see ya.