Skip to main content
View on YouTube to comment and like!

Syntax Video

Code Q&A with CJ | Full Stack TypeSafety, APIs, Rendering Strategies and more!

Chapter 1 0:00

Intro / Announcements

hello there welcome to syntax uh in today's live stream I am going to be answering any code questions that you might have so if you have them throw them in the chat and I'll do my best to answer them and also show some code examples if I can and um we're live on YouTube we're live on Twitch let me tell you about some things and then we'll get right into it so here we are um here here here great first up uh we just reached 30,000 uh followers over on Instagram so because of that we are having a giveaway so definitely check out this post over on Instagram uh because uh all you got to do is follow comment and tag someone and you can be entered to win a t-shirt a drink Koozie and a skateboard so definitely follow over on Instagram if you have not but welcome and I see a lot of cool people see a lot of familiar names in the chat

i w clarify this is just me in the live stream I'm just answering code questions here Scott or west won't be here it's just going to be me um yeah so there's that and uh let's just say hey to all the people and then we'll get right into it so uh what's up uh Carlos good to see you I was testing out my my chat overlay earlier so I have this uh this lauram ipsum uh so that's probably why they just said okay yeah was this timing a mistake no just technical difficulties um yeah I'm what 45 minutes late and I apologize I apologize but what's up prall good to see you and um we have a couple questions what's up Andrew good to see you as well yes yes yes and Nico good to see you too welcome in uh let's get to some of the questions uh one of the first questions that was asked was on Twitter actually and actually before we get into the questions let's let's just talk about recent news because this was super

Chapter 2 1:56

Node.js TypeScript Support

interesting I'd like to know your thoughts on it as well so nodejs has added experimental strip types as a feature flag in their nightly release and what this allows you to do is to run typescript code so first it will just strip away all of the types and then run the code AS JavaScript through node.js and this is different from comp a compiler or type checking uh because it doesn't actually transpile your code it literally just strips away the types so it's actually pretty fast um and pretty soon you'll be able to use this in node right now it's just an experimental feature um I think it's fascinating because we have things like Dino and Bun that you can both just point at a typescript file and run it without having to compile or transpile it first um and so this will be cool to have inside of node but because it is just types stripping it is a subset of typescript so it doesn't support enums

or namespaces so I I imagine this is really just useful for like one-off scripts like every now and then I might want to write like a little typescript file and then just run it without having to set up like a TS config and and all this stuff and uh this will be possible with node which is pretty cool I don't know I'd be curious on your thoughts on it do you think this is a good thing um do you will you use it I definitely will and if you want to try it out they have a I believe a code sandbox or you can download the nightly release to try it out um but essentially like any types that are defined any type annotations it just gets Stripped Away and it's able to run the code so we're actually running this through nodejs with this-- experimental strip types using the latest nightly version of node and it can spit out the JavaScript code so it's pretty cool um I thought that was interesting and that I thought I would share and also Scott did a video on it this morning so if you want to uh learn a little bit

more check out our YouTube

Channel and watch Scott's video here check it out something Absolut what's up u m good to see you what's up I rossome yeah good to see you over on the twitch side as well and thank you for those followers over on Twitch let's get into it so like I said the first question came from Twitter if you have any more questions feel free to throw them in the chat I'll get to as many as I can and I'll do my best to answer as many as I can but uh this first one comes from bacon and eggs over on Twitter and they say what's the best approach to upgrading vue.js 2 project on view bootstrap to vue.js 3 with a new library given V given view bootstrap has gone stale is a rewrite almost from scratch unavoidable I have no idea but let's look into it so um if you are unfamiliar the the change from vuejs2 to VJs 3 there were some breaking changes but typically those breaking changes

Chapter 3 4:25

Vue 2 upgrade Vue 3 Bootstrap

were for libraries so I imagine like the library view bootstrap uh would have had to have been completely uh Rewritten or revamped to ver support version three let's see um I saw something about view3 in the search results let's see bugs3 initial support so bootstrap view meets view compat with the release of 2.23 you can now use bootstrap view with the migration build of vue.js 3 fascinating

um okay so this is a potential path path forward um so a migration build I believe is like a specific version of view version 3 for people that are slowly upgrading to view version 3 so this would be a good solution at least for now um yeah so that's one potential path okay okay and then I'm curious I feel like I have found a Vue bootstrap for vue3 like a different one because this is the main one bootstrap View bootstrap view3 so this is another Library it doesn't have any stars so that looks like it's your your main path forward is to use compat mode while you still can I mean I don't know I mean maybe maybe you can look on GitHub as well to see what their release

plan is for supporting version 3 project stats and road

map this code will be deprecated in favor of code being developed here bootstrap view next okay this is also a potential solution so this is an early but lovely implementation of V3 and bootstrap 5 and typescript um see the docks yeah I'd be curious how close the API is to the previous library but if you're not doing anything too crazy this probably could be a drop in replacement so this is another answer is use this version which I'm guessing they're saying it's early but they still have quite a few components so those are your two options use compat mode or use bootstrap view next uh but thank you for your question uh bacon and eggs appreciate that um all right next question comes from Stefan in the coding Garden Discord and it is what are your views on choice of programming language these days for

Chapter 4 7:50

Personal Programming Language Choices

web versus compiled desktop client versus compiled server versus embedded systems uh I mean these days I'm still writing a lot of JavaScript um but I did recently do a video over on the syntax Channel about using Uhn net and you can check that out over here I did a cart for typescript devs what's up see and um I I I like the type I like CP and donet and like the C uh ecosystem because they have like pretty much everything built in um like the past few days I've been working on building some stuff with nextjs like the latest version of nextjs and next doth and a few other things and there's it's um there's a lot of code and it's it's very I have to piece a lot of things from a lot of different docs whereas like in the C and net world everything is just

like in the Microsoft docs so C is pretty cool cool if I were building like a decoupled application cuz I would still want to build a front end with like reactor view I might create just like a Json API with C that would be one of my choices um and then I've explored rust but I haven't written a lot of rust um and then if you're building a desktop app I probably would still reach for electron I know there are things like tari uh which allow you to build desktop apps with HTML CSS and JavaScript but it's a smaller bundle size and potentially faster than something like electron it's not as bloated uh but I tried using it probably over a year ago and the main thing I didn't like about it is because it's based on top of Russ the entire like file system API and all the stuff for doing native things you're still writing JavaScript to do it but it's using like some sort of rust Bridge

so you don't use like the fs library from node.js there's like a specific uh library that you use like here they have their own FS library that has its own methods which last time I used it were not the same as the node.js one so that was a little bit cumbersome because you're basically learning like a brand new API even though you're still writing in typescript um but tar would be a good choice as well and then I don't know if it's still a thing but there was this thing called like proton native which was like react native but for desktop yes let's look at their GitHub are they still going the 10,000 Stars the last commit was three years ago though so this this uh this may not be completely up to date but yeah um I don't know depending on what I'm trying to do I probably would still just use electron because it's so easy and I'm so used to it so yeah hope that helps feel free to answer

in the chat if you have any any opinions on what can be used for these kinds of things um but yeah so had asked about the hats in the chat and Scott's in the chat so hello Scott thanks for being here um yeah Billy Jacob Billy Jacobi asks where did the hats go that I saw in the merch store I don't think they're for sale yet um yeah yeah so you might have seen the the tweet that uh West boss posted and uh some hats were going to production but they they I don't think they're in the store just yet yeah what's up ty2k this is probably only the third live stream that I've done uh since I started at syntax but I'd like to do more I'd like to do more of these yeah yeah but I'm I'm EXC let me see if I can find the the Tweet cuz I am excited about those hats as well I want one of the the wool

Chapter 5 10:58

Syntax Hats Soon™️

ones actually let's check out west boss let's see I believe he posted an image too yeah this these These are going to be sick when they come out I can't wait to get one of these but yeah they're not in the store just yet uh but speaking of the store we do have other stuff for sale so first of all if you're just joining us check out our Instagram we have a giveaway because we reached 30,000 followers uh you can get the stuff for free or you can also just go to the shop so if you go to cry. shop we've got the Blazing fast NASCAR shirt we've got collabs with Drizzle and prettier So when you buy either one of these shirts $10 goes to the maintainers of both those libraries we've also got the sick pick which T which is I'm what I'm wearing right now um and uh the other things that you saw as well so if you look at all the stuff we've also got the pocket tea the skateboard the panther tea and the Koozie so definitely check out the shop yeah

yeah yeah what's up arv glad you could hang out nice to see someone talk cool things other than just my office code yeah I I also want this to be a bit of a hangout as well so feel free to just let me know what's on your mind yeah so Scott is mentioning we have there's another hat it's like a dark blue one that one's pretty sick too yeah definitely all right let's keep going we had some more questions this next one was on YouTube so I'll use my little highlight thingy let's see yeah so George baroa asks from your coolify tutorial you mentioned that kify isn't something you are willing to use for production what would an ideal workflow look like without a UI like kify um I sort of in a way it's what I set up in the YouTube video I did talking about how to set up caddy so if

Chapter 6 13:25

Workflow without Coolify

we take a look at that I guess if you look at playlist there is a self host 101 playlist and I believe it's the third video in this playlist so I show up how I set set up caddy from scratch like on a Linux server so I would start there like just have caddy as the basis but then if you're using that in combination with Docker there is a caddy Docker proxy which is what coolify actually uses under the hood so if you check out caddy Docker proxy and then I talk about this in my kify video so if you check out my kify crash course I talk about how kify is using this and basically show you how you can configure kify to further customize how caddy is integrated with it um but basically what this allows you to do is you can have Docker containers running but if you set some tags or sorry some labels on your containers this will automatically create the reverse proxies inside of caddy so you don't have to maintain separate configuration uh so basically every

project you have that's based on Docker you would create a compose file add in your uh labels that describe like what's the domain and what's what what port are you proxying to and as long as caddy Docker proxy is running in the background it'll automatically create those caddy configs so caddy in combination with this will get you pretty far um now this is for things just running on a single server and that's what I have most experience with is I'm I'm running sites on a server with a decent amount of resources and not necessarily like scaling to multiple um because beyond that you probably want to get into some sort of like orchestration tool which I don't have as much experience with um but for me being able to just set up my Docker compose have caddy running the background this is mainly what you need and then from there you could also use Docker to uh run your your databases or any other other types of services that you need um the nice thing about coolify is it has

uh like a a nice gooey for creating backups and stuff like that if you wanted to create backups manually and you're all just and you're doing everything without a UI you would really just have to create like a Cron job have some sort of script that does like a database dump and then up load that to some like S3 bucket or something like that so it's a lot more manual uh but for the small sites that I'm running I I'm more willing to just use these tools that I know than try to figure out how to do it exactly inside the coolify UI I don't know I might get to a point where I just use kify I know I know that Scott uses coolify for for most things I'm just so stuck in my ways of like using the CLI and stuff like that yeah yeah

oh I see so I think there yeah I think there was an issue I think we created the listing but they're not ready to sell yet you got A Sneak Peek very nice yeah yeah I guess uh traffic is also another option so like if um so traffic would be a replacement or alternative to caddy but what's nice about uh traffic is they have a web dashboard um so if you look at traffic proxy specifically you can install this on your server and then they have a web UI um let me see if I can get a screenshot here yeah it looks like this so you get a web UI of all the services that you have running so that's pretty cool about traffic I find traffic a bit more involved to configure than caddy caddy caty's like simple configuration style is like the best I've seen um just makes things so easy and removes all like the boiler plate and stuff traffic is a little more involved but they do have a little web dashboard here and and I looked for like like a caddy UI

dashboard I don't think I I think I found some people that were trying to build something yeah so this is caddy UI so it's a UI for cat the caddy proxy but it's pretty old it hasn't been updated in 3 years so I'm not not sure if it still works like with the latest version I thought about building my own too but that is one of the nice things about traffic yeah how is my home lab setup non-existent I I get so busy with other things I stopped working on it I want to get back to it though there's some um just like home home lab or is it uh not home lab there's a thing for home automation I forget what it's called I want to run that locally yeah cool but yeah thank you for your question and I will say um if you're interested more in like how to do this stuff in production in terms of like um uh continuous integration continuous deployment and some of the things that you would get with something like uh

kify if you check out this um office hours that I did in the self host 101 series both this video and the other office hours video um I talk about basically how we can do more things to make our our server that is just where we're just managing everything from the CLI make it a bit more robust and give us more features that we uh are used to and stuff like versell or even like in a cool dashboard so definitely check out uh those two office hours as well because I answer quite a few more questions cool all right let's see uh I'm GNA answer a question from twitch I'm G to try to oh nice front end fiend over on Twitch is saying uh wearing my Web Master t-shirt right now yeah they're they're sold out in the store but I think at some point we're going to probably print some more if you never saw it this

one this one it's awesome but they're wearing it right now that's awesome um okay so uh hex exe says I'm a full stack developer I use a vue.js and laravel combo mostly I've been searching for a boiler plate for my view applications I need some basic things like authentication routing caching and data fetching configured and ready to use I've tried creating a template repo but it gets old by the time between my projects what would you recommend I have never used a boiler plate for View apps because the vli does everything I need I get what you're saying though because you probably have like a base set of configurations and stuff that you do in your projects like configuring like you said routing and and different things like that um yeah does anybody in the chat know I know there are specific CLI tools that help with creating like template repos um it might I don't know if it's an external thing but like if you look at the create V CLI tool it's actually pulling in templates and cloning them

Chapter 7 19:37

Boilerplates / Project Scaffolding

locally to your computer but I'm curious if it's using a library to do that and that could potentially be the basis for like creating your own let's see if anybody in the chat has anything yeah why are we so addicted to boiler plates these days listen it makes the job easier makes at least the start of the the job makes a whole lot easier yeah and what's up Pat who says I'm a big fan from Thailand I would like to say thank you to your uh setup MacBook 2024 video I got lots of fantastic Library nice glad to hear it yeah that people are still watching that video I'm very surprised how well that one did uh but let's actually look at create V and uh look at their dependencies and see what they are doing because so back in the day we used to use this thing called Yao man or yo man uh project scaffold I think people still use this technically uh but it's

definitely not used as much um like you can create your own generators and you can see what generators people have here so this is like a spring boot angular generator and they have a whole configuration system for defining your own generators uh but let's see if we look at create V see it's so it has a folder it has all these possible templates it might be as simple as just literally cloning a template into your project whenever you generate it but there are some tools that can like ask you questions and then generate the project accordingly um let's look at their package.json they have prompts minimist what does this do yo man yeah uh parsing arguments yep and then I'm guessing prompts is probably a similar thing so yeah I I would imagine they're literally just cloning these repos into your

folder let's look at their codes um disc index.js Source index create a new V project you answer a question uhhuh uh-huh

and I'm guessing it's just a get clone

make a directory um write the files but how did we get the files read the template directory is it writing one file at a time from the main repo um fascinating okay yeah um so yeah I I don't I don't have a good good answer for you uh if or if we're back at the um that the question that got answered on Twitch which is basically how to create a boiler plate for like a view related application um really just create the base template and then and then clone from there I mean one of the tools that I use is uh npm upgrade so this is is this the one I use I think or is it check updates I was using this one for a long time and

then let me just look at my

CLI npm check updates is what I use yeah and so um the are automated tools for this so if you have a repo that's like your base template you could add um dependabot and it could automatically upgrade your dependencies at least for the ones that are not breaking changes but for some of the templates I have for like Express apis I just do this manually I mean I probably should set up some sort of automation but um if you look I have two starter templates for creating Express apps I've got the express API starter and the express API starter typescript but these are literally just git repos and every month or so I'll go in use that tool to update the dependencies and that's really all they need to stay up to date they don't have a ton of dependencies but this at least keeps them up to date here and then when people want to use this they literally just clone this repo so if you look at the CLI tool that I use to generate

these apps it just uses a tool called deit and so dgit is a command line tool that will give a git repo it'll clone it remove all remove all of the git history and then just give you that base repo so you can use dgit pointed at any repo and it just gives you that repo without all the commit history and so that's used for both the express API starter and the express API starter TS I have a little command line tool that just wraps dgit to pull either of these depending on if you want typescript or not and then I have a react starter template for uh with vit and a few other things and one of the things you can do on GitHub is you can mark your repo as a template and once you do that anybody that comes across your repo can use this button that says use as a template and that will basically clone this repo to a new repo without all the the get commit history and then they have all of your

base project but yeah so yeah no good answers there just manually um and yeah I don't have a good answer for you all right let's jump back to the YouTube chat and get get some answers from there yeah all right question from poo please restock the 3x of the latest t-shirt I know this is not a question but please do it I don't know maybe maybe uh if Scott is listening and he knows anything maybe we I have no idea I think a lot of this stuff it was like it was we did one run of it so I think printing anymore would require a new run I have no idea if we have any plans for that I think that was actually no no no I if I remember right we didn't have any 3xo but for whatever reason it's listed

in the store but we actually didn't have any we only got up to 2xo yeah yeah uh all right this next one comes from uh Ahmed who says you were using the browser to present the question asked on X in your Local Host can we know how to do that I'll show you the code so it's just a little uh git repo uh well it's an astro app of course it's a get repo it's an astro app where I just added a bunch of custom Styles and I'll show you what they're talking about if we look back on YouTube and specifically one of the office hours videos that I did I think like this one maybe hello everyone welcome hello um yeah it's this so you can see um as I'm asking the questions I can like use

Chapter 8 27:24

Custom Comment Slides Code Walkthrough

the arrow keys and the um the questions appear on the screen and it's nice and like branded it looks like syntax

cool but let me see if I can find that repo really quick give me just a moment

but for this I actually used the scroll snap API so I talked about the scroll snap API in my CS CSS video and I think Wes and Scott talked about it in the recent podcast episode too but you can do scroll snapping which basically gives you like slideshow like effects in uh with

CSS yeah here it is uh so it's just a Astro app and then I wrote some code that would pull in all the comments for a given video from YouTube and then allow me to go and check the ones that I wanted and then it exported that as Json and then I put the Json file into this app which just iterates over them it was a pretty manual process but I was okay with it but you can see here if I press the arrow keys these things slide in and uh they're just little cards that I designed with cs and then I have a I was I'm using intersection Observer to see when it comes into view the animation uh plays it into view and uh but they are literally just copy pasted from the uh from the YouTube comments themselves but yeah let me see if I can dig into the code for you so I have this comment

component and uh I did I built it with spelt yeah we we have this intersection Observer so anytime something comes into view we we add the visible uh class name and that animates it in and out uh let me see if I have the CSS in this file or is it

elsewhere yeah um this is just a CSS transform so rotate it and then um translate it back onto the page and I believe the default style for the element is to be off the page so when the visible U class gets added to it it animates on and then when it gets removed it gets animated off because the default style is to be translated like 200 pixels off the screen and so that just happens with the intersection reserver when it comes into view add the class it animates in and then um the after that it's just CSS like I have a a div called user and uh and then a I believe I have a class for like images inside the user class and it just Styles their Avatar then also Styles their username and I did some special things like sometimes there would be like section

headers or sometimes I wanted to display multiple of them so I had like a nested array of

comments like yeah and then like I wanted title sections I don't know the code was all very manual and I did it in the the morning before I made that video because I I wanted like a nicer presentation for it but it's just it's just some pretty basic CSS but yeah thank you for your question

IED

co uh Pao is talking about the uh 3 XL shirts yeah PA says I was awaiting with 3x yeah I I'm yeah if I'm correct we actually did not print any 3xo but would I do some tutorial video on Astro I'd be down to do it so right now I'm working on a a full stack tutorial where I build something from start to finish that's going to be posted to the syntax Channel and I'm doing that with nextjs um but it could be cool to do a similar thing with Astro the nextjs one's going to be really involved though like very long there it's a lot of stuff to make a production ready full stack app uh but it could be cool to do some stuff with Astro as well all right let's answer a question from uh twitch back over to

Twitch cool uh akarin asks hey I've been trying to make an interactive map where I can drag and drop elements onto the map I've tried using the HTML Canvas OR libraries like leaflet do you know of any other ways um no and I've never tried to do this so um I guess if we could describe what you're trying to build um you might have like a panel on one side and then the map itself and like maybe these are like icons that you want to drag like pins you want to drag onto the map and then when you drag them they appear and then you can drag them from there if I had to hand wve even talk about how to implement it let's just take leaflet JS for example um because basically once the thing gets dropped onto the map I would no longer be writing my own custom code for this I would leverage leaflet itself because if

Chapter 9 33:15

Drag / Drop with Maps

you look at leaflet they very likely have a um what is it called a marker a marker and you can customize a marker to um instead of being the default marker it can be an image so you have the ability to actually set what's displayed and so I would combine this with the dragon drop API where your map is the drag Target and on drop um you get the mouse location or the XY location of where the drop happened and then create a marker on the map and then from there a marker is already drag and droppable um I believe if it's if it's Ena like um yeah there's an option for draggable so if you get what I'm saying basically it goes from being just an image on the left- hand side and then you make it a a draggable thing but then as you drag it when you drop it you're

not actually dropping the image behind the scenes you're creating a marker at the location where the drop happened and then from that point the map library takes over and now it's just a marker that can be dragged and you don't have any extra code for that um and I would integrate it the same way even if you were using like map or something like that um so yeah hopefully that helps let me know if you have have more details on that what's up ched welcome in good to see you yeah yeah that was the one front and mpm check updates um best deployment method for View and laravel I have no idea but I do know that laravel has in their docks like they have a deployment partner uh that like a a service that they partner with that helps you to deploy that's like ready to go laravel Forge maybe it's their own thing yeah it's called laravel Forge and uh as far as I know a lot of people that use laravel use this to

Chapter 10 35:46

Vue / Laravel Deployment Method

deploy because it it knows about your app it knows how things are structured and it's kind of config configured for it what's up uh simmere good to see you yeah yeah yeah so yeah aaran that's that'd be the way to go he's like uh hopefully that that helps um yeah and thank you super secret name thanks for the follow what's up it's been a while yeah yeah yeah I remember you from coding Garden welcome in cool cool cool cool cool cool let's get into uh some of the uh YouTube questions as well um yeah so and Nico mentioned it it's Forge for larl what's my favorite text act these days I don't think I have one I think I'm pretty jaded on Tex stxs whatever requires the least amount of code is my favorite thing um let's see what other questions we have though yeah so pronal has a question that I do not know how to answer so they ask how can I migrate my infrastructure from Docker compose to K8 which is

Chapter 11 36:47

Favorite Tech Stack

Chapter 12 37:04

Docker Compose for Kubernetes

kubernetes uh can we reuse all those Docker compose config files to generate the k8's config my guess is probably there's probably something in the ecosystem that um exists to convert it or maybe kubernetes can just use docker composed files ah so there's a package or a library called compose with a K so it it takes doer compos files and then deploys them as kubernetes clusters fascinating it has 9,000 Stars it was last contributed to a month ago this looks like the way to go very cool yeah try that out but again I don't have any experience with it but it's it's composed with a k

yeah yeah and aarin over on Twitch says thanks I'll try it out didn't think of using a marker like that yeah that's that's how I would do it because I mean otherwise you could yeah let's let's just go back to that question really quick because there's some other other ways to implement it so this was uh akar's question about how to drag things onto a map the other way is to have like a transparent over lay element on top of the map um and then you drag elements onto it but then you somehow need to sync that with the map and so that's where things would get really hard because if a user is like panning on the map you need to know the state of that so like when a pan happens and then you need to update your thing on the overlay accordingly it sounds like a hot mess because you're trying to keep those two things in sync uh but if you just let the um the map Library do it then uh it'll probably be easier to manage um

yeah welcome in that random dude who is super secret over on on Twitch um let's see any other questions Ral Springer is asking can you explain the backend for front end concept or pattern I have never heard of it so let's learn together backend for front end and P turn let's make an educated guess as to what this is um maybe this is some kind of architecture for how you structure your like data access code even though it is still client side code or frontend code and that that would be my guess is like basically you're architecting your code so that you're not making API requests like delet directly in your codebase things are abstracted away so that way you're interfacing with this like data layer and that in turn is talking to a rest API or or whatever else but let's see what it actually is Microsoft has a

Chapter 13 39:16

Explaining Frontend for Backend Pattern

document on it there's a medium post the back ends for front ends pattern create separate backend services to be consumed by specific front-end applications or interfaces this pattern is useful when you want to avoid customizing a single backend for multiple interfaces okay I was completely wrong uh initially this is making me think of like API Gateway way where you have uh multiple backends and then some kind of Gateway that brings them all togethers that is in turn proxying requests to those various backends um so the context in the problem an application May initially be targeted at a desktop web UI typically a backend service is developed in parallel that provides the features needed for that UI as the application's user base grows a mobile application is developed that must interact with the same backend the backend service becomes a general purpose backend serving the requirements of both desktop and mobile but the capabilities of a mobile device differ significantly sure sure sure these differences result in competing requirements for the

backend the backend requires regular and significant changes to serve both desktop and web okay so we're going to EXT abstract out the common functionality to one backend service and then your web will make requests to some kind of intermediary that is specific for web but for all the generalized things go to the other service create one backend per user interface issues and considerations wait never mind it's not even that it's literally just two back in services for different

frontends huh that sounds like a lot of extra code I and I guess maybe if you had some sort of like mono repo setup you would bring like all of your shared types shared data access into maybe like a shared library and then both of these backends use that um but in my mind you're going to have a lot of duplicated code between these two so I would go one step further I would have like a backend for my back end and then everything that can be generalized lives there and then anything specific to desktop or mobile will live on this service but any requests that need to go here Will Travel via proxy through that service yeah

fascinating what else do we let's see if anybody says anything different about it because that was that was what Microsoft said about backend for front

end yeah and this is kind of what I'm talking about so like you would have these these services that would be each each type of app would talk be talking to you directly but that in turn would still proxy some requests and services to services so that you don't have a lot of code duplication okay what do I think about the pattern I think it makes sense but um it's also possible to have just like a single code base where if you structure things in the right way and you have your endpoints structured in the right way uh you can you can get away with still handling multiple multiple front ends and I think the other thing is you should flip the problem like your backend stays as a generalized data access and data and authentication and different things like that and then your front ends have the custom logic that use that data in various ways if that makes sense cool but thank you for your question

R all right what else do we got cool so Arvin has a question just the person I wanted to ask uh working for an MNC this process is killing me code progression uh to prod takes one month I'm continuously in a state of Terror do you have a guide uh what does the MNC abbreviation stand

Chapter 14 43:45

How to handle slow work environments

for I mean what you're describing sounds like uh a corporate environment um multinational corporation is that what it is that's probably what it is right um but uh my advice is there's not much you can do I mean so I I worked at a multinational corporation and um every single app that was exposed over the over the web um had to have a security analysis and there were tons of checks and balances in place to to prevent security incidents um and then beyond that once an application is in production there's a ton of checks and balance balances in place before updates can be made to make sure that those updates are also compliant it's just the way things go um I think you could potentially have um I don't know some kind of like local

branch where maybe you're working further ahead than you can be on like the main branch um I guess my main advice is just accept it like this is the way things are so you're going to have to work within within the confines of taking a while before your your stuff actually gets pushed yeah I would say don't be terrified maybe enjoy the fact that um things aren't moving fast because in other Industries like in in startups and stuff like that things move very fast and for some people that can be that can lead to burnout but what you're describing right now can also lead to burnout which is crazy to think about but like the lack of things to do and like just sitting around waiting can also lead to people burning out yeah I don't have any good advice if you have any advice in the chat feel free to throw it in but yeah my advice is accept that that is the way it is and do your B do your best to uh work within those constraints yeah hash says y'all need to do an episode on sight reliability engineering

um all the stuff I know about devops and stuff like that I just taught myself and kind of just did on the job because I needed to I've never officially been like a site reliability engineer it might be good to get someone as a guest on the podcast that's been a site reliability reliability engineer or something like that yeah all right Dali has a question what are some of your favorite react libraries or Dev tools what might be your Go twos when starting a new project let's think about it so um if if I'm building a react Client app that's talking to an API I very likely am reaching for tanack query um and the thing is when you're building decoupled applications where you have like a separate rest API and then a separate single page application or or client um most of what you're doing is interfacing with that API and so what's nice about tanack query is a lot of times you might not even re need to

Chapter 15 46:22

Favorite React Libraries

reach for like a a global State Management solution because tanack kind of takes care of that for you and the idea is you have a query client that wraps your entire application and then uh any components or whatever that need to uh make requests are all dealing with that same query client and so that query client is caching things it's it allows you to basically share them between two components because when a request is made gets stored in the the tanack query cache and if another component has this exact same uh query ID if that request was cached the data is available instantly so uh before a library like this existed you had to use something like Redux and async actions and you would then like store it in the Redux store when an async action happens and then you'd have to implement caching yourself and then you would use Redux to get that data into other components but uh with tan stack this is all you would need and now the data associated with that inpoint as long as it's it's still

valid can be used via any component just with this code that's using that query and then tanack has built in things for saying like invalidate query so like a common example would be you have a list of to-dos so you have a query that gives you that list back from the API and then you have a mutation that creates a a to-do uh like this uh so you can say use mut and so this makes like a post request but typically what you combine this with is an invalidation so after this succeeds you then invalidate the list of to-dos in the cache because now there's a new one and then the cach will refresh and then any page that needed that list will have the latest data um so let's see where they do that there's like an invalidate somewhere on success you could call like invalidate

yeah or you can just call the method directly so on success you would say invalidate and then pass in like the to-dos ID and then everywhere else in your app that was dependent on that list would now get refreshed so yeah if you if you're heavily interfacing with apis or anything that's like promise based in your uh react application which is I guess is typically apis tan stack query is definitely the way to go um beyond that these days is when I'm reaching for a component Library I have mainly settled on Daisy UI which is built on top of Tailwind um so alone you can just use Daisy UI with tailwind and then you don't need like uh extra components or anything like that um but you do get these classes like button neutral button primary and then you get some nice Styles uh but there is a daisy UI react which is a component Library wrapper built on top of Daisy UI or react Daisy UI is what it's called and this gives you all the components of

Daisy UI but instead of having class names you can just directly import a button component so if you look at their docs they have for example a button and the way that you bring it in is by importing capital B button from the react Daisy UI and then you can use these components so uh that's the component Library I reach for there are others um but has been fitting my needs especially if I'm not doing something that's like highly custom or highly stylized I can just use their themes or create my own custom theme and I'm good to go um what else I don't know let me know in the chat does anybody have any suggestions for libraries or Dev tools that are in every react app that you build I'd be curious to to see curious to know

yeah don't use reacts as super secret name but what if you are using react

uh yeah uh AV roomy says I've been using mantin and Shaden for UI components uh tan query does not perform well with next chest especially with server components I have not tried that combination um because it seems like with like server components and server actions you're not really using a secondary Library everything is just a request but I don't know uh but let's take a look at mantin because I looked at uh Shad CN UI which is very interesting but the one thing about it is like you you don't actually install anything so very similar to how uh there were like Tailwind libraries that came out that you just they just provide the CSS classes classes and you're supposed to copy paste them that's the same thing for Shad Cen UI like if you want this accordion they're going to give you um all of the code to to create that accordion and then that code lives inside of your your code base uh they do have a CLI tool so if you do this uh if

you do an AIT first it sets up all the config and everything and then when you do add accordion it's going to create an accordion component in your code base but it has all the code it's not importing anything from another Library it's all the code for that specific component this makes a lot of sense if you are building highly customized and highly branded uis right because you don't always want to like create a fully accessible button from scratch but you might want to change the styles to more of an extent than you might be able to change them like in Daisy UI so that's what Shad Cen seems like it's really good at is uh you want highly customized UI to like fit your brand and stuff like that um and I do believe they're using radic under the hood because radic is all about accessibility

right or are they a pre-styled component Library yeah so Andre is saying some components use radic UI underneath it's possible that they're pulling in some of the uh underlying functionality and then like maybe this is like highly customizable in terms of styles fascinating

cool and then uh DK we were talking about like earlier I was talking about using tan stack in a client app and DK is asking why would you need tan stack for react server components I'm saying you you wouldn't because all of your data loading happen would potentially happen in a server component or in a server action I mean the main reason you would want something like that is to have a uh a more single page application like experience right like not having a full page reload and request and being able to update that page itself not necessarily going to a new page yeah all right let's see if there are any questions over on Twitch and we'll jump into those as

well I wonder why a mobile needs a different backend are they storing some other config in there that they don't need for web so this is a question that was related to the backend for frontend question uh that came up earlier and um my guess is they just need potentially need data structured in a different way which is why my instinct would be to just restructure it on the client side right the back end stays the same but then the client will adjust that data the like the mobile client will adjust that data as to what they need I'm not think I don't I don't I couldn't imagine why any sort of configuration would be different I think it's really just a matter of needing the data in a different structure based on how the pages are laid out and stuff like that okay super secret name has a question is it worth keeping a public API for a service separate from the client so that if the API goes down from the users the client is fine or vice versa I've seen that everyone says that

Chapter 16 55:08

Seperate Web API with Next.js

next API is better than Express but I'm not convinced what are your thoughts um I think it's really cool that NE when you build apis inside of next and you deploy them to versel all of those API functions become serverless functions like for free uh not for free I mean you're you're paying for the serverless invocations but it's a whole lot less configuration than if you were to try to do that stuff manually like with AWS AWS Lambda and like API Gateway so yeah the fact that you can have a folder called API with a bunch of handlers in there and then it just gets deployed in the right way and you can just easily call them from your next app I think that's really cool um and the other aspect of that is getting better like type integration and also being able to share code because it's in the same code base you can Define your types in that same code base and you could structure the code in a way where those types are used both in your backend and in your front end code um whereas if you had a completely separate expressjs app you'd have to do a lot more to be able to share the types

between the two um it's possible like you could use something like and if you structure your o your and have a def an open API definition for your expr app there are tools that will let you take that definition and turn it into typescript types and then there also tools that will generate a uh request client that can be used that integrates those types as well um but yeah I would probably say the main reason is also like e ease of integration right you don't have to have a separate backend deployment process all of your API code can just go in there it's a single deploy I think that's the the reason that a lot of people choose choose to build API routes inside of next is it's also uh a very uh it's very low lift for someone who's new to backend as well you don't know have to know about all the intricacies of like middle Wares and everything else you just Define your API function and then you can call it in your front end and hey look you're a full stack developer now so that's probably why um

I still I like to build things that are like completely decoupled but I probably wouldn't use nextjs for that I would just use like V react and like react router it would be a complete single page application and then that could talk to an API now you don't get any SSR or servers i' rendering with that but uh for a lot of applications you don't need that it might be an internal app um or just something that doesn't need to benefit from uh being rendered on the server and that's how I build a lot of things yeah have I tried the new uh view Dev tools uh I haven't used the Chrome extension but you can add it when you're generating a view project you can add it in and um they look cool there's like there's like a little button you can click and it like pops up in the UI I haven't delved into like all the stuff you can do with it though all right let's jump back into YouTube questions let's see will I make a series comparing spelt with reactor

view I don't know I will say that Scott is working on a a full tutorial for spel 5 when spel 5 comes out so that'll be interesting definitely keep an an eye on that I know I think I'm done with the the front end comparison videos for now let's see what

else uh DK is asking what's your take on using SST versus avps um I've never used it before so I know SST I think is from Dax and it's how you uh can deploy nextjs to AWS infrastructure right something like that is is this the thing I'm thinking of yeah build modern fullstack applications on AWS so you can deploy um nextjs felt or Astro to AWS in a streamlined manner because if you were trying to deploy these in a seress way without this tool it would be very cumbersome very cumbersome to do um but uh this basically you you give it your AWS secrets and and such and it's able to provision all the things required to get this stuff deployed yeah so you can have like S3 buckets Etc so uh my take is if you're already

Chapter 17 58:40

SST vs VPS

using AWS infrastructure and you want to have something that's like serverless without a lot of config it it seems great um if you're trying to host a single nextjs app on a single VPS um that's probably fine for like low traffic sites but the the whole reason we deployed to like serverless is being able to uh handle high traffic because the the serverless framework or whatever else is is handling all of that for us we don't have to worry about spinning up servers or spinning them down so seems cool I would I would use it if I if I had a reason to uh Jethro is asking how do you structure a node API I have some basic templates that might help with that um so if you check out github.com W3 CJ Express API starter um I always have a source

Chapter 18 1:00:16

How to Structure Node.js APIs

directory and then I always have my app separate from the thing that actually starts the app so if you look at index.js this just brings in the app and then starts it up and the reason you want to have those separate is if you're running tests you want to be able to import the app directly inside of your test instead of starting up the server so the app itself self gets defined here and uh then any routes will get defined in a separate folder and I also have my middlewares just uh defined separately so if you look I have a middlewares file that has a couple of pretty common ones I think if I had more custom middleware than this I would probably create a folder for them and then like have multiple files and then have them imported here I might even have like a top level use middleware which in turn loads in all of my middlewares I realize you can't see this code cuz the question's in the way uh and then from there all of my routes are in separate files and folders so if you look in the API folder I've got my uh main router here which then loads in all of the

other routers so the main purpose of this file is to import every router defined in this folder and then map it to a specific URL so in my basic example here I have an emojis router that uh responds with Emojis and then in this file it gets mounted at/ emojis so when you go to/ emojis it's going to load this router and then load that specific uh Handler and response uh Beyond this so this is like a super basic structure but your routes might get more complex because you might also have like models um or controllers or various other things that are associated with that one specific part of your app and if that's the case I would put it in a separate folder so like I would have a folder called emojis and then inside of there I would have a file called middle is a file called controller a file called like data access um and that way it's nice and confined to that one specific folder I

like to do I like to have uh features by folder is is the way to describe that the the other way you might see like in a smaller code base is you might have a folder for controllers a folder for schemas a folder for routers and then separate them that way but that gets really hard to manage once each of your individual routes starts to have more and more stuff so yeah the feature by folder uh structure is the way to go and uh beyond that there's a repo called node.js best practices and they detail a lot of this stuff node best this is the one it has 97,000 stars um but they talk about uh project architecture practices and so they talk about uh how to structure things and this is kind of what I was talking about where you organize Things based on their feature name not their type name like it's not models schemas controllers it is this is a feature of my app and then within there you'll have models and

schemas and controllers and stuff like that um so yeah definitely check out this repo because they they have a lot more advice Beyond just like project structure they also talk about like airor handling and code

style yeah and see you later super secret name thank you for hanging out cool all right uh let's grab another question from twitch um or not there's not really any questions but front end F says I haven't used Nu much but I love the dev tools glad the view Dev tools are looking more like that nice I haven't even seen n in like over a year so I should probably try it out and check out the dev tools um yeah all right let's pick another comment from or question from YouTube

Chapter 19 1:04:32

Sharing Types across repositories

how can you get the response type from an API using Prisma and Express in a web app if both are in different

repositories the easiest way would be some kind of relative import right so typically we would manage the way you would manage this uh is with a mono repo where you could have both of those projects side by side and then you have a shared project that has like your shared types or shared schemas inside of it and then that can be imported into into those other two projects but if they are completely separate repositories there's no easy way to do it you like you could potentially add one as a git dependency of the other um because if you didn't do that you could technically if they live next to each other in a folder you could have a relative path import but that might actually break on other people's machines if they don't download both repos and put both of them side by side um so It's Tricky um but I think I have I maybe I can find some

examples um trying to remember which app I did this for yeah I think it was over on coding Garden I was showing how to build like an Express API with typescript and then building a um a react front end for it and showing how to share the types between those two projects and I just did it with relative path import and it's not ideal because those folders actually do need to live next to each other so for example I have my Express API defined here and let's see what inpoint I have yeah I have a to-dos folder here we go I'm just I'm showing you a better description of what I was talking about earlier like folder structure because if you look in here I have the to-dos folder and then inside the to-dos folder I have handlers models routes and um if we look at handlers it has all the endpoints for talking to the database and responding with to-dos but if we look at the model this is actually defined with Zod

and I'm going to go ahead and um me move this down a little bit there um yeah so I defin my model was OD but this type I want to be able to use this same type on my front end because I'm making a fetch request to this endpoint and then iterating over these to-dos to show them in a list and it would be really nice if I could actually use this type in my client side code and so the way I did it in this example is a relative import so these two projects live side by side but if we look inside of here and we look potentially at my API I am oh I put them in a common place to to make the code easier to manage so I created a types file but if we look in that types file that types file is actually importing them relatively from the folder above it right and um that's one way to do it now uh this is not

ideal um if uh if you have a setup where those two projects aren't going to be side by side right because if these were living in two completely separate repositories and someone cloned down this client it would just fail to build because this file wouldn't be accessible they would have to EXP licitly put that other folder right beside it um but you could put them into a shared repo you can convert to a mono repo that might be one way to do it um ultimately the like worst case is you just have the types exist in both places um so uh you could um like generate the types using uh Prisma and then like just copy paste those into your other project but then at some point they're going to get out of sync uh you could also use the uh an extension that that is like paste Json as types so make a request to that specific endpoint and then get back the response convert it into a type and then just paste that type into the codebase that needs it but the the main

issue with with both those scenarios is if the API ever changes now your types are out of sync so the best way is to have a monor repo in a shared Library second best put those two folders side by side worst case just duplicate the types in in both of the projects yeah thank you for your question

Co let's find another

one uh I have to do a thing on Twitch chat give me a second

no mods I'm the mod all right let's see what else YouTube has to say ra asks why is there so much of a move towards SSR over Spa nowadays isn't the spa pattern still relevant in a lot of use cases yes and don't let anyone tell you that it's not um SSR makes sense if you have uh content that needs to be search indexed and um uh when when web search engines are crawling the web if they come across your site and server side rendered it's going to load faster for the crawler and it's going to have all of the content for that specific crawler um so that's one reason to have SSR um and then I mean you could also make the case that like the initial page load for SSR a lot of times is faster because there's not multiple requests that need to happen because with a single page application typically the page loads then like fetch

Chapter 20 1:09:38

Why the move to SSR over SPA

kicks in to request some data and that requires another request and then the page updates um but I would argue that like over time as the user uses your application it kind of like levels out because typically with a single page application you can deliver all of the the JavaScript and basically the entire client site that the user needs on the initial load so that you pay that price once and then after that the only price you're paying is a request to an API um and there's Nuance to that too because you don't have to load the entire applic application you could also have lazy loading of pages and components where the main shell of the website loads on initial page load but then as if a user goes to a specific page that downloads the JavaScript for that page dynamically but that also gets cached so the next time they come to that page that's already cached and literally all they have to do is like make an API request I don't know I like single page applications a lot and um I think um you you see a lot of them on uh in internal

applications right so people that are building things in Enterprise like internal dashboards internal tools where there's really no reason to have serers side rendering because it's only being accessed by the people that um actually work at that company and have access within that company um so yeah Spas still have their place and uh when I worked at a consultany we would typically have a strategy where if the client needed some sort of like landing page or marketing website we would build that with WordPress but then the actual application would be at a subdomain like app.you company name.com and that was a single page application that like talked to an API because a lot of times we had clients that would not only have a web app they would also have a native app so like a native IOS app and a native Android app we weren't really using native script for anything at the consultancy I worked at and um when you're dealing with uh Native um iOS or Android they typically are talking to

some kind of API so it made sense for our architecture to have an API that could be shared by the mobile app and also the web app I don't know uh I guess the other aspect of of this is to why there's such a move I would say there's a move I would say there the conversation has moved and especially if you're on Twitter a lot because on Twitter we hear a lot from versel and react and nextjs and uh their business is in serers side rendering so it would make sense that you would hear a lot of it um but I'm not convinced that everything should be converted to it and um you could even get into uh the idea of building things with like HTM X and some other back backend that does the the rendering itself because then you have less clients side JavaScript um but again that architecture kind of only works to serve a single type of client an HTM X client if you have any other type of client like a desktop app or a mobile app you're going to need some kind of

API or separate endpoint that serves those specific clients which is why almost all the time I keep falling back to the idea of well yeah it just makes sense to have a generalized API here and then any of my clients can talk to it so I don't know I don't know I wouldn't even I wouldn't even say yeah actually I guess technically like with nextjs and SSR they're not really monoliths like it's a monolithic code base but technically gets deployed in a distributed serverless way I don't know um I don't think Scott is here right now but uh he is he's the one working on the spelt tutorial series and I believe it's learning spelt from from the ground up by building things and specifically spelt 5 that's what his tutorial is going to be winter qq1 asks what do I need to start applying for Dev jobs you need probably some personal projects you probably need a personal website you

Chapter 21 1:14:13

What do you need to start applying for dev jobs?

need a resume you need to be able to have the skills to do the things that are asked of you in interviews which varies depending on the type of jobs that you're applying for but a lot of times companies require that you might need to do like leak code or whiteboarding and so if that's the case you should know how to do those things as well I'm going to see if anybody had any comments about the the other stuff that I was uh talking about yeah what am I using for my beard nothing nothing thank you for your question though M uh a com a com um and then on the point of like SSR and stuff like that uh Mr rapic is saying I love to use trpc but it keeps my Types on sync and it keeps my Types on sync the projects are not so huge so it's worth it yeah and I think uh I think especially if you already have some sort of like mono repo setup using something like trpc is huge like you don't

Chapter 22 1:15:08

Using tRPC

necessarily have to Define like a Express API or something like that you could use trpc I think the main issue comes again is if you have clients that are like Android or iOS I don't know if they actually have like a trpc client you would end up just like using the rest API itself so that's when it becomes a little bit trickier and when using something like open API with like a client code gen maybe will work better because they have code generators for like native iOS and Native Android but if you're if you have full stack JavaScript trpc makes a lot of sense uh Amed says we have all these stack Frameworks do you think it's a good idea to bring server issues to frontend developers to debug and solve I always find it really painful to use the debugger I mean I think every programmer could benefit from learning how to debug better but that is one of the downsides of uh moving to more full stack is you have people that potentially aren't ready for it or maybe don't have the the debugging skills or the backend skills to figure out the issues when they

Chapter 23 1:15:52

Frontend Devs are now Full Stack

happen they're just kind of given nextjs and I think this is happening with a lot of programmers they were used to just writing like client side react but now all of a sudden they're companies using nextjs and now all of a sudden the API endpoints are in the exact same code base and so they're be asked they're they're may be asked to implement those features as well um I don't think it's anything you can't learn but um yeah I think getting used to to using like interactive debugging as as well as is also an acquired skill yeah and so on the on the uh idea of SSR so in initates is saying I think the move is also because you can SSR and client side fetching in the same app so that gives flexibility yeah so that gets into basically like hybrid rendering so like with a nextjs application it is possible that the initial page load is server side rendered and then from there it kicks in and behaves as a single page application um but then the story gets a

Chapter 24 1:17:03

Hybrid Rendering

little merky or tricky when you start talking about react server components unless you're using something like server action but there's advice that server actions should only be used for mutations not for fetching data um and I guess technically if you navigate to a separate page inside of a react server component nextjs application once the page is loaded if you're navigating that still technically just happens on the client but the server components themselves are typically entire pages so if you're navigating I don't it's hard to describe the architecture gets really tricky with server components uh but yes you're right you do get like hybrid hybrid rendering technically but it gets a little bit trickier uh once you're dealing with react server components you you potentially might combine that with API requests but yeah yeah how are you unit testing es

Chapter 25 1:18:16

Unit Testing ESM

modules I'm currently using just and it's a bit of a nightmare as you need to compile esm nodules to CJs before starting the tests uh is if vest has an answer is the migration worth it I don't know if they have an answer exactly but I have used the I think it's like the vest typescript Runner or something like that or it just like supports typescript let me see um in this re uh react TS starter I believe I'm using Vest in this

so this is using Vest and then I think our I think it just works like my setup files are just in typescript yeah like setup test is just a TS file and then uh vest is able to pick that up so uh literally just run vest and it transpiles on the Fly um and so that's specifically with typescript I imagine it'd be able to do the same thing if you were just in uh module mode I can't confirm it though I mean I guess we could try should we do that should we set up a quick uh repo and like try to unit test some es modules with uh vit does but I guess clarify Dale does that mean you're not using typescript you're just using esm I would be curious to know

but who wants to see that just say say yes in chat if you want to see me set up a repo and try to test it with uh vest esm with vest oh yeah and poo is saying it is worth it to switch so apparently that's the case uh Dan says this whole stream setup is awesome what advice would you give to someone trying to grow with technical content creation just keep at it just keep going I mean I've been doing this for a very long time and so I think that's how I got somewhat decent at it is just the amount of reps like if you at my coding Garden Channel I have like over 500 live streams that I've done

Chapter 26 1:20:08

Content Creation / Stream Setup

um I guess technically it won't list all the live streams because some of them eventually I started only streaming on Twitch um but yeah my advice is just do it and do it a lot and you'll get better at it and you'll also form your own opinions and find new tools and cuz my whole stream setup right now has like evolved over time like I'm actually using a legit uh mirrorless camera I used to use like a a USB camera that worked well enough um and I'm just using the uh sure mv7 which is a USB thing seems to work for what I need um and then I I've used OBS so much that I I've gotten really accustomed to like overlays like this this over the the way that you're seeing the chat message pop up is a Chrome extension that provides a browser overlay source and then I have that running inside of OBS and then beyond that just today I um I set up

these borders in like the animated background animation um but these are this is actually like a looping video file so if I disable the chroma key this is actually what's happening this is a a video that's looping if you look at the background it's like animated it's like the the syntax logo is zooming in and out and the background is zooming in and out but then I just chroma key those sections out and then load my video into them there's other ways to do it there's there are plugins for OBS that will actually like allow you to add borders and stuff but I don't know my advice just do it lots of practice uh yeah you'll get there and also focus on community for for me coding Garden had a big focus on community in terms of just like being nice to people answering their questions um kind of being being on a regular basis too so people knew when I would be live and would be able to tune

in and knew that they would see the same faces in the chat and stuff like that so

yeah cool let's get a question from twitch

chat at least they were play yes someone was advertising like their stream service I don't know what's up Ed welcome in um have you found any barriers to developing C on a Mac no I as long as you're using the latest net platform it is fully crossplatform if you come across NET Framework or one other thing those don't work on Mac and if you might find some libraries that only support though but as long as you're using libraries that support the net platform you should be fine um this was probably like four or five years ago at this point but let's call it four years ago let's call it three and a half years ago um uh I was doing some C work uh at working at the consultancy that I was working at and it was actually insane that I was able to uh not only write the code on my MacBook but I had Microsoft SQL Server running

Chapter 27 1:23:00

Barriers to writing C# on Mac

in a virtual machine all on my Mac so my Mac was like a full-fledged Microsoft development machine um which years ago you probably would have never thought something like that would happen but yeah I haven't I haven't run into any issues okay Andrew has a question who says I'm working on a dashboard of live camera feeds and camera sensor data each camera has its own websocket connection what do you think would be the best way to manage all the active websocket Connections in react app along with all the state I need to get some of the data in multiple components zand is probably your best way to go uh Ze Ze Zoo but basically you can create a store create this in some other file and then uh use that store in any of your components and uh this store could potentially have a list of like stream URLs you could have a method for adding a stream URL or removing one and then your components can say used store they could get access to that list and

Chapter 28 1:24:05

React + Websocket Connection Advice

ask for like a specific URL like a specific stream from the state is probably by far the easiest way to do it um you could use the context API but if that data is changing frequently you you might run into some performance issues so I would say go with go with zand yeah yeah uh best way to manage all the active websocket connections yeah so you might do that now um I maybe you didn't see this Andrew but I I released a video recently on syntax where I show how I built a stock dashboard in both View and react and uh it is this video here and so this uh connects to the io finance stock API and um you can add

multiple stock symbols and it gives you a little dashboard but all of this is managed via a single websocket connection and then all of my components are talking to that library to say subscribe to this specific stock symbol but then the underlying Library just handles all of that with a single connection so that might be the way to go too is you basically create a a library outside of react and then interface with that library inside of zand um probably probably the best way to go if you look at the repo for this you can see how I did it um where if you look in the react example source and then pages and then stocks there is this Yahoo F Finance file module um and ultimately this module exposes a few functions it exposes uh initialize the websocket connection close the websocket connection subscribe to a specific stock symbol unsubscribe

to a specific stock symbol so all of the hard work of sending websocket messages and validating them and receiving them and everything else all of that is handled in these functions here but my react code only ever calls these methods it doesn't have to do any of the specific work um so if you look in the main page the page itself initializes the socket connection and then the underlying components like this can subscribed to a specific one but because they're using that module it is handling the websocket message is and websocket connection under the hood so that's probably how I'd go about it use something like zo stand and then um potentially abstract out all of the complex logic and then just call methods from your react apps in react components instead of doing it in there directly yeah thank you for the follow laser appreciate you all right what else do we got uh

Chapter 29 1:27:47

Learning Dev in 2024

pral asks if you had to learn app Dev and react native in 2024 how would you go about it go to the docks first anyways um but uh the answer here is probably Expo um let's just see if we search react native what do we find okay we have reactnative dodev I think yeah I think it was it was announced at react comp that they officially um you should be using Expo along with react native yeah start a react native project with Expo um but if you're asking from complete beginner like someone who knows nothing about programming you do do not jump immediately into react you should learn the the core ideas behind HTML CSS and JavaScript before diving in and then I would learn react outside of react native so you just understand how like the render cycle and how components work in react and then potentially jump into

react native that would be my path and use Expo to do it because they have like a CLI tool and and everything else um I realize that's not a super detailed answer but if you have more clarifications feel free to ask uh D says I'm using typescript 2 my J config is using tsj under the hood to transpile I think just just becomes sticky when working with esm or JS files from node modules I see okay I think you probably here's the thing uh I have I have personally done it in a not so complex app but and um I have converted from just to V and A lot of times all you have to do is replace the import or potentially modify your setup test file and it just works so maybe maybe you try it in isolation so like just create a branch npm install v test and see how many errors you run into just by swapping out v test for for jest

Chapter 30 1:29:02

Converting Jest to Vitest

or or for tsj uh because in a lot of cases it kind of is like a drop in replacement I need to show your my OB asking thing I've never really shared it before it's just a bunch of uh I guess am I going to if I show this on screen am I going to reveal anything I guess I won't uh so I have my uh starting soon scene um and it's just a scene that has like a an animated logo thingy um and then I've got this scene and then this scene it's not it's actually not that complex I have all of my cameras and microphones everything set up in here one thing I do have is the uh move plugin so this is a a plugin that gives you the move transition so you'll see when I go from this scene to

Chapter 31 1:29:52

OBS Configuration

this scene the camera uh kind of widens out and expands out um and that's because of that move transition and then the other thing is if you're watching on Twitch you should have access to subtitles and that's because I'm using this plugin which adds close captions and so that sends the Clos captions along with the stream so that way you can look at them directly on uh twitch

yeah cool yeah you're you're welcome Dan just keep at it keep at it keep doing

it um H says I've had a question before if you need some more questions we'll see let's see what else we what else we got and how long have I been live uh an hour yeah we probably got another 30 or so minutes of stream left what's my thought on getting an iPad um iPads are cool um I have my wife's old one but I don't use it that much but it is cool when I need it because I have uh the apple pencil and whatever the main drawing app that people use is and I've used that in a couple of the videos on the syntax channel so if you have a use for it like if you if you need a tablet an iPad is probably you can't go wrong well so Daisy has a question uh what have been the most handy SQL functions to make data reports and comparisons easier and are there any particular sites or tools you would recommend to help someone get better with tsql I don't think I have any advice for

Chapter 32 1:31:36

Thoughts on getting an ipad

this um most of the apps that I've built the queries are customed to every endpoint that I'm creating and I haven't really worked very much with like report creation i' I've done things that create reports but it's really just all based on the same data that's being used inside the the app I'm using or the app I'm building with maybe a few Transformations or summaries or whatever else I don't have a good answer if anybody in the chat does feel free to share them yeah uh and W Kim says says I just want to say your vids really help me level up myself hame glad to hear it walk cool but yeah poo if you're still out there and you've got any questions feel free and uh Kil has a question what are your thoughts on Rails and Hotwire Resurgence obviously all Enterprise VC back startups will go the the typescript and JavaScript route but it seems like

Chapter 33 1:33:09

Rails + Hotwire resurgence

if you want to just build solo projects is that the way I have not looked into it um is Hotwire the thing where it like it's like react over the web what is what I don't even know I don't even know what hot wire is um HTML over the

wire it's an alternative approach to building modern web apps without using much JavaScript by sending HTML instead of Json over the wire this is like HTM X right

hot rails learn how to create modern single page reactive web applications with Ruby on Rails without any custom JavaScript code

fascinating I don't know much about it I'd have to do more research so my thoughts on its Resurgence is I didn't know that it was resurging um I I I don't I think um probably the reason startups would pick something like react or next is just because of its prevalence and the amount of people that know it like um Ruby on Rails used to be the default for a lot of startups like seven eight years ago um which is why now you actually see job postings for rub on Rails jobs and uh it's hard like rails developers are harder to come by but the reason you see those posts is because these startups use this Tech to uh build their app build their company back when they started that many years ago um but it was never not bad like Ruby un rails is like super all-inclusive like you can literally have an entire crud app with a UI and a backend in a single

line of generation code um which is amazing and there's not much like it in the the JavaScript World there there are some things that try to be like there's the sales JS which tries to be kind of like the uh Ruby on Rails of of the nodejs world there's also adonisjs which is probably closer to like laravel but still tries to be like allinclusive um so yeah that's my answer is that I don't know uh let's see yes so poo has a question about um async local storage let's see

Chapter 34 1:36:25

AsyncLocalStorage Support Across Runtimes

from your knowledge is async local storage generally available in all runtimes do you have some resource like can I use for runtimes where I can check if it's available um let's

see what is what is async local storage is it in it's in nodejs maybe there's like a polyfill yeah because this is a nodejs API I see but you're saying run times so like if you're running inside of bun or Dino do they have async local storage I have no idea I've never actually used this um I'd be curious if there's some kind of like generalized polyfill that could be used like in uh bun or Dino or something like like that yeah so they do have the no so you could so because uh dino now H now has like node compatibility layer you technically can bring it in from node acing Cooks fascinating what about

bun the issue got closed does that mean it it's there oh yeah I got merged in last year so you can technically use it inside of bun too um personally I don't I don't know where you would look for this like there I don't I don't think is there a can I use for backend run

times I know there's like the kangax compatibility table um but that's just for like ecmascript and I guess technically async local storage is EAS script is

it yeah this is the es6 compatibility table this is the one that I always used to go to because it has uh like engines and browsers and everything

[Music] but yeah uh I'll look at the latest chat yeah poo says it's a server API for the moment uh they plan to add something similar in the browser but I'm more interested on the run times Cloud FL workers should also support it but I can't really find any utility that shows everywhere I see what you're saying Yeah so basically we're looking for something like this but for no J but but for JavaScript run times um because this shows ecmascript features um let's see if it's even listed under async local let's see if this can I search their site I don't know uh if this doesn't exist you should create it because that would be great um JS runtimes compatibility

supported table

yeah I don't know of anything um aside from going to each of those respective runtimes and seeing do they support that specific thing so yeah I don't have a good answer for you all right but we do have a question from over on Twitch from uh laser who says I'm a junior developer in Ruby on Rails in web I find it difficult to combine react for the front end and rails for the back end to stay competitive in the job market do I need to stop stop using rails thanks for your constructive advice another question if possible why do most devs hate Ruby on Rails and why I don't know if this question had already come in after someone had talked about uh Ruby on Rails and like uh Hotwire okay let's but yeah the first question uh to stay competitive in the market do I need to stop using rails um it depends yeah I guess it depends on where you live um you should I'm guessing this question is coming from the fact that maybe you've looked at blog you've looked at job postings in your area and you're not seeing as many

Chapter 35 1:40:13

Advice for Junior Ruby on Rails dev

fubi on Rails as you as you are for react um in my experience the the postings that are for Ruby on Rails typically are asking for like senior level developers because typically they have like an older code base and they're trying to get someone more experienced in um so yeah it's going to vary wi widely depending on the job market and like where you live but uh I don't think you need to stop using it I think the the other um the one of one of the things about Ruby un rails is it it kind of it hides the complexity of a lot of the things that are involved with like building backends and building apis um which makes it harder if you haven't done the work to try and understand the underlying principles um because the thing is if you want to combine something like with Ruby on Rails with react you could just treat Ruby on Rails as a backend API and uh it's probably possible if you look at Ruby on

rails uh Json API basically we want to build our backend with Ruby yeah using rails for API only applications so basically we would use rails to implement our backend it would talk to our database it would Implement some kind of Json API that exposes endpoints for getting data from that database and putting data back into that database uh but that's all it would do and then you could build a completely separate react app that just calls that API and then earlier I talked about this thing called tan stack tan stack query so this is a library you can bring into react that makes it a lot easier to integrate with rest apis or or Json apis inside of your client side react apps uh so that's one approach I would take uh because beyond that thing I don't know if they have any solutions for this but it gets much trickier if you want to have like a server rendered rails app where then a react app kicks in once the

page has loaded uh that seems like a lot trickier to do I don't know if they have any sort of um templates for that or examples of people doing that out there in the world but in my mind the easiest way to do it is just use rails for your API and then just have a completely V powered react app that talks to that API um that would be my advice and then uh and then from there also you could potentially once you learn how to build apis with rails uh you'll be learning more of like the underlying principles of like requests and responses and HTTP headers and stuff like that and then all of that knowledge is useful if you want to build a backend API with something like expressjs or fastify um or hono or something like that or Hano um because they basically allow us to Define apis but using JavaScript or typescript and uh but they still respond in the same way they still respond with Json and

technically you could build the as long as you created the exact same backend in points if you re-implemented it with like Express or fastify or something like that your react app wouldn't care as long as that other backend has the same end points and is responding in the same way your react app would still continue to work and that's just because of the nature of the architecture like react the react app in this case would be be dependent on the Json API it wouldn't be dependent on what that Json API was built with yeah okay and then the last question uh why do most devs hate Ruby on Rails oh so why why most devs hate Ruby on Rails and why people hate what they don't understand um and also people hate when things seem like magic or when things have opinions or conventions that they're not familiar with and that's typically the case with Ruby on Rails because uh Ruby on Rails is heavily opinionated and that every Ruby on Rails app looks exactly the same let's see if

Chapter 36 1:44:20

Why do devs hate Ruby on Rails?

we can look at a uh folder structure of for Ruby un rails like they always put the same things in the same same places um like you have your app folder and that's always going to have that same stuff and you have your controllers folder and your helpers folder and so like these are the opinions that they've enforced on you that if you put your code in this way the app will work um but one of the benefits of that is as long as you follow those opinions and conventions then it's easier to build things sometimes so like earlier I talked about you could generate a uh full crud application with Ruby on Rails with a single command line and it like it generates your front end it generates your back end routes like everything and that's because Ruby on Rails the underlying runtime and framework knows that if all these specific files exist in these specific places and they have the right codes in them then it's just going to work there's a lot less glue code that you

need to write because there is a lot of magic behind the scenes um and so for some people that's great uh for other people uh they maybe don't want to take the time to understand and learn when and why Ruby on Rails is doing the way doing things the way it's doing it them and so for them it's always an uphill battle of like well I want to do this and I'm used to doing it this way but now I have to figure out how to do it to do it the rails way so that's probably the most likely reason um yeah thank you for your question laser let's get back to the the YouTube chat uhph sephine sephine is asking the question um what are your thoughts about trpc and is it useful in a spelit app since it's type safe-ish um we talked about TR trpc earlier I I really like trpc if you're just if you need some kind of API uh because then it's really easy to get full stack type safety but inside of a

Chapter 37 1:46:31

Thoughts on tRPC in SvelteKit

spel kit app there's potentially less and less reasons to use it because spel kit does have like full stack types um like it's possible to define a um your action your loader I guess it's called your server action I forget the names that spel kit uses uh but it's possible to Define them and then the types flow through so your client side code gets instant access to those types um I guess the main issue comes in once the page has loaded and you need to load new data you potentially have to use something like fetch which may not be typed but let's look at data loading inside of spel Kit spell get mentioned yeah what's up P um so the idea here is like this is the um let's get the server data yeah page data so let's say you

needed some data on on your front end you could have page. server it talks to your database it returns that data now inside of the actual component you get access to a data property that will have post on it and it will be of the right right type it'll be the type of this return thing and so that's the first reason to not reach for something like trpc is this already gives you types in that direction and that when you're implementing the code on the page itself this data property here is fully typed actually we should we should switch to typescript here yeah uh the data property is fully typed and then you can access data. poost and all all of the types flow through um so that's great um uh but the issue comes in well let's say the page is already loaded and you don't want to navigate to another page but you want to make a request for data and also

have that be fully typed that's when things get a little bit trickier as far as I know I maybe you can help me out uh Pablo has felt implemented anything to give you like type safety with fetch um yeah cuz like right here not yet so yeah uh Pablo is saying they have not implemented anything yet but this is the main issue that I'm talking about is like with uh spel kit technically you could create like an API folder and then Define handlers inside of there that only return Json data but if you write this code in your uh client component see if we can see one with the client they're not even doing the fetch in the client component but if you wrote this fetch code in a client component now item is of the any type you would have to manually go and say uh res. Json as the specific type that you expect

back from that API endpoint and that's one of the this is the one part where you don't get full stack type safety like you would with trpc and so this might be a reason to bring in something like trpc is that instead of using fetch directly you set up trpc for all of your API end points and now you get like a fully typed endpoint here um using the trpc client so that that would be one reason to bring it in um yeah yeah um but yeah P Pablo has a good question is then at that point can you get that data within the load function and invalidate the load with a form submission oh I see what you're saying okay this is not something I have tried but basically what Palo Pao Pablo the real name is Pablo what they're mentioning is instead of using fetch requests you set it up in your page or layout data and then when you need new data you call invalidate which causes it

to rerun I have never used it like that or done it like that but that seems like a viable option yeah yeah and Scott is saying personally I use load 100% of the time instead of bringing in a third party system like trpc and so basically what both Pablo and and Scott are saying is uh all of your data loading code should happen in um that page do server. TS do all your data load loading coding data loading code here and then it's always going to be fully typed um and then I'm not familiar with like invalidating let's see yeah so instead of using a fetch you could have a form that invalidates the path that you're on and then the data would dynamically reload I don't think it would cause a full page refresh because spelt is smart smart enough to just make it a a

um uh a XML HTTP request or whatever else yeah so you can invalidate specific load functions with in validate and then pass it in oo so that might be the way to go too yeah so I think so both uh Scott and Pablo are uh spelt ambassadors and they they are saying you probably don't need something like trpc yeah and while Keim is mentioning uh I live in Denmark and everyone uses Ruby on Rails over over there yeah so uh this this goes to the the question we were talking about earlier where they asked about um Ruby on Rails and it's going to vary by market and vary by country and and everything else as well that's absolutely true uh and piano is asking can't Zod help with this potentially but not in a mostly streamlined way you still would have to import the type in both places

which is not the same thing as like the types flowing through so uh for example in this case posts is of type is a type that has two properties title and content inside my component here uh data. poost has that type I didn't have to specifically put that type on it that type flows through because I'm using the page data type here with a fetch request um it just has the any type if you're using something like Zod you could potentially import that type schema or the the specific type of that thing and then use like an assertion and say as that type uh but it's not it's more cumers because everywhere you make a fetch request you'd have to do this and so the types aren't flow and and you could lie the code could lie because it's possible that this API inpoint doesn't return that type exactly but then you're using a type assertion to say that it does um I will say if you check out n which is

view it has nothing to do with spelt but they've figured this out which uh was one of the really really cool things about it is you can Define API functions um let's see do I want examples I think I want the guide the directory structure server yeah yeah in this case you can have API functions that just return data and then inside your component they have this uh custom hook called use fetch but somehow they figured this out they they're able to do it you they they give you type completion for of the possible API endpoints here and so every endpoint you you define is the the path to it is strongly typed and then the data that you get back is also strongly typed um basically spel kit needs to do this it would be really great if spel kit was able to do this um because the other

Chapter 38 1:54:06

Nuxt Type Safety

aspect of this is when this is running inside of serers side rendered code instead of making an external API request the code is smart enough to actually just go invoke this function directly because it's running in the same context but then after the page loads if it's behaving as a single page application it actually makes a fetch request to the S point so I don't know n has figured this out I feel like the other Frameworks should should figure this out too um

Chapter 39 1:55:10

ELI5 Full Stack Type Safety

yeah uh R says I know this question won't read CJ in time but can someone please explain like I'm five type safety and why it isn't why it is so important um it's it's important because it helps us write better code with less code basically it gives us as as long as our types are written in the right way and you yeah written in the right way it gives us some assurances right so um and let's take for example this page load here right so th let's say this this is actually running on the server and when the page loads it gets access to this data from the server if this were just plain old JavaScript you could write whatever code you you want you could write data.

banana and you're not going to run into an error there until that code goes to execute um but by having the type safety to say that well if I type data. banana right here I'm going to get a typescript compiler error that says hey this type only has the properties title and content there's no B there is no banana so it basically just it it ensures that the code that we write is doing the things we say it is doing um and so that's that's why we prefer it and uh that's also why I like types to flow through and full stack type safety because uh if you imagine a scenario where you have a completely separate API backend and a completely separate like react client one of the ways that we get type safety there is by actually just defining the API types in our react app but the issue there is if the API that we're talking to ever changes its responses now the types that we've written inside of our react app are lying to us because at the end of the day it's kind of just a it's still just

a linter but those types would say hey that API is going to respond in this way but the API might respond in some other way but with full stack type safety all of those types flow through so that whatever types are defined in your backend code are the same types you're using in your front end code which means there are some assurances there as to what's what data is available versus like what you get access to that's the main reason hopefully that was uh enough to explain it like your five I don't know

yeah yeah and if you're using forms you don't need invalidate every form submission will invalidate ah fascinating yeah using forms is like a whole different thing like um I mean if you were in heavy like client side development for a long time everything was just handled by JavaScript but now with like nextjs and spell kit there's definitely more of a push to use forms to do things yeah there's already a PR for this but given the current focus on spelt 5 it's kind of still I see so spelt wants to add uh good types for API functions yeah got yeah cool cool Ral glad to hear it all right uh I'm just going to double check that no other questions came in on like Discord or Twitter and then uh and then we might get out of here

here let's see

cool I don't see any but if you have any lingering questions feel free to ask them I'll do my best to answer them and uh Arctic Monkey says oh uh hakeim says don't know if you missed my question about Kafka I did let's see if I can find it let's see let's see I'll be honest I don't know much about Kafka so um but yeah earlier anyel asked do you have experience with react quer yeah I've used tan stack query in a couple of apps here we go do I have any resources or recommendations to dive deeper in maintaining Kafka in a production environment would this be something you would consider to cve for video for I don't have any experience with Kafka I have done some basic Research into like what it is Apache Kafka right um and I know it is uh an open source distributed event streaming platform so I know it's used to allow like services

Chapter 40 1:59:30

Kafka Resources

to communicate with each other it can have like a a message cue and like an event bus uh at scale essentially um when I was building an app I I ended up using reddis for this because they have a like a message queuing system I think Apache kofka can potentially do other things too but yeah I don't I don't have any resources because I barely know anything about it um and if I made a video it would probably just be an introduct introductory video like what is it not necessarily like how to actually run it in production

Chapter 41 2:00:40

react-hook-form alternatives

yeah yeah okay so Arctic Monkey is asking uh talking about forms I'm not satisfied using react hook form Has anyone used tan stack form I haven't uh I have like react hook form is probably the library I've used most in the re in the react World it's like the constant uh I have used I used foric long time ago too uh but I have not looked at tan stack form let's let's take a

look all

right we have a field info component we have validators and then a renderer this looks a lot like formic um what about do they have Integrations with like uh Zod like if you pass pass a Zod

validator it honestly looks a lot more manual than react hook form because you are having to pass in like value and on blur and stuff um whereas like react hook form comes with a register function that uh hooks all of that up for you so if we look at uh an example here with a schema so you have your form schema you um specify the resolver here I guess they have it for zodu this is using yep and then they have this register function I mean you're still technically spreading it so it's like adding all of those props onto it but uh it adds all the right pop props I guess it gets trickier whenever you're trying to wrap another uh component library because if you're doing that then you have to do uh yeah integrating with UI libraries then you specifically have to bring in the controller

component and then it gets trickier because you're wrapping it in a controller component and then doing the other stuff

yeah I don't know from the examples I've seen I probably would still choose react hook form maybe I don't know the the major benefits of using

it I guess it makes sense if you're like loading initial form data because then you can integrate with tan stack query yeah I don't know my advice is keep using react hook form because I haven't really found anything better than it says fair enough thank you so much I'm using it in production but whenever I see someone talking about it I always learn something new I see I see uh super forms I have not heard of super forms let's check it

Chapter 42 2:03:36

SvelteKit Superforms

out oh for spel Kit I see I see I have used super forms pretty sure but for spell kit not for react in the uh listed app that we were that I was working on over on coding Garden um we used super I did it without it first and then someone mentioned hey you should use this Library um the amount of configs in this project is ridiculous but I think we used yeah we use super forms it's cool it it basically integrates like uh like your a Zod validator with like form submission it's cool and then uh conform is also nice if

Chapter 43 2:04:36

React conform library

you don't like react hook form let's see react

conform type safe form validation Library okay Define your schema um here's they're doing server actions wow and we have our use form

hook um pass in the name pass in the display the errors I guess this is cool because these are basically like not controlled components right like with um controlled components you're setting the value and you have an onchange listener but I'm guessing the form submission here actually reads in the form data yeah so pars with Zod comes from conform and it's able to easily take your form data and turn it to a an object and parse it with Z with the Zod schema validator so that's pretty cool this is this is probably the the majority of the work that this that this library is doing is like handling that form data and making sure it's uh like pulling all the values from the the fields and everything honestly this Library makes a lot of sense if you're using react server components on the on the surface anyways because react hook form you basically

have to you it's like it's a client component I guess technically this is a client component too because it's using the use form hook um cool but what I do like is I guess if you're using um I forget what it's called I think it's literally is a form action like you you can label this form as an action and then if JavaScript isn't enabled it would still call this Handler but this Library actually gives you that parsing that form data into this schema I don't know seems cool I like it I'll probably have to check it out thank you for suggesting that binary guy and Arctic Monkey says uh I also used formic in the past and react took form as a good Improvement but still it's hard to debug why the validation is failing and sometimes the error's object is empty but is valid is still false oh I haven't really run into that but ultimately you could just do some

console logging in a use

effect because yeah you could just have a use effect that's dependent on errors and is error and I think there's also a way to tap into um the actual error that gets thrown by your validator I don't know seems weird yeah uh Francois says regarding episode 799 are there plans to animate a CSS Flex Gap when an element is inserted I can animate the element with on insert but the Gap still jumps when the element becomes displayed oh I have no idea but I will Point everyone to episode uh six uh 799

Chapter 44 2:07:30

Animate flex gap

uh because they talked about new browser apis and specifically are you talking about the uh animating width is that the

one I know that uh Wes made a a quick video about this recently uh in terms of being able to animate size or animate width oh size animating size because you go you can go from size zero to Auto and then you're able to animate now yeah I have no idea about an animating Gap I don't know if that's in the plans or anything like that yeah yeah Scott says I almost never bring in a form library for spil but always do for react yeah it seems like with spel pretty much all you need is a schema validator and you're kind of good to go but that super forms Library does a lot of the the boilerplate of like converting your form data into an object and stuff like that but yeah I would agree with that uh binary guy says got introduced to conform from the remix side of things and I've been using it for stuff for some stuff still prefer react hook form

yeah uh and sephine is saying I find the duo of super form and super validate very useful George says I skipped your library question let me find it sorry if I did maybe let's

see feel like that was one of the first questions we answered

right oh you're right let's talk about this so George is asking uh what's the best way and good practices to create a JavaScript library or a react Library there are templates and boiler plates that will help you out because uh some of the things you want to think about when you're writing a library is you probably want to write your code with typescript whenever you distribute your your library to something like mpm you want to make sure that it's available as like es modules or it could be um or as like com in a commonjs format you want to make sure that when when you publish it it can be imported into a project regardless of uh of what the module type is or how you wrote it so you need some kind of build process for that um and then the other thing to think about is uh you want a somewhat streamline way streamlined way of releasing new versions of of your project um now what

Chapter 45 2:09:49

How to create a JS/TS or React library

can I recommend for this I mean first of all uh like vit I think vit has a do they have a scaffold for just a library I thought they

did yeah V Library mode

yeah so this allows you to develop a browser oriented Library so basically like you're you're not building a full-on app you're basically building uh like a module that could be imported into various libraries or you might be building a component Library so they have that I will say right now my mind actually goes to using something like uh INX um um because they have scaffolds that will generate a lot of that stuff for you um so if you look see if we can look at the yeah look at the plugins um they have a plugin for um like View and react and everything else but I believe each of these plugins can be customized so when you generate a project with it you can say this is a library and then it will specifically set it up so that um you're not creating an actual

react app you're creating like a component Library um let's see yeah you can add the plugin and

then trying to [Music] remember I feel like they're specifically I think they specifically have a node Library plugin that I've used yeah so node and then this lets you create like a reusable Library it defaults to generating the app with typescript uh but then it makes it so that it's publishable um yeah you can use things like roll down um or uh roll up I think roll down is is still in development um those specifically are for like bundling um let me see what I used because I for I forked a project that created a Prisma plug-in and it had a good structure in flow because uh the nice thing about setting it up in a monor repo is especially if you're like creating a component library or creating a library of functions that need to be imported if you set things up in a monor repo then it allows you to basically like test your own library inside of like a sample app um because then they both live inside the monor

repo but you're really just publishing the library itself but then you have a a test that can access it and and try it out uh yeah I think in my listed project I specifically am using a Prisma

plugin yeah Prisma ERD generator markdown so I forked another plugin and then rewrote a Prisma plugin that um generates a markdown n relationship diagram but the library that I've forked was like using this thing okay so you can see it's set up as a monor repo I have my packages folder um and then let's see what I have in here yeah and then I guess there are other things that you would want to include in a library like um if you use use things like conventional commits that's a whole standard for how you set up your commit messages but if you do it in that way then you can also make it so that when you create a new release for your your library it takes all of the commits that that have happened since the previous release and creates a change log but because your commits were written in a conventional way it's allow it's able to do that um let's see did I have anything beyond that CU yeah I have the generator

package and then semantic release is another thing you're going to want to use uh because this this handles um making sure that you like you set the right version and then like bumping the version and releasing it and then also using some uh conventional commits fully automated version management and package publishing this this this is definitely one place to look and start when you're creating a library you you would have to use this in combination with the other strategies I talked about like using like a monor repo but this also would allow you to have a mono repo with multiple packages and then each of those packages could have a different version and be published separately to uh to npm and so semantic Rel is going to help you with that uh let's see what else I was

using yeah and then you can see my uh semantic release configuration here um cool I guess that's mainly it yeah the the other cool thing so I I do believe honest honestly I have to I should see where I forked this from oh yeah okay so uh create Prisma generator allows you to generate a plugin but are they using anything specific to get all of the set up yeah uh and Palo is saying I'm 100% on the change set mind change set instead of semantic release I'm not familiar with it I think anything that makes your your change log easier to to

generate introducing chain sets simplify project versioning with semantic

releases cool and so this has a focus on monor repos yeah this I would say check this one out

too tsdx is what uh Amed is mentioning publish modern typescript packages so yeah this would allow you to create a typescript package and then they have like a react template which I'm guessing would allow you to create uh like a react component Library cool check this out too cuz this would basically be like full featured it sets up the whole the whole project for you well yeah and Scott is mentioning that it's it's good for react too cool so hope hopefully that helps um ultimately mono repo some kind of uh version creation and and release tool and then you're probably good to go from there because the the main issue is especially like if you're writing your code in typescript when you publish it to npm you need to publish the built code and so if you take a if we take a look at this specific Library um on npm and we look in the

code all that was published is the dist directory right so the actual code for that package lives here and it has a source directory and then like all of my source code that are typescript files but the actual thing that gets published is a dis folder that in turn has JavaScript files because that's what other people are going to need to import into their application um it looks like my build process doesn't generate typescript types but you could include that CU that's another aspect of it is you would want to distribute JavaScript code but you would also want to include typescript types and so your build process would would should be able to handle that um and so that's part of the um release strategy is that it needs to be built and then when we publish it we're specific Ally publishing that built folder

yeah cool all right yeah great let's answer one or two more questions and then I am going to get out of

here Isaac asks is it possible to host react and an Express app on a single server client side react yes and the way you would configure it is you would configure your Express app to statically serve the built react files and then react could be served from the root of that Express app and then you could have all of your API routes and those would be prefixed with like/ API that's definitely possible um combining Express with something like nextjs is a lot I don't even know if that's possible because nextjs has like its own runtime and typically with something like nextjs you're defining all of your API routes within uh nextjs yeah so yes it's possible if you have a completely client side react app basically it just needs to be built and then served from the public folder and then you also and then if using client side routing you potentially need a

Chapter 46 2:19:49

How to host react / Express in single server

request Handler that rewrites requests to the index route because if you're using something like react router and then you have a nested page like admin settings if someone goes directly to that URL it would potentially 404 so you need to redirect the request to that page to your index page which then kicks in the react app and there's plenty of of blog posts online that show you how to do that uh Amada Amad is asking do you recommend trpc to share types between the back end and front end or do you use another thing to do that I think it's a good solution um we talked about it a little bit earlier but if your client if the client for your trpc backend is typescript or is Javascript it makes a lot of sense um but if it's like a mobile app or something like that it's a little bit harder because trpc is like a specific protocol it's technically happening over rest and there might be client implementations that have been built for like iOS or Android but it's not the default thing so if you're front and and backing are

Chapter 47 2:21:13

tRPC to share types

in typescript it's a good way to go but depending on what you're using to build uh it might already have something built in cuz earlier we talked about like with uh spelt kit you can get full stack type safety just using their data loader and data loading patterns and then like with nextjs and react server components and server actions you can get full stack type safety uh by using those server actions because the types flow through there as well uh so you may not need to reach for trpc but if you have a separate if you plan on having a separate API and like front end trpc makes a lot of sense then yeah oh tsdx was made by Jared Palmer cool cool yeah and uh I would also recommend depending on the kind of library that you're trying to create search around to see if somebody has a template so for example uh sephine found view component lib starter so if you're

trying to write a view component Library um you could use uh that which has been preconfigured for all of that yeah and they just mention it's a quick Google search but I think for anything that you're trying to create uh you you might be able to find something cool yeah and I missed ched's goodbye but see you later Chad if you see this later all right I'm GNA get out of here thank you so much for all the all the questions and everything I I really do appreciate you all um I'll try to do this again at some point some point soon it's fun to just hang out talk and such and I think uh next time maybe I'll gather questions that I get soon soon I'll gather questions that I get on Twitter and maybe have some like uh code repos and code examples for you because today was a lot of talking but I also like to show code examples sometimes too but it's harder to do live harder to set up live but yeah thank you so much for hanging out and uh I'll remind you that uh we have a giveaway

Chapter 48 2:23:06

Thanks!

over on Instagram so we just reached 30,000 followers so if you want to enter the giveaway see this post leave a comment um you could win some syntax swag uh but if you don't want to worry about winning you also could just go to the store we we have a bunch of Swag for sale including this shirt and a few others so if you visit uh cry. shop check it out also follow us on YouTube if you're not I mean if you're watching on YouTube maybe you already are subscribed but if you're not subscribe I post videos the podcast comes out three times a week uh and you you you want to know when that stuff happens so definitely subscribe over on YouTube and that's all I have for you all right thanks everyone for for hanging out thank you for your questions I will see you very soon

Quote it with credit and a link. Quoting Syntax