Pod Insights Syntax - Tasty Web Development Treats 977: We built a CSS Challenge platform About this episode Scott and Wes break down how they built SynHax, the real-time CSS Battle app powering the upcoming Mad CSS tournament. From SvelteKit and Zero to diffing algorithms, sync conflicts, and a last-minute hackweek glow-up, this one’s a deep dive into shipping ambitious web apps fast.
Show Notes
00:00 Welcome to Syntax!
00:50 March Mad CSS Tournament.
03:19 Brought to you by Sentry.io.
03:59 What the heck is a CSS Battle?
05:34 The tech stack.
06:30 Svelte Kit.
06:44 Zero Sync.
Zero Docs
Zero Svelte.
07:32 Drizzle.
07:58 Supabase.
08:23 Graffiti.
10:45 Sync Server.
12:10 Cloudflare Workers.
12:23 Local File System.
13:26 How Zero Works.
13:48 Zero Sync Client.
15:39 API server.
19:34 Dealing with states and conflicts.
24:25 The Hackweek Project.
25:29 The Diffing Algorithm.
35:22 The bugs.
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 Scott Tolinski? We decided to host a major CSS coding battle tournament here on Syntax with 14 of the greatest CSS engineers out there and then two other competitors in that competition, that being Wes and myself, competing in CSS battles. And we've been doing a lot of CSS battles here on Fridays in our three devs videos with CJ, Wes and I, but we wanted to take it one step further. And so we built our own CSS coding battles platform. So we're going to be talking all about how that works, the stack, how the stack works itself, what
0:42 Scott Tolinski? we're using for various components, why it's cool. And we're going to be diving into some of the challenges that we had getting this thing up and running because let me tell you, this has been a massive sprint to build our own platform from scratch just to use for this CSS coding tournament. My name is Scott Tolinski. I'm a developer from Denver. With me as always is Wes Bos. What's up Wes?
1:03 Wes Bos? Hey, excited to talk about this. This has been very fun to work on the last, what, two weeks or so. I joined in about two weeks ago and helped crank out issues, but it's, it's a really cool platform. It's all local first, all syncs, it's all fast as heck. It's felt really cool. Love it.
1:22 Scott Tolinski? Yeah, I will say it's not local first and I'm going to push back on that, but I do think that's an important part of this distinction here because we'll talk about why it's not local first. We'll talk about the tech. It is using zero sync, which definitely was a platform that was initially described as being local first, but they've really kind of shifted that message a little bit because I don't think it really truly falls under that. But I think you saying it's local first is not a bad thing, Wes. I think that is how most people might think about this and look about it. So again, the MAD CSS, March MAD CSS tournament, you'll find that exclusively on our YouTube channel here. We have some
2:04 Scott Tolinski? of the, the best competitors, Kevin Powell, Adam Argal, Adam Wathan, Cassidy Williams, Anya Kubo. Is that her last name, Wes?
2:14 Wes Bos? I believe so. I'm not, don't, don't count me on that.
2:17 Scott Tolinski? Sorry, Anya. Josh Komu, we have Kyle Cook, who's also known as Web Dev Simplified, Julia Myosin, Ben Hong, Bree Hall, Chris Coyer, Jason Langstar, Shonda Pearson, and Amy Dutton. This thing, besides the site being cool as hell, Wes, this tournament-
2:35 Wes Bos? Thank you. Yeah, madcss.com. Go check it out, because this was a really fun site to build. And we're currently working on a way to pick your own bracket. So before this thing goes live, you're going to be able to log into madcss.com and pick a bracket. And if you win, if you get it, the winner will be, will get cash prizes.
2:55 Scott Tolinski? Cash prizes, man.
2:57 Wes Bos? Maybe not cash, but prizes.
2:59 Scott Tolinski? Prizes. Prizes that did cost cash at one point for us to make. So yeah, that, that's kind of the crux of this thing. You might be having deja vu right now, because we have talked about this before. This was initially born out of my Hack Week project. So we'll talk a little bit about why this is different than what the Hack Week project was. And if you want to 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.
3:43 Scott Tolinski? Real quick, the stack here, the stuff we built this on, it's using SvelteKit, because-
3:48 Wes Bos? Hold on. Can you just show what it does visually first before we get into the stack? I think that will frame it a little bit better.
3:56 Scott Tolinski? Yes.
3:57 Wes Bos? Because people might not know what a CSS battle is.
4:00 Scott Tolinski? For people who are watching on video, you'll be able to see the UI. For people who are listening, we'll do our best. You know, I don't want to make this only a video-only episode. But a CSS battle, in terms of like what this is actually doing, is people have a target, which is a thing that they are coding towards, a thing that they are trying to recreate with CSS and HTML. And the way the CSS battles works- Is that you code your HTML and CSS and you try to get it as close as possible to the target. And the person who gets there first to dead on 100% or gets the highest score where things are closest
4:40 Scott Tolinski? is the winner. So if you're looking at this on YouTube, you see right now my code, which is up here in the top left. You see the target, which is over here. Then we have a diff view and an overlay. So you can see what's different. And then you even get access to your competitors view. So that way, when you're competing and you're coding, you can see how far along they are to either stress you out or calm your nerves, slow you down. So that's the general crux of this is a target is created with either a video, an image or CSS and HTML. Right now, we're just using HTML and CSS targets.
5:19 Scott Tolinski? And again, we are comparing, we'll talk quite a bit about the diffing part of it because that was a huge component of this. And again, this whole thing works real time. I'll talk about the tech involved to make this work and what's unique about it. So am I, am I free to talk about the stack now, Wes?
5:38 Wes Bos? Let's talk about the stack. People understand. I think one more thing is that like the code that is being written, you'll notice there's no, there's no code part, right? And that's because I hate, hate, hate writing code in some little text box on a website when I'm trying to be as fast as possible because none of my shortcuts are there and none of my tab completions are there. And you just, you just feel weird trying to type as quickly as you can when you don't have all of your, your comforts of what you are actually used to. So the important part about this Sinhacks that we built is that you, it uses local file system access and you just use your own editor, use your own tools, you use your own completions, all of that stuff locally on your computer.
6:21 Wes Bos? And then it syncs that data from your file system to the Sinhacks platform.
6:27 Scott Tolinski? Yeah, it's pretty cool. We'll talk about how all that works too. So the stack, it's built in SvelteKit because I started it and I love SvelteKit, so easy choice for me. I also, we need a server and a client, so this couldn't just be a UI client, this had to be a server and a client. And then we use Zero Sync. Now Zero Sync is a library for doing syncing. I'll talk a lot about how Zero works after we talk about this stack, just so people can understand why Zero is so good. But Zero gives us a real time, it gives us really fast everything. It's really what allows this application to work the way it does, as easily as it does. It's a great platform.
7:10 Scott Tolinski? I also use the Zero Svelte bindings. This is a Svelte bindings that I wrote myself and I'd like to think that the syntax is really nice. I'd like to think that it all works really easily. It's very Meteor-like in how I like to work in it. So again, it's really trying to chase that dream of having Meteor back in my life. Also, Drizzle. It uses Drizzle for database schemas. We do have to have a schema for Zero as well, but there is a Drizzle Zero package that takes your Drizzle schema and translates it directly to a Zero schema without you having to do anything.
7:51 Scott Tolinski? So Drizzle, great choice. Zero requires Postgres as a database, so just Drizzle, Postgres. We have the database hosted on Superbase for no reason other than ease of simplicity of getting something up and running for my Hack Week project. I host Zero apps on Coolify using a Postgres database there. I do them all kinds of ways. So Superbase not required. We're not using any of Superbase's libraries here.
8:18 Wes Bos? Just needs a Postgres database.
8:21 Scott Tolinski? Just needs a Postgres database. I also have the basis for the CSS using Graffiti. Now, we're not using a ton of Graffiti stuff, but there's a number of like really nice Graffiti utilities, whether that is like stacks or splitting or those types of things that come in handy. We have a whole ton of colors in here too, but in classic Wes fashion, he's not a fan of any of the colors, so he just overwrote all the colors himself, which is maybe the most common way of working with Wes.
8:53 Wes Bos? I was actually frustrated with a lot of this because
8:57 Scott Tolinski? Yeah.
8:58 Wes Bos? You, there was no like docs for it in the codebase. And I just didn't know what a lot of the variables were. And like, I'm sure I could have looked them up as well, but like, we were on a huge time crunch.
9:14 Scott Tolinski? We were on a huge time crunch.
9:15 Wes Bos? I did use quite a bit, like all the purple on it as well as I just overrode a lot of variables. But then like things like the font sizes, Scott loves to do this like min max percent.
9:26 Scott Tolinski? Oh, the font size system is so dope.
9:28 Wes Bos? Everything scalable. And like, I was like, how do I make this font bigger? And like, there was, there was no way to do that. So we just.
9:36 Scott Tolinski? Yeah, you're just, yeah, I know. It's very systematized, for sure.
9:40 Wes Bos? Yes, it is. It's great until you need to step outside of the system.
9:44 Scott Tolinski? That's how they work, Wes. And actually, it's so funny, after our conversation about what's missing from the web, you told me we could do tabs using details and summary. And I was like, I don't know. I went through and actually added a full-on, no JavaScript tabs.
9:59 Wes Bos? There you go. Told you.
10:00 Scott Tolinski? Using details and summary in here now too. So that exists in tooltips via pop over and anchor positioning. So I've been adding stuff to this kind of as I need it. And for me, because I use this on every project, I'm very familiar with it. So it was quite easy for me to say, oh, let's just use my thing that I'm very familiar with. I have been working on, I don't, I don't know if this is like a thing that even matters anymore, but like the llms.txt is like really organized now where it's like, if you need a tag, come to the tag docs. If you need a boxes, go to the boxes docs. Like it tries to do a good job of making the llms work well with it. So something I've been focusing on a little bit.
10:45 Scott Tolinski? Sync server. We run the sync server on fly.io. Why? Because I just needed to get it up somewhere. And if we're being entirely honest, I don't love fly.io. And it's not fly's fault. It's a skill issue. I just have the hardest time finding the things I need to find on there, whether it's the logs, or whether did this deploy work or not, or why didn't it work? Like, I get really frustrated and I don't like how it's all set up. But you need a container somewhere for the sync server to run, like a long-lasting container.
11:20 Scott Tolinski? I typically run these on Coolify, but my Coolify server is over in Germany and I wanted it to be faster here. So I put it on fly.io and you know what? Just it's something I'll change at some point, but not yet.
11:34 Wes Bos? Yeah, there is a, somebody has implemented the sync server in the Zero docs as a Cloudflare Worker durable object.
11:43 Scott Tolinski? Have they?
11:43 Wes Bos? Which is really cool. So if you, you need it to be long running, right?
11:47 Scott Tolinski? Yeah.
11:47 Wes Bos? The Cloudflare solution to that in the serverless world is durable objects. So they have a, Zero in their docs has an example that you can get up and running. But like we were so crunched for time, it was just like, don't touch the things that are not broken, right?
12:02 Scott Tolinski? That's how it works, right? Sometimes things just exist as load-bearing blocks that you're like, you know what? This works right now. It took me a long time to set up. I'm not going to touch it. Definitely will move it to Cloudflare because the server and the UI of this is running on Cloudflare Workers just via the SvelteKit Cloudflare adapter. So the actual app is running on Cloudflare Workers. And then again, we use the local file system as Wes mentioned. When you first enter a battle or whatever, it asks for a folder. It creates that folder for the given thing. And then you have code that you could just drop into your VS code and then start coding.
12:38 Scott Tolinski? The way that that works in the code here is really kind of interesting where you connect to the file system and then you're storing that file system handle in indexed DB. And then having that persist as Svelte state. It is a whole thing.
13:01 Wes Bos? It's so fast though. Like it like for our CSS battles, it's just as fast as like using V. Like it just refreshes it immediately and everything is, as soon as you hit save, you can see what you're working on.
13:12 Scott Tolinski? Yeah, and let's talk about how that works because it is really interesting. I have like if the file has been changed, it is just updating a database record, but because of how zero sync works, it's so fast and instant. So how does how does zero sync work really quickly? Kind of like no fluff here. Zero is basically a platform with a sync engine as well as a client side library to do the queries and stuff, a server side library to do the server side stuff, and then a sync server. So the big pieces, right? So you have the client. The client has versions, client versions of the queries and the mutation functions.
13:55 Scott Tolinski? These things run on the client and take place instantly. So when you click something, like I'm going to click new battle or something, it creates that battle instantly and saves it into your client side data using the client side queries and mutations code. Then in the background, connects with a web socket to the zero cache sync server. That happens so that when I save it, the database knows what data has changed and it sends a patch message to the sync server. The sync server is a long running server, as we mentioned, and that replicates Postgres to a SQLite replica file.
14:40 Scott Tolinski? It then basically determines what client rows have changed since the last updates and then sends a diff to your server. So basically the sync server is handling like what has changed and what messages I need to send back and forth. And it does so with like I've mentioned diffs about like just what's changed. So it's not sending a massive amount of data on everything, which is one of the reasons why zero is so fast. It's incredibly fast. It's incredibly fast because it stores your data locally and therefore can load it locally very quickly. It's incredibly fast because the data that it does send is in patch messages for updates.
15:22 Scott Tolinski? And then that sends basically a message to the API that again lives on our app. So you have two pieces, the app, the sync server. App sends to the sync server, sync server sends back to the app and the API routes. Okay, that API server is really cool because that's where it processes the queries and mutations server side. This is where like auth happens, this is where permissions happen and stuff like that.
15:49 Wes Bos? The way that For all your like database, like to be clear, zero is not a database, right?
15:55 Scott Tolinski? No, yeah.
15:55 Wes Bos? Like it's like all of your writes eventually just happen in like drizzle updates?
16:00 Scott Tolinski? Yeah, yeah, you're pretty much just writing drizzle code to do those. Well, actually, that's not true. No, you're writing, sorry. The, the, those mutations, Wes, are happening in the exact same code that is used in the client version of that is also that same code is used in the server versions of it, just being run server side.
16:17 Wes Bos? Yes, but how it, how it actually saves it to the database is not part of, of zero, right? Like it eventually zero will then translate it to what the zero drizzle adapter and then save that to the post press?
16:32 Scott Tolinski? No, the drizzle zero adapter is only getting, giving us the schema translation, so.
16:38 Wes Bos? Oh, so if you wanted to access the database directly with the same schema?
16:43 Scott Tolinski? Yes, correct.
16:44 Wes Bos? Okay, I was wrong then, okay.
16:46 Scott Tolinski? Yeah, in fact, I can even show you the database inserts are happening in a, a transaction. So if this is, this is actual zero code. If you're looking at the screen, you can see it, this is the zero code that is doing the insert. So it is very similar to an ORM type of thing you're doing. TX, which is the transaction dot mutate dot the table dot insert. And you're just passing your data in there. So very similar to how you would do it using any kind of ORM here. Really nice. So the, the way that auth works, the way that it used to work was kind of a giant PIA.
17:25 Scott Tolinski? There was a, the whole schema file, you had to write all of your permissions and auth code in this, in your schema file in a like a real hot potato way. And then there was a zero process that you had to then apply that permissions and auth stuff to your sync server itself. And the sync server was the thing that was doing all of this code. It was doing all the mutations and stuff for you. The way that they have since changed it is like, oh, you know what would be way easier than having the sync server try to manage all that stuff? If you just. Got to write a route that collected all of those queries or collected all of those mutations in your own application and just apply them in your own code.
18:10 Scott Tolinski? The reason why that's more simple is because you can handle auth the same way that you would handle auth if it, if there was no sync server involved.
18:19 Wes Bos? So like And probably a lot of people that are, are adding this to their app. It maybe, this is great if it's like a greenfield app, right? But if you're trying to like, just add sync to an existing
18:30 Scott Tolinski? Oh, yeah.
18:31 Wes Bos? Database or existing application, you probably already have all of your own authentication permissions code.
18:36 Scott Tolinski? So now you would just incrementally adopt that. You're just creating those API routes and you're doing whatever incremental ones you want. It, it's really kind of great and you are just essentially taking our auth system is being done in, in middleware like you typically do in a SvelteKit app. It's being passed along immediately to any of the routes that exist. And we're just hot potatoing that into the context inside of ZeroSync. Then ZeroSync has your user auth stuff in context. It way simplified everything. And if our auth, if our sync server and everything lived on the same URLs and servers, it would have been way easier because we could have just used HTTP only cookies, but we had to do the whole bearer auth thing and that was obnoxious.
19:23 Scott Tolinski? Oh, I should say we're using better auth for this too. Better auth to do the Google auth and that's it. But better auth is involved as well. Um, one question I often get about ZeroSync in regards to it being local first or any of that stuff is like, why is it one, not local first and two offline and like data conflicts and CRDT kind of stuff? So it's not local first because Zero's really moved away from the idea of it being a good platform for offline. They've kind of determined that offline for this is less useful and less where they want
20:06 Scott Tolinski? to go with it. So because of that, local first is still always going to be the app should work purely offline. You should own your own data. It should be easily encrypted. It, you know, there can be a sync process that syncs that data and stuff like that. But I think the Xero folks kind of realized that this system can still be very, very impressive, very fast, load your data locally from that index DB while not necessarily focusing on offline or conflict resolution. The way that the conflict resolution does work. So let's
20:45 Scott Tolinski? say Wes and I both edit the same row at the same time. Both of the updates happen locally on our own machines. Then those messages get sent to the sync server. That server basically commits those in the order that they were received. So one of them might override the second one if it comes in afterwards. So basically, what happens is I send a message, Wes sends a message, the first one that arrives gets applied first, the next one then gets applied, but then the sync server basically understands what the actual convergence is there and then sends the data back out to everybody. So then someone's data isn't going
21:29 Scott Tolinski? to be stale if we both write the same thing. I write, I write.
21:33 Wes Bos? That's, that's one killer feature that we haven't mentioned yet is this is all entirely real time.
21:39 Scott Tolinski? Real time, yes.
21:40 Wes Bos? Whenever I would make an update to anything or when, like sometimes Scott would create a new battle and then invite me and it would just immediately pop up on my dashboard without having to do a refresh. And there was no polling or anything involved there. Simply just was, oh, this data has now changed. So this view requires this data and it just immediately updates.
22:03 Scott Tolinski? Can I, can I start a battle with you to kind of show that off, how that works?
22:07 Wes Bos? Sure. Yeah. Let me, let me go log in here.
22:11 Scott Tolinski? Okay, folks who are listening on audio, you're not going to be, we're not going to just like leave you hanging here. Uh, but I am going to just, uh, create a quick battle. I'm inviting Wes to it. His automatically shows up and I just want to show you really quick how the file system stuff works, or at least talk through it. I want to, uh, talk through the general saving flows. So you can really truly see, uh, how fast and impressive this all is. So I joined a battle. It created this folder for me just by joining the battle, which is the, the files. You can see how many we've done to test. I'm going to drop this into, uh, VS code. And you can see I have HTML and CSS just kind of here.
22:54 Scott Tolinski? These are the files that you will then edit for when you do the battle. We're both locked into the battle. We can click lock in players. Okay. So I have a couple of views here. We have the referee view where it can show both people kind of side by side here. We also have the lobby, which allows you to, uh, press play and get going on a battle. Can I start a battle? If I'm a competitor?
23:18 Wes Bos? Um, no, you shouldn't be able to. You might be able to, but you shouldn't be able to.
23:24 Scott Tolinski? But if I'm the referee and the competitor?
23:26 Wes Bos? Yes, you can. That's, that's how most of our testing has, has worked.
23:31 Scott Tolinski? So just to show people really quick, just generally, when I'm typing in my code editor on the local file, I can do background, uh, background, red, save it. And you can see the moment I hit save it updated and then Wes is also going to be seeing those changes in real time. Wes, do you want to make a change to yours? And we can see Wes's competitor view. Um, though again, the way this is working is that when I have a file save, it triggers a, uh, a basically a function call on zero that runs the mutation. The sync server reconciles that real time sends the updates out to everybody. That way the first person to get to a hundred percent is the winner.
24:14 Scott Tolinski? Uh, and these updates you can see are just happening in real time. Our progress bars. It is really, really. Really, really slick and the whole system just works really super great. Let's talk about the Hack Week version of this project. You may have remembered us talking about this. The way that this platform used to work is that there was voting involved. There was three people going at once. And what we really needed to do is transform this from being like a three people and a subjective winner to being two people at once and an objective winner, which is done via diffing, which Wes is gonna have to go deep on.
24:56 Scott Tolinski? Zero 2.5 also changed how they do permissions and all this stuff. So the app needed to be, in fact, I was talking to Courtney about this. I think this would have been easier to write from scratch than it would have been to me to adapt the Hack Week project. Between the changes in Zero, the changes in how battles are run and operated, I ended up probably rewriting most of it before you ended up getting involved, Wes. Like, I should have just started from scratch and just kept the general concepts because there was so much that needed to change. And then the biggest one of those changes being when you came in and brought in the diffing algorithm. Do you wanna share a little bit about how you managed to do that?
25:38 Wes Bos? Yeah, yeah, so this is one problem that we have with the CSS Battles platform is that it's like you can get so close and then there's like one weird thing. And I think the way that the CSS Battles diffing algorithm works is that it sends your code to the server. They probably have like Chromium running. It takes a screenshot and then diff it against the actual target. We wanted that to happen in browser, both so that any quirks between your browser or whatever are gone because your target and your actual thing that's running, those are both running in the exact same browser. So whatever browser is actually computing the score is going to be rendering them out exactly the same, which is really helpful.
26:23 Wes Bos? So what we did is I ended up using this package called Snap DOM. You may have used HTML to canvas in the past. This, there's like a way better version now called snapdom. And essentially you just give it a, an HTML element on the page and it will then convert that to like a canvas and then export it as like a PNG or SVG. The way that it actually works is really interesting to me is that they take your HTML, put it inside an SVG foreign object tag. And then I think since, since it's then an SVG, which is an image, you can then write the image to the canvas, right? So like it doesn't have to like do a whole bunch of, I think that's how it works.
27:05 Wes Bos? There is a lot of like gotchas and stuff. I had a couple of bugs that I burned a day on, but we got it all working and it, it works really well. And then the actual dipping algorithm itself, we went through several different ways to like figure out, are these things close enough, right? So like we tried using vectorization, you know, vectorize the images and see how close they are. And most vectorization L L Ms will care about what is in the like, like if there's a dog in it, right? Or if there, if there's a red dress in it and they don't necessarily care about pixels that much, right? And then there's other things called SSIM, which is structural similarity index measure, which is how, how similar are two images to each other?
27:51 Wes Bos? That worked okay-ish, but it still wasn't good enough to making it close enough to pixel perfect. Cause we, we didn't want it to be pixel perfect, but we wanted to be close enough. Whereas if you had like a weird like outline on something and that would make you lose the whole thing. So I think we, I probably went through like six or seven different iterations of it. We finally landed on one that had different thresholds. Scott, if you, yeah, you can see the dipping engine in the bottom right here.
28:25 Wes Bos? It has different thresholds, different, three different algorithms in there, different weighting of different colors. If something is, has like a bit of opacity in it, it weighs it, weights it a little bit less. And we finally landed on something where like this feels, this feels really good.
28:43 Wes Bos? What else? Oh yeah, the big issue we had was like the simply putting the background color on one of those things would get you to like 98%.
28:50 Scott Tolinski? Yeah.
28:51 Wes Bos? It's because like a lot of times the background did account for 98% of the pixels. So we ended up writing something where you could just punch out the background color from each of the targets and then not dock them or count them. Right? It just, it just takes those pixels out of the equation entirely. And then that also helped with things like box shadow and whatnot, where if the box shadow wasn't perfect, it was just, it was close enough. And then we'd give you some points for that. So that was pretty fun. And then we also built these, like a diff viewer where it shows you, if, if you click on the diff viewer there, you can see like red is significantly different.
29:32 Wes Bos? Whereas like greens and blues are, are not as, um, not losing you as many points. So if you're looking at your diff and you're, you're like, what should I spend time on? You go on, you want to go for the red stuff, right? Um, and then we built this little overlay thing where you, you can do it kind of like side by side. If you just click on it, you can see exactly where yours is overlaid the target.
29:55 Scott Tolinski? Yeah. And that, that overlay view, I think is really, uh, I think is all really helpful. One of the things that I think helped with this is that we have done so many CSS battles that we were like, I know what I would want different on this platform. Like I, I know like what's working and what's not working for us. And that allowed us for like specifically this overlay. Um, you really liked the overlay and wanted it automatically, whatever, but I didn't like how it was automatic. And then you came up with this idea to pull and drag. And I do love the little border and drop shadow you gave on this.
30:31 Wes Bos? Yeah, I use that all the time.
30:33 Scott Tolinski? You can use that with the opacity to really dial it in. I find that the, the tools to be really nice for all of this. Um, I found using the dev tools to be nice in this, this entire process. The, the diffing stuff, I will say, folks, the way that we dialed in the diffing everything was from sheer.
30:55 Scott Tolinski? Ah, dog running. Running.
30:58 Wes Bos? We ran so many tests and every time we did a test and we thought we had it, like something weird would come up or like CJ would put a div, like that would cover the entire thing and like that technically is not a background color. That's a div with the with the background color. So then we had to write something else that would detect what the background color is, even if it's not the body background color. And then we also implemented Tailwind CSS support. So that had to that had to be thrown in there as well. You had to, the sandboxing was really neat. I was like, yeah, people like, like one thing you could do early on was you could just write a script tag in your HTML and then it would execute that on everybody else's computer.
31:38 Scott Tolinski? Yes.
31:39 Wes Bos? And I was like, man, we gotta like run this through like a sanitizer or whatever. But like iframes, these are all iframes. Iframes have a sandbox attribute where you can allow and disallow things. So what we did is we disallowed inline script tags. Or no, we allowed JavaScript because we needed the Tailwind CDN to load and compute the Tailwind code. But then we used a CSP, Content Security Policy, where we did a really good episode with Alex Sexton from Stripe on CSP. But basically via header tags or headers on your HTML element, you can say what resources are allowed to be loaded in.
32:22 Wes Bos? So you're only allowed to load script tags from one specific URL and that is the Tailwind CDN for their JavaScript library. And then otherwise you're not allowed to do any inline JavaScript. You're not allowed to, there's several other things you're not allowed to do. And that worked out well.
32:41 Scott Tolinski? Yeah, yeah, it really worked out well. I think this whole thing, like I mentioned, like so much of it came down to us using it and using it and trying it and hitting bugs and hitting errors. We, for an entire week, were just like,
32:58 Scott Tolinski? All right. Every single morning, we're going to use it. We're going to test it out. We're going to write down all of the the amount of bugs that we have. We're going to fix those all and we're going to come back the next day. And I think it was like, so the battles were starting Monday. And I think it was like Thursday that I was starting to feel maybe a little bit nervous about it because it still felt like we were logging so many things. But at that point, the diffing engine had really come together. Things had really started and I was recovering from
33:26 Wes Bos? The diffing engine was Friday at 3 o'clock and you guys are like, well, let's maybe like, um, change how everything works. I was like, guys, we have two hours, but luckily we could, we could reuse a lot of the other, um, background color stuff for the transparency.
33:42 Scott Tolinski? Yeah. And there it is tough because you you end up in this, um, um, spot of like, is it good enough? Is it going to cause problems? Like, there were so many times where it felt like it was good enough, but like, we wanted it to be really special, I think. And I think that ended up really working out because at the end of the day, the entire thing like this right here, if you're looking at the screen, you can see my diff right now. It says I'm at 99.31%. I would say this darn looks about 99.31%. And we spent so much time like making sure that percentage, and I will say Wes spent so much time making sure that percentage matched what you would expect.
34:26 Wes Bos? Man, I, I have a newfound appreciation for people that develop like, like the algorithm for like, like TikTok or Twitter or something like that, because you turn one knob. Like, like that example of those little lines right there is like, oh, well, we can, we can relax, um, like pixels that are like, maybe, maybe it's a one pixel diff, you know, and if the pixel to the north and the south of it, or the east and the west of it are bang on, then maybe we just allow that one, you know? But you turn one knob and then all of a sudden something else changes and you turn another knob and and we had so many different test cases to go through. But like, it really makes me appreciate people who write these
35:10 Wes Bos? algorithms for like Twitter, you know, like every week Twitter's showing you all kinds of new garbage. And you're just like, man, they probably turned one knob and then all of a sudden something else is, is totally out of whack.
35:22 Scott Tolinski? Yeah, totally. I, I, uh, some of the biggest bugs that we had, besides just like dialing in the diffing, we kept getting, the sync engine would just start randomly saying that you were unauthorized. And this one was tough because you never knew if it was like where the, the bug was, like what was the issue? Um, because it's happening on the sync server and yeah, we're combing through logs and we're adding, uh, we have Sentry in here, we're checking Sentry. And the issue ended up being that the cookie that stored our auth token was long lasting and the JWT had an expiry of 15 minutes. So if we had been working on it for 15 minutes, it would suddenly in the sync process tell you, oh, by the way,
36:06 Scott Tolinski? uh, you're not authorized anymore. Um, which was a tough, tough bug to find and luckily, uh, we all have good enough fundamentals that we kind of were able to break down step by step. Where could this be? And CJ was the one that had the idea to be like, you know what? I gotta check this JWT to see like what's going on here. And he discovered the 15 minutes expiry time. Um, there's a, a tough thing there with that expiry time because the way that the sync engine works, for you to update that JWT with the sync engine in how we are doing it, you would have had to like tear down and rebuild the zero client instance. And that might've been fine, but we were like too late in the process for me to be like, oh yeah,
36:47 Scott Tolinski? in the middle of the battle, let's just tear down and rebuild the sync instance and hope that everything works fine. Uh, I felt like that would have been opening up a door to potential bugs and issues. So the solution for us was just to make that JWT, uh, longer lasting, at least for, um, these battles to get through this before, you know,
37:05 Wes Bos? Yeah, and then we'll fix it for like a proper refresh, um, behind the scenes.
37:12 Scott Tolinski? Totally.
37:12 Wes Bos? Like, like you shouldn't have to refresh the page for it to work eventually, but like, It was close and we got her done.
37:19 Scott Tolinski? Yeah, that was a tough bug. I don't, when did we push that update? That was like day of.
37:24 Wes Bos? That was, I was done on Friday when you guys had pushed it, you know, like that was after hours for, for Eastern time zone. So it was, it was pretty close and we started on Monday. So.
37:33 Scott Tolinski? Yeah, we did one final run through on Monday morning and the first battles started on Monday. Keep in mind, we had to do all of this while keeping Wes and I in the dark about the, the challenges, the nature of the challenges. So a lot of the data that we were working with, the test data and stuff like this oftentimes were like intentionally not what we were going to be anywhere near in the tournament. Because we already have enough of a home field advantage from doing CSS battles with each other. That like, we didn't want any sort of advantage for us in this tournament. It's, you know, I, I want to win.
38:12 Wes Bos? Speak for yourself. I want all of the advantages.
38:14 Scott Tolinski? Well, I want to, I want to win fair, Wes. If I win, I want to win fair. Uh, we should say at the time of recording this.
38:21 Wes Bos? I'm very nervous about getting knocked out.
38:23 Scott Tolinski? Yes, the battles haven't really taken place. Uh, and, uh, so you'll see the results.
38:28 Wes Bos? I'm going on in about an hour for my first one and I'm feeling a bit nervous.
38:33 Scott Tolinski? Oh, I was nervous. I think everybody's been nervous.
38:36 Wes Bos? We got these sick jackets though. Um, so I'm not sure when this one comes out, but the March, the beginning of March is when this will start. And I think there's five videos that will play out through the rest of March. Um, madcss.com, we have these jackets you can buy. It's really cool. Look at this syntax in the liner. It's all embroidered. We got the mad CSS logo. We got syntax on the arm here. This is like the sickest jacket in the world. Really nice snaps too. Big fan.
39:05 Scott Tolinski? It's so cool.
39:06 Wes Bos? If you want to grab one of these, go to, um, by the time you're listening to this, they probably won't be up in the store just yet, but stay tuned because you'll, you'll be able to grab one.
39:15 Scott Tolinski? Yeah. And if you subscribe to this channel, like, subscribe, all that stuff. Uh, not only are you going to get to see the battles, which are going to be a ton of fun, but you're going to get to, uh, be aware of that kind of stuff. There's also a really, really cool water bottle that we have for this tournament and generally cool stuff. This incredible logo designed by Caitlin Bloom on our team. Uh, we've been rocking this thing on all kinds of stuff. So like. Oh, I just bit you. Oh, yeah, baby. Look at that. Wes has got a 3D printed one, I think. Did you make that yourself?
39:46 Wes Bos? Yeah, I did. It's surprisingly hard.
39:49 Scott Tolinski? I don't have the orange. I want to make one.
39:51 Wes Bos? I know. I was surprised. The orange is not exactly the color orange, but it was close enough. This is the first run at it. So it looks sick, though. I'm like, this is so cool. Caitlyn did an awesome job.
40:01 Scott Tolinski? So while we were doing this, the rest of the Syntax team was doing their own crazy amount of stuff, whether that's like 3D backgrounds for the CJ as a commentator view, or...
40:15 Wes Bos? It's gonna be nuts.
40:16 Scott Tolinski? It's gonna be nuts. This is a full-court press to keep up with the basketball theme here. A full-court press on everybody doing incredible work. So shout out to the entire Syntax team for making this happen. Keep your eyes peeled for Mad CSS on YouTube. It is going to be an absolute blast, and I sincerely hope that I walk away with the trophy. That is what I hope.
40:39 Wes Bos? I'm gonna win. Easy.
40:41 Scott Tolinski? I'm gonna win.
40:42 Wes Bos? I would beat you. I always beat you. Sometimes.
40:47 Scott Tolinski? Yes, always sometimes.
40:49 Wes Bos? All right. MadCSS.com. Subscribe. It's coming in March. It's gonna be amazing. Peace.
40:55 Scott Tolinski? Peace.
Previous 976: Pi - The AI Harness That Powers OpenClaw W/ Armin Ronacher & Mario Zechner Next 978: Should A New Coder Use AI? Page updated October 31, 2026 · transcript and summary are machine-generated