I DONT USE NEXT JS

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey why I won't use nextjs but here's the deal after we get done reading why I won't use nextjs we're going to hop on over and read why I'm using nextjs a response to this article from Lee Rob himself so we got Kent C dods and Lee Rob battling it out in the texts over react a library that's a framework that became a meta framework because the only way to use it is that you have to have your entire system infected by it so it's a great fight everybody get ready there will only be one winner and that winner of course will be Intel or AMD because they have to produce faster CPUs so therefore you can be able to run slack that chat program that takes up somehow an entire core and and and several gigabytes of memory because JavaScript is so fantastic okay so that's the real winner here okay the rest of you are losers uh you've got a new project to work on or you've got an existing project You're motivated to upgrade to a more modern approach or perhaps you're dissatisfied with your current modern framework or second guessing yourself and you're interesting uh and investig ating Alternatives in any case you've got a decision to make there's a lot of modern Frameworks to choose from even if you're not facing this choice right now you may be trying to decide which framework to invest time learning to make yourself more marketable and productive in the future okay okay I've been using remix since it was first released in 2020 didn't uh he also create remix isn't that a more better I loved it so much I joined the company for 10 months to help the uh Community uh to help get the community going and now I recommend and teach REM on Epic web.dev oh okay so he didn't he didn't actually just start it he was just a Dev okay okay I didn't realize that uh remix is a full stack web framework and strives to solve problems faced by people building web applications much like nextjs as nextjs is very popular alternative to remix uh people ask me why I choose remix instead of nextjs for the framework I I teach on Epic web.dev he should have made these little links you know so I can click them uh these people are probably facing one of these scenarios I mentioned so this post is for those people okay I like to focus my time and attention on by the way Kent is also a very very very like nice guy so he's not going to say he's like this article will just not be negative right it's just going to point out the things that he likes about remix and like that's that's pretty much what you're going to see here uh at least that's what kind I'm going to take let's see so I'd much rather write a post uh titled why I use remix and and written about the things I love about remix I've already done this but a lot of people ask me uh specifically about nextjs and this post is for them I'm not here to bash on nextjs I'm here to add my honest take of uh of my personal perception and experience with nextjs if you'd rather not hear negative things about nextjs then I invite you to stop reading now go outside and touch some grass everybody go touch a little bit of grass okay just go touch a little grass right right now okay get it out of your system touch it feel it experience it get the hell back in all right before I go on I need to acknowledge the fact that you're reading this on a site that's built with nextjs you can check in the browser console and find the global next data variable rather than the remix context one this is because epic webdev is built by a team that has been building software with nextjs for years and and they make their own decisions I can respect that I think this actually highlights a a character by Kent and what I mean by that is that he this is obviously his stuff as epic web.dev and he obviously has contracted out uh epic web.dev to be built by uh some group of people and they're going to use something that he would not use and he was totally okay with that I think there's something that's very honest and good about seeing this that he is probably somebody that long as you build a good piece of software at the end of the day he doesn't care what's going on and he's not going to just make it so that it this also has to be built in a technology that people aren't as familiar with because it's his way so I can respect that this actually gives me an opportunity to make another important uh point before we get started whatever you use is probably fine your tool Choice makes much less than your skill at using the tool to accomplish your desire outcome this is such a good point by the way this is why honestly this is why JavaScript continues to be such a successful language is that people have invested all their time into and there's this thing that happens that the more you use a tool the better you are at using that tool and the better you are at using that tool the bigger things you can build it doesn't matter how bad the tool is in the first place there's just a certain proficiency gain by using the same thing over and over and over again you know what I mean and so by simply using it over and over again you're just you're just better and so of course it keeps on working right that's why people like these products so much much is cuz they already have all this momentum in them in this post I'm going to argue for why I won't be using nextjs because I think remix is better tool for creating excellent user experience but that does not mean you are a failure or a bad person if you're using nextjs that said I do think you would be happier and more productive if you used remix otherwise I wouldn't be bother writing this finally I want to mention that I've been an outsider to the nextjs framework for years it's been a long time since I shipped something with nextjs myself that said I keep up with nextjs developments and hear of the experience of others my past experience gives the intuition on the approach Frameworks take and I can get a good sense of where a framework doesn't align with my sensibilities so with that out of the way let's get into why I won't use nextjs this is also pretty classic Tech uh right now in Tech you have to you have to preface everything you say so that every last possible argument and person will be happy or else you'll get very angry tweets on the internet because you didn't address every last person's concern it's one of I it's it's honestly one of the I I think one of the worst Parts about the internet right now is that people can't just say what they think they have to like preface the universe before they can just say like think about how much time was spent prefacing why what he's saying you know he's not meaning that it has to be negative and all that like that's just so much text you know what I mean it's just so much text for that okay just say I I don't like it and here's the reasons why I've been deploying stuff via HTTP for over a decade I've dabbled in in uh Native development I call that naive development but I really found my home on the web years ago as was working in react and became dissatisfied with the deao standard for testing my react components enzyme to make a long story short I decided to build a testing Library which is now the recommended testing utility for react and other UI libraries one of my primary differences between enzyme and testing library is that with enzyme gave you a wrapper with a bunch of over overly helpful dangerous utilities for interacting with rendering elements testing Library gave you the elements themselves to boil that down to a principle I I would say that instead of wrapping the platform apis testing Library exposes the platform's apis I I like this approach in general this is a very good approach which is you got to just give people the hooks you don't like every time you wrap something you're making a an active decision that you or you maybe you don't realize it maybe it's passive in your case but you're making a decision that you have to support all underlying changes as well for people to interact with your abstraction and so by just simply not having that abstraction to begin with it works now one thing I find that is very useful is providing like helper function so instead of wrapping it you just provide a series of helper functions to get stuff because that way you don't have to you just don't have to support it and this is a reason why rust is such a cool language I know rust I brought up rust somehow is that by having traits you can Define traits and operations and Implement them and therefore the elements that you're working with can be uh they can be lifted up into a new level of abstraction without losing the underlying um what's it called the underlying reference to the to the element which I think is honestly one of the greatest reasons why rust is a good language is that specific ability to do trait implementations it's really really really nice the primary benefit uh to this is transferability by focusing on a standard API testing Library helps people become familiar with those apis which helps them in their work elsewhere and the utilities available in other tools that rely on the standard apis integrate with testing Library without special adapter and vice versa exactly rust rates are amazing yeah so hopefully you guys understand that it's it's kind of hard to explain why that's so awesome if you've never used rust but this like this is a perfect example of why rust can be really really useful uh every library has its own apis for things of course testing library has find by rooll for example you need to understand the inputs to that but the point is that it operates directly on the Dom and returns Dom nodes back to you rather than wrapping the apis at exposes the apis to you it's a balance of usefulness and transferability nextjs is like enzyme in this situation where nextjs has utilities to allow you to interact with the with the request headers cookies Etc remix exposes those apis directly to you through its loaders and actions in remix these functions accept a uh a request and returns a response if you need to understand how to return Json with some set of headers you go to mdn the deao standard for web platform documentation rather than the remix docs okay so I actually again I I I love this explanation I I truly do love this explanation that they're giving and it makes me think that remix actually could be a pretty fun place to kind of play around with if you're going into the meta Frameworks obviously I don't know nextjs as well uh but it's still this I mean I love this explanation because this is what I want to see like this is my favorite thing about the web is when you just use the standards right and so when you just use the standards like the entire Corpus of documentation still completely applies for like your stuff as well you don't have to create this entire separate Universe it's very beautiful there are many such examples you get a bet let's see as you get better with remix you get better at the web and vice versa okay okay so you've been using it for a year and you wouldn't use it any other way all right all right all right react plus Vite plus HDMX is the way don't let these meta Frameworks bog you down Prime actually I know you're you're making a joke at the end of that but I actually do think that uh htx is the way I like go in htx right now uh when I transitioned from angularjs to react uh I left a lot of angularjs behind me uh all of the time I invested at getting really good at Angular JS felt like a huge waste I don't want that to ever happen to me again I actually don't mind when that happens right it just means you're moving on so I prefer to focus on a framework that can only give me what I want from user experience perspective but I can also give me the skills that I can use wherever I develop the web but but that's the thing is that if you use remix and you use react You Are by definition creating yourself into a hole in which when you change completely like it honestly it completely just change like you you leave everything behind again have you ever heard of openex if not here's how it describes itself open next takes nextjs build output and converts it into a package that can be deployed to any functions as a service platform as of now only AWS Lambda is supported well forell is great it's not a good option if all your infrastructure is on AWS uh hosting it in your AWS account makes it easy to integrate with your backend it's a lot cheaper than for sale nextjs unlike remix or Astro doesn't have a way to self-host using serverless you can run it as a node application this however doesn't work the same way as it does on for sale okay open nextjs exists because nextjs is difficult to deploy anywhere but for sale I appreciate the company's incentive to make their own hosting offering as attractive as possible but it's evident that this incentive has deprioritized making nextjs easy to deploy anywhere I always just kind of had nextjs as pretty much synonymous with versel that's that's that's kind of how I always thought of it in my head is that if you're using nextjs you're using for sale you're not really using nextjs for something else but it sounds like they're trying to make that happen they're trying to make fetch happen which may be pretty hard to make happen uh I've heard uh from many individuals that hosting nextjs yourself as a regular node.js application is a huge pain as well uh I usually don't take other devs opinions like this well I I would have to know why uh and I know that netlify team spent a lot of time on getting nextjs support and keeping it up with changes in nextjs okay so their support changes probably are the hardest we can argue about whether vercell is right or wrong about their current approach but the fact remains that if vel's pricing or other things become a problem for you getting off for sale will also become a problem it comes down to incentives interesting interesting interesting interesting hold on I just realized I don't have music on this entire time let's get the music's on all right add this to the fact that uh versel is still allegedly not yet profitable they're a growing company for sure but I question their unit economics I don't question their unit economics they make money on everything they do right they're not trying to they're I mean I assume if they're not profitable it's because they've hired more Engineers to build more things but every single time a request is made they make money right so I mean they always make money they don't have to first get to x amount of requests before they make money they make money right and that should give you great concern to put all your eggs in that basket from the beginning remix was built uh to deploy anywhere you can run JavaScript uh this has helped in a large part by the emphasis on standards I definitely appreciate this aspect of remix nexts is eating react my misgivings of meta as a company always made me feel a little uneasy about meta owning react however as versell has been hiring many of the react team members this hasn't really helped things for me ever since then the react team has felt much less collaborative okay I know for myself it seems like versell is trying to blur the lines between what is nextjs and what is react there's a lot of confusion for people on what react and what is nextjs especially in regard to server components and server action features okay I mean this is actually kind of interesting I've always kind of in general had this problem I I know at some point there's going to be this phrase which you're going to hear which is going to be I learned nextjs before I learned JavaScript I feel like that's going to happen at some point because I do understand this line blurring which is at what point is it nextjs and what point is it react I think people are really starting to struggle with this and as a new person I feel like this is it does feel vastly complicated you know I I do feel bad for anyone that's getting started in today's world because I feel like it's only gotten harder and it hasn't gotten any easier I guess you could say uh okay hold on we got to quit talking about okay so hold on Daniel Daniel okay so you want on the hot stage we're going to get on the hot stage buddy versel is literally burning money to help react move to server components okay Daniel defend that opinion what makes you think that that investment is burning money why do you think it's bad because we keep hearing about that what what does that mean right to me I see why they're doing what they're doing you're on the hot seat now okay literally a Shopify tried to do this and failed okay that's not a good example not to site dhh but dhh literally said somebody else tried this and it didn't work is not a good reason not to try something like I need something more right I need something more and something real what I see is that nextjs is positioning itself to be the conduit in which you use server components that when you think of server components you think think of nextjs when you think of react you think of nextjs that when you build react which all these projects are using react you have everyone promoting react you have every last person leaning into react and so that means they're going to have this this synonymity with react right in which they're going to be the first thing that comes to mind which means that they're going to have the greatest opportunity to be able to take advantage of every last new application every last new person coming into the uh ecosystem which means that they have a huge potential to make even more money what I see as their moves is an investment into the future they're literally buying something to make more money I think it is I think it makes completely perfect sense like I see it no other way other than this is a good idea for them now is it a good idea for everybody I don't know I again I love HTM X and and not this so just remember that my idea of this is not the same all right I would feel more comfortable if react belonged to an open foundation but short of that it would be nice uh at least if they were more collaborative than they've been since joining versell anecdotally they are far less collaborative at versell than they were at meta uh used to reach out and keep me in the loop for years and then it stopped and unfortunately the team at meta rarely has answers there's definitely a whole whole movement here the problem with that is that I don't I mean like I I I like Ryan Florence it's not about that but just saying that you know one person's experience doesn't mean everything right he could have fallen out of Limelight with the people on the re side of things the people getting hired didn't really know him the team could change Dynamics could change maybe there's other people that they reach out to right so like having that as a reason to say that I don't feel like is a very great way to anyways I guess you could say that at this point uh in favor of nextjs because at least they're reaping the benefits of closer collaboration with react but in my experience a team not being collaborative is a bad sign for their software again I don't know if you can say that concretely I'd have to understand that more update Matt Carol developer Advocate on react team reached out to me at the same time I published this post so that's a good sign experimenting on my users wow I'm highly concerned uh by some questionable decisions made by nextjs team primarily in the marketing of experimental features as stable features that nextjs is shipping as stable are in the canary release of react honestly it's pretty funny and also sad okay okay that's this is this is a spicy take do you know what a canary refers to it refers to a sentient species which are used to detect risk risks to humans by providing Advanced warnings of danger yes that's because canaries are uh they're they're very sensitive and they would like pass out and fall over uh so nextjs is building uh into itself a canary feature calling it stable then sending it off to all users effectively turning your app into a sentient species you may not see it this way but maybe it's just a messaging problem but I've heard a lot of people who have tried that their experience with nextjs app router has been far from positive and think it's largely because of its incompleteness they are the canaries okay fair I mean app router was the rec recommended new way of doing things but I've heard a lot of I mean I know that there's been a lot of grumblings fair are also used by meta basically it's uh close to production that's why teams are using it at meta if you don't like it it's not like they're forcing you yeah they're not forcing you so I don't really like that argument uh typically I think Ken's arguments are really good I don't think this argument is very good at all uh and while some people report having a great time with app router I'm convinced that a lot of their enjoyment is coming from dropping the weight of PA's directory and getting uh nested routing feature not necessarily these Canary features yeah that's fair uh yes react server components are very cool and I look forward to being able to use them when they production ready they'll allow remix to offload a lot of work too much magic have you heard the principle of least surprise it states a component of a system should behave in a way that most users will expect it to behave and therefore not astonish or surprise the users okay this bit could probably exist under the web platform heading because the best way to avoid surprising people is by following the web platform apis as well as possible and reducing the amount of magic your software does on top of that I know but remix in itself is still a lot of magic right all these Frameworks all these meta Frameworks even react itself is a ton of magic you know what I mean like there is a ton of magic going on and so I feel like this argument also just Falls over on its head because you're using you're using something that's a non-javascript standard that's being compiled from the non-javascript standard into JavaScript then executed in a library which hooks into all of these little items does some sort of virtual diffing using server components to send down fractions of what should be executed you have this whole server that's executing some amount of react and you have a whole client that's executing some amount of react we're going to be having these form actions in which actually wrap this function put it on the server have some magic RPC I hope caching works right like the amount of magic that's actually inside of these JavaScript things is astonishing and so anyone saying that this is just like hey you should be as close to the API as possible it's just like if you're using react you've already long since given up this argument on Magic right debugging magic is hard debugging react can be very difficult that's why react Dev tools exists because there's an entire debugging that has to happen that can only be done by not even a debugger right it's not even like not even a debugger at all you just need an orthogonal view into what you've built such that you can debug it we can have react without jsx I know but that's a stupid answer okay who are these people using react without jsx right it's it nobody does that right I understand you can because it transpiles right you can also have JavaScript without typescript again would you want to do that I wouldn't want to do that okay I don't want to do that my company uh use uh nextjs and react native because it is easy to hire react developers because I had experience with react with the web and now I work on the app the transition was smooth okay interesting interesting again you know I I think dhh is wrong on this one I love types so I'm just saying that this notion that it's it that magic is no good I I just don't I don't this I don't find this argument very compelling all right uh nextjs violates this principle in many ways one example of the decision to override Global fetch function to automatically add uh to to automatic caching to add automatic caching to me this is a huge red flag it's decisions like this that I want to make me pause and wonder what else they're doing by surprise if they decided to adopt nextjs I'm actually less upset about this one I think that they did it right because here's the deal when you make an HTTP request on the web it cashes it for you I think making fetch act more like your browser is a good thing and that you should truly like you should want cashing to happen and maybe okay so maybe it's fair to say like hey there's something called Cash fetch which does Catching cashing and then you can still use fetch which doesn't do any cashing is the raw dog version but if you want it to be cashed wrap Fetch with this operator cash and it does it for you like that's fair that's fair you can imagine you can uh you can enable it uh via HTTP if you want it's not magic yeah but does fetch uh respect HTTP caching it does on the web because the web has an entire thing but I don't think fetch does fetch has no caching built into it so even though you enable it via HTTP headers you don't actually get caching I assume this is what I assume this is how fetch works that fetch if there is HTP headers with caching then it properly does it I'd be surprised if they do some other thing then I'd be a little bit more skeptical you know what I mean at that point if they did if they if they did cashing at a at a unique way then I'd be a little bit more skeptical uh all right uh most of us uh learned from Mo tools days that overing overriding built-in features of the platform leads to problems uh it's the reason we have string prototype includes instead of uh string prototype contains really did we just get a mo tools reference is that why they called includes I literally every single time I use includes I first type in contains every time every single effing time I type in contains and then I have to go back and do includes is this really why that mother effing Mo tools you you son of a I cannot believe this doing this has negative impacts on the future of web platform and it also means that we uh that when you go to the bug why something isn't working you have to sift through the resources available to find the nextjs version of fetch versus the web platform version of fetch yeah that can be I mean I I can I can understand why this is negative I think fetch should have basic HTTP caching available which makes sense to me complexity I keep hearing from people they're finding next CH uh is getting overly complex this factors into too much magic a bit as well react has server actions as well as the new experimental taint API which has become the subject of many jokes how dare you name an API after a body part in which many jokes are made okay they should have just called it the GU API uh let's see I'm excited about the perspective of react adding built-in support for mutations but I'm definitely concerned about them changing semantics of how the web forms work each of these things increase the level of uh complexity I really appreciate that remix team is led by people who share my principles and will ensure once these types of features are included they don't go down the same road of uh of added complexity in in fact the remix team is committed to reduce overall API footprint in the future rather than increase it this leads me to my next point I mean I do like this the less API you have to think about almost always and exclusively the better right this is Kent's article yes stability nextjs is on version 13 react router built by the same team as remix has been around much longer and is only on version six remix was on version one for almost 2 years and only one month ago hit version two it's famously the most boring major version bump of a web framework ever thanks to remix team's emphasis on stability earlier this year the remix team shared their plans for getting a version two feature released as an optin part of version one using a strategy called future Flags this played out extremely well and a huge number of actively developed remix apps were upgraded in less than a day app router is less complicated what I think app router is I think in general people are very confused by app there seems to be a lot of angst and internet anger around app router I haven't used it enough to have a strong opinion next uh the remix team cares a great deal about stability this is why they didn't jump on the bandwagon years ago and Implement support for react server components even though everyone was uh asking them to this is also why there has effectively been only a single breaking change in eight years of react router this kind of stability has Major Impact so one thing I do want to say that one thing I don't like about react router is that it it like neuters the URL the URL I mean this has always been most my problem with any of these routing features to with is that they break where State Should Have Always Been which is the URL we should have driven more state to the URL and made things more considerate of that but it feels like react router at least for a long time just completely destroyed query prams and things like that so I I'm not fully convinced that react router is also treating the web and the web standards and the web API as a great thing right they're changing some of the semantics that could have been a lot better uh this kind of stability has a major impact on me and the apps I've built there are some libraries that I'm always Terri ified to upgrade because of the history of hours of confusion as I Tred to update all my code to adapt to the new version for something as impactful as the web framework I would prefer not to have that feeling remix has been a gift in this regard okay the only thing uh let's see is this uh thing really a course for $1,000 wait what capability you may have let's see you may have expected this blog post to be a comparison of features and capabilities of nextjs versus other Frameworks Like Remix but the fact is that you can build awesome things with both Frameworks I want to point out that features um matter less than capabilities I person aren't features capabilities I'm a bit confused by that statement features are capabilities right I feel like we're semantically dancing around things uh I personally feel like the pit of success with remix is wider than with nextjs but I'm not going to uh go to Great pains to describe why a lot of this stuff is pretty subjective anyways when remix team wrote rewrote the nextjs eomer demo uh to answer the remix versus nextjs question it demonstrated really well that remix resulted in a better user experience with much less code which is an important input to user experience since then nextjs has updated it to use the app router which they are calling stable but relies on Canary features as I've already mentioned so I think it's worth making another comparison remix has also learned some new tricks since that article is written like out of order streaming conclusion you may agree or disagree with the things I've said you may think it's been unfair You may wish that I had said more or less that's your PR prerogative prerogative wow okay I I knew that word prerogative uh and I welcome you to share your opinions on my take on X YouTube twitch Etc this is a post prefacing again the the curse of the modern tech article world that you must preface all things and then post preface things on the other side Lee Robinson uh VP of DX versel posted a thoughtful response to uh his blog you may be interested in reading it doesn't satisfy my concerns personally though I just wanted to share why why I'm recommending and teaching remix instead of nextjs so next time someone asked me I can simply Point them to this article in short the answer is I feel like both are highly capable Frameworks but remix aligns better with my own sensibilities on what makes software maintainable and a joy to work with longterm I also feel like between the two Frameworks you'll walk away from epic. deev epic web.dev with more transferable knowledge than if I taught nextjs okay uh in summer of 2023 I hosted an8 week long live presentation of Epic web uh Workshop series Gwen Shapiro one of the attendees told me months later I now building mostly on nextjs stack and I feel like your class gave me the mental framework I needed to ramp up and feel confident foundations are everything I bet you could probably say the in inverse as well I bet if somebody really went deep on nexj and then went to remix they could probably ramp up really quickly as well I am just I I just don't believe like I I don't take this as a good argument for or against so whether you're using nextjs or plan to stay uh or you're uh hoping to adopt remix or even if you'd like to use some other web framework My Hope Is that you're choosing to uh uh by choosing to teach remix I've equipped you to take on uh any challenge you face on the full stack web because uh at the end of the day I just want to make the world a better place by teaching you how to build quality software fair fair take thanks Kent um I I'm probably about 50% on this article for agree for agreeing do you know what I mean about 50% the thing I really like about this article is that it points out that how important it is to have web standards and it's something that sometimes I fail to do which is just make sure that everything you do really follows those standards and exposes those uh standards well CU if you don't you're just going to be I mean you're really just like you're you're just digging yourself a hole of Maintenance but the magic part I have a really hard time with because honestly react is effing magic as I said the response why am I using nextjs so this is from Lee keny dods recently published a new article why won't use nextjs in this post Ken shares his opinions on why he's recommending using remix instead of nextjs I wanted to share my thoughts and and makes a case that learning nextjs helps you learn the web platform all nextjs features work self-hosted uh server components and server actions are independent of versell the react Canary channel is stable for Frameworks like nextjs to adopt server components are production ready okay background Kent is a prolific educator and previously a co-founder of remix okay so I thought he was you just told me he was a devil and now there's like there's more to the story uh his new course epic web uh epic web dev helps you learn how to build full stack uh web appli using remix Kent is an incredible member of the react Community I've learned a lot from him over the years especially his material on testing and this blog actually uh uses a library he created MX bundler so thank you look it's Kent uh so so if you're new here I'm Lee I work at nextjs I like Lee a whole bunch I didn't get to see him this uh this last week which uh made me sad good guy I like Lee a lot uh I've worked on nextjs I've also made some courses about using next before I joined forell both Kent and I are passionate about the tools that we use as Kent shares in his post as next JS is very very popular alternative to remix people ask me why I choose remix instead of nextjs for a framework I teach on Epic web.dev people uh these people are probably facing one of these scenarios I mentioned so this post is for those people similarly I'm often asked about my opinions on nextjs versus other Frameworks this post is for folks in the nextjs community who are wondering about some of the points Kent brings up the web platform first it is important to call out that remix has pushed the react Community forward in its understanding of the web platform and web apis nextjs one was released in 2016 just uh we just had a 7-year anniversary and at that time the no. JS request response objects were the deao way to build a server rendered JavaScript framework we were writing react class components as well a huge portion of tvi on uh in in at Netflix is class component still that's just that is that a whole bunch like Legacy lasts a long time decisions made at one point in time will last for so long right remix one uh was released in uh 2021 a lot has changed since then the web platform is more powerful than ever and there's an entire new generation of developers learning the web request and response apis first instead they are able to learn once and write some J uh the same JavaScript everywhere where using existing knowledge I love that this is actually a really astute and great point which is remix dead benefit I didn't realize remix is as new as it was but remix greatly benefits do does everybody remember what do they call it the Kennedy model you guys does everybody remember the the Kennedy model of no. JS the Kennedy model effectively went like this request response next and you had to do your stuff and then call the next function if you didn't call the next function and returned something then that's what would go to the next one it was not great it it was just not it's just I didn't love it uh let's see where nextjs has utilities to allow you to interact with the request headers cookies Etc remix exposes those API directly to you through its loader and actions in remix these functions accept request and return to response if you need to understand how J return Json with some headers go to mdn okay yes this is absolutely true for nextjs Pages router however a lot has changed since then let me explain I thought they I thought they're getting rid of the pages and going with the app router interesting interesting uh that's middleware like everywhere I know it's middleware like everywhere so it act like middleware but only applying to the responses yes the nextjs pages uh rout was introduced in 2016 and you'll notice that many parts of the framework that feel closer to node.js than the web apis for example you've been able to eject from the default nextjs server to have your own Express server since the beginning okay this design Choice continued for many years nextjs 9 released in 2019 introduced API routes these endpoints built on NE node.js request and response apis and the API similar to express as many folks were familiar with the apis at the time okay okay I didn't know JFK invented that he did yeah Absol absolutely wait they're getting rid of page routing uh well I don't think that I think they're now pointing everyone to app routing as like where you should start as AO uh as opposed to page router API routes and the ejected server still work today but Frameworks must evolve over time based on community feedback how the ecosystem moves and new functionality available in the web platform that's why nextjs 12 released in 2021 introduced middleware which was built on the web request response and fetch that didn't make sense to build new apis that weren't embracing the now standardized web apis note this was the same year remix version one was released we agree app router all right even let's see I mentioned Evolution right Kent me uh mentions this in his post to uh totally fair let's say I've been an outsider for the next Frameworks it's been a long time since I've shipped something on nextjs myself totally fair there's uh only so many hours in the day for family work and fun so I don't expect Kent or really anyone to have kept up with the chronology of nextjs uh here like I have but let me explain further about where we're headed after 6 years of feedback nextjs 13 introduced a new foundation for the framework with the app router the pages router didn't go anywhere but again the framework must evolve with the times if you were designing a new framework how would you handle reading values from the incoming requests like cookies or headers how do you allow developers to write custom API endpoints well the standard for web API of course going back to Kent's feedback okay so he is like directly saying we do to do all this again definitely true for Pages router inside get server side props the equivalent uh for the remix loader you can't use web apis to access headers or cookies it's no API still okay okay so uh so you're designing this framework you want to use web standard apis and so you also want to make it easy for developers to do the right thing Ken says okay I mean I like this article so far it actually this is actually a really good response uh to boil that down to a principle I would say instead of wrapping the platform API testing Library Expos the platform apis we agree but why couldn't we have both in the nextjs app router let's say you want to create an arbitary API endpoint these are now called route handlers this is what they look like all right I mean that looks like the that looks like the the request response apis uh route handles accept a web request and produces a response but what about cookies headers and more since you have access to the web apis directly you can browse mdn and reuse all the knowledge you've learned from nextjs also chat GPT is really good at creating those apis nice where's semicolon where the hell's the semicolons oh my goodness look at this no semicolons only semicolons in consistent didn't even use prettier uh we can also provide abstractions that can be uh composed by allowing you to write reusable functions without having to pass headers as a function parameter you can choose whichever you prefer this is kind of weird looking just because the request is here these are right here how do these get that you know what I mean like this must be a typo this is a typo right because this feels massively magic right because like how are you just grabbing the cookies oh it does work that way okay so I dislike that obviously I feel like cookies you should pass in the request that you want to grab the cookies off of right you should pass in the request to get the cookies or the headers bada bing bada boom it works I feel I feel uncomfortable about that because what's the current active request like how do you know that it's the current active request is there things I have to understand about awaiting why does he have an async function yet nothing in here awaits do you not know how much performance issues that causes with node uh the cookies function Returns the same underlying value uh headers a web API it can be used in both route handlers as well as the serers side code and app router like serers side actions or server components you don't understand there's no cookies on the request because I ate them thanks TJ for that insightful thing that I just read out loud I appreciate that I strongly agree with Kent I can't imagine a new Frameworks being released that don't embrace the web apis that's why remix felt kit n solid Astro nextjs and many more are doing this I really do I am I I'm like hot and bothered by this honestly I am hot and bothered by this that you can set cookies and you don't even know what like what request or anything you're setting it on okay that it it actually hot and bothers me I strongly agree let's see H Independence Ken mentioned uh mentions a project called open next which quoted the post yep we remember this one you support on AWS as maintainers of open next are building a platform for easily deploying serverless applications on AWS I would argue this package is trying to be an open source infrastructure as a code tool not open source framework naming is hard Ken says openex exists because nextjs is difficult to deploy all right remember that uh we were always looking to improve self-hosting nextjs for example I made a video and an example showing how to deploy with Docker to whatever service you prefer all right next start is how Walmart Tik Tok chat GPT Starbucks Target door Dash and many others self-host nextjs now you might be thinking but Lee that's not what Kent is talking about he's talking about serverless platform why wouldn't nextjs build first-party adapters for every deployment Target that sounds very hard by the way that is TJ's stream if anyone's wondering TJ does stream right here open source and framework boundaries de developers don't want wal Gardens uh they want freedom to eject and self-host it's about control this is why nextjs features uh works selfhosted for cell provides infrastructures and workflow on top of nextjs you can host nextjs anywhere you want I'm a fan of the model of nextjs uses it's clear how it's funded through versell and the incentives are aligned I want to deploy nextjs at some point maybe I'll try versell it's a similar story for spelt you want to deploy spelt skit spelt kit maybe try forell yep I I mean I think it's a great model right I think they're doing a great model for sell the maintainers of nextjs who invest heavily in the research and development are focused on maintaining and building the default uh deployment output for nextjs we aren't doing adapters although I love this for other Frameworks that's fair I wouldn't do adapters it seems counterintuitive to do adapters because now you're also maintaining a huge set of stuff like not only are you doing it for your platform you are now creating a huge amount of adapters for other platforms where you get nothing out of it right I I agree with this uh nextjs has over 85,000 monthly active developers and those developers expect things to work well I have bugs fixed uh quickly for new features to be released for us to respond to their questions in a timely manner let's see I keep hearing uh how next uh the hosting next yourself as a node application is a huge pain and I have no idea where this is coming from what is difficult containerize it create a uh deploy pipeline if you said yes to either then you likely have trouble hosting any app yourself ooh o o Vic oh my goodness the burn burn victim Vic uh I did mean uh I somehow do let's see I mean did I somehow do it wrong I have containerized nextjs apps running on prod for five years dude he just skill issued harder than I've seen anyone's skill issue in my entire lifetime this is the strongest case for skill issues I've ever seen we want to default a build output of nextjs to work well when self-hosting uh and also on ver sale and guess what they are the same output well almost let me clarify it took us a while at forell to figure out the the correct format and boundary between open source framework and infrastructure platform our philosophy is called framework defined infrastructure a let's see and critically the specification that versell uses for Frameworks is open source it's called build output API this output Powers nextjs as well as remix felt kit and many others Frameworks on for sale we actually maintain our own remix adapter too which transforms the remix output into this format plus some other features we'll soon be making the default output of nextjs match the build output API directly without some intermediate step we agree with the importance of keeping these pieces open and accessible which is why even open source even Source the intermediate step all right very cool all right I like the okay this is actually the part that we even argued about earlier pricing correlation versus causation I like this Kent mentions we can argue about whether versell is right or wrong about their current approach but the fact remains for sales pricing or other things become problem for you uh getting out for sale will also be a problem okay there are improvements I'd like to make to for sales pricing uh let's see and we'll have some updates soon some pricing changes have already rolled out like lower prices for our storage products and spend controls I but I understand the sentiment unfortunately the sentiment does not equal causation only exposing a full route refresh seems like a ploy on forel's part needlessly to render server components increase compute dollars I worry about uh that a bit with nextjs actually the nextjs technically uh technical approaches May optimize for their profit when deployed there so I mean to be completely fair if you're using react just that on the server to render things like you have to understand that you aren't going going for like some Thin compute cost layer okay you're just not going for a thin compute cost at all like at all and so it's kind of you're already fighting from like a very negative Point like a very very very very negative point nextjs is easy to run anywhere this is not true I'm getting tired of people continuing to claim this it dismisses the tedious work that openex next Community is doing well let's see is doing to actually make feasible to run it correctly outside of her sale yet another example so this is okay so we're actually having two different things we're arguing right here with server actions uh you no longer handr write API endpoints which means you don't have the ability to explicitly control versioning from forel's point of view this isn't a big deal because of their infra infra every deployed version of your app can stick around forever and request that old clients get routed to the right version absolutely this is only solved because of serverless functions which scale uh to zero they solve the problem via specific in infrastructure solution yet every demo of look how easy it is for next chance to host is always some simplified Docker deployment that glosses over details like this okay so this is very true what Dax is saying is very true but it's argued from two different versions right anytime you're not using some amazing infrastructure that hides versioning of these little endpoints no matter what you're going to run into this problem right NE Netflix which is not nextjs which is none of these things even back in our groovy days we still had to have endpoints tied to UI versions and we had to have a way to load in these endpoints based on UI versions like this is a real thing which always happens because those uis could live on for years back in the day so like is this a fair critique I I don't think this is a fair like a totally fair critique by Dax on this one which is this problem exists everywhere this is one of the benefits of versell which is they solve this problem for you if you wish to self host it you absolutely can but then you incur all the problems of self-hosting which includes this one problem does that make sense and this is a hard problem this is why you see apis like get video list 2 or get video list 3 is because you eventually have to change the apis but you can't actually change them because all these old endpoints exist the exact same thing happens if you're doing anything with um uh mobile right mobile like may not necessarily upgrade so you have to keep things around for a long time right so is it completely fa fair I don't think it's completely fair I think it's just that's the reality of trying to have version end points it's impossible I start my API with get video list 13 so that people uh think I spent a lot of time on the version nice I like this I like this it's the other way around nextjs has written their entire framework under the technical Direction and vision from the react team including changing some apis uh to something less next J uh next specific we care a lot about this kind of stuff and getting it right while versell obviously has incentives to take best advantage of react's abilities and Architectural model the idea of Designing the worst API so that versell could make profit sounds both repulsive and shortsighted I can vouch for everyone involved in the app router design yeah I'd agree Tech like whenever someone does this kind of thing where they're like they're trying to do it to make money it's just like I don't I don't really believe that I feel like that's not a great this isn't a great look if you want to self host all nextjs features to work also I just got to click this I just got to click this how do I click this link 200 people saw this yeah does it really warrant much response and all this probably not there's not like a lot there's like not a lot that you have to really does any does anyone really care uh anyways if you want to self poost all nextjs features will work so why would someone choose versell for nextjs then the same reason they choose Astros felt kit or even remix if you don't worry about infrastructure verell takes care of that for you plus some other stuff but that's besides the point and thanks to framework defined infra you're not writing a bunch of cdk code or bespoke infra as code Solutions you're writing nextjs code that's open and portable to any server on any platform yes nextjs is like kubernetes and forell is like Google kubernetes engine all right Kent mentions I know for myself it seems like forcell is trying to blur the lines between uh what is nextjs and what is react okay remember that definitely not intentional nextjs is placed a large bet on the future of react the app router builds they're also placing a bet on spelt smart of them by the way the app router Builds on many features the react team has been working on for years building and supporting framework requires a non-trivial amount of work Redwood is doing the same uh in retrospect we could have worked more closely with meta team on making some of docs changes directly on the react docs versus nextjs docs thankfully this has picked up a lot where we are actively collaborating with the team at meta shout out to meta's learning and advocacy team okay cool you know me personally I'm kind of over reading about all of this I think we kind of got more than we need is the is the taint going to be mentioned uh let's go let's go let's go to this uh let's go to this to magical I I actually want to hear about this for a quick second Kent talks about how he's not a fan of nextjs extending the webs fetch API I agree with uh with a part of this specifically on adding nextjs specific extensions to fetch API we're looking to move away from this direction based on community feedback next js14 for example if you want to opt out of caching You' use no store versus is Cash no store on the Fetch and if you want to use more uh programmatic caching and revalidating features those will soon stand alone apis as well I can actually agree with Kent's uh take on this one you know going back to it I think I was I think it is good to have a separate API for different Behavior I I can fully Buy on this one all right app router is very different model from Pages router it's almost like a new framework this is one of the many reasons why we need to ensure we could incrementally adopt the new router and the existing router and Foundation would be stable and maintained for many releases we also uh just created a new free course to teach the model uh then Kent goes on to mention next has virgin 13 react router built the same team has been around for much longer and is only version six uh remix was on version one almost two years and now is on version two I don't think the number of major versions correlates with whether a framework is stable or not especially when we've tried to take great care in publishing code mods and upgrade guides uh when moving between versions I actually completely agree with this saying that you're on version two means nothing me honestly it really doesn't mean a lot I'm 70 I I'm about 70% agreeing with Kent um anyways I really I I I'm fully agreeing that this it is a a silly argument to make that's like oh well react nextjs has more versions how does htx respond to the taint uh there's no taint all right I'm going to go all the way down to the conclusion that turned out to be a long one as Kent mentions I feel like both are highly capable Frameworks we agree you can make great web experien with both while I spend a uh most of the post ref uh referencing points from Kent I'd like to SP uh end with the general reasons why I love using nextjs I never write separate backends for projects I want to create I can build my entire project with an xjs I never worry about a bundler compiler or front end infrastructure I get to focus on making great products through react components and I'm able to use the latest react features which I personally have a great developer experience I'm able to update to the latest version of nextjs and uh and things continue to improve performance gets faster new features get added and the iteration velocity uh is high if there is changes code mods and upgrade guides are provided nextjs provides bunch of components that help me make my site fast images fonts scripts and now even uh properly loading third parties yep I think the images thing is very compelling the this is really really nice by the way for those that don't know that's fantastic it's effectively just a way for you to be able to get all the different sizing of images and the nice caching and all that built into your site as opposed to you trying to handle store and use your images I actually think it's really really nice uh images are very nice yeah I think it's great I think they did a great job with that uh at the end of the day you've missed me bertron well I've missed you too so at the end of the day here's my take on all this is you should like And subscribe to the channel absolutely but the problem with both of these arguments and really what I see is that they're both also these huge huge Frameworks in which you're doing something a specific way you get a lot of benefits doing this way and I can totally see why people want to use these uh I worry about new people that you not you just don't learn how the web works you learn how nextjs works or you learn how remix works you don't actually know at the end of the day how anything works because you just haven't done anything yourself uh again and again I've just enjoyed HDMX a bunch because it just allows me to separate these things out it allows me to have my server as the source of Truth and my client as something that responds to the server I just personally think that that is superior right in all in a lot of ways uh at the end of the day add client client side uh interactivity isn't hard thrown a little component thrown a little bit of JavaScript easy to execute you can listen to all events you can do whatever you want to do it's not a big deal but nonetheless do I think nextjs or remix are great I I mean I think they're great I I can't believe how good uh they've made things I think the image stuff by nextjs is incredible the font stuff is incredible um there's a lot of really good things uh but at the end of the day I don't want to keep writing JavaScript all the days you know what I mean I actually want to be able to uh invest in languages that are good at a specific activity like JavaScript is great at manipulating the Dom go is great on doing stuff with servers rust is great on doing stuff with servers it's kind of like I want to use languages for what I want to like for specific use cases that I think are better and so that's why I'm just going to continue to love um HDMX it's because I wanted I want that so there you go that's it that's all I have to say at the end of the day neither of these two things really concern me because I'm just not going to be probably using either of them to build my little things but maybe at one day I'll try nextjs and build the project with it who knows the name is the primagen
Info
Channel: ThePrimeTime
Views: 193,744
Rating: undefined out of 5
Keywords: programming, computer, software, software engineer, software engineering, program, development, developing, developer, developers, web design, web developer, web development, programmer humor, humor, memes, software memes, engineer, engineering, Regex, regexs, regexes, netflix, vscode, vscode engineer, vscode plugins, Lenovo, customer service
Id: UdCXUVhVSEE
Channel Id: undefined
Length: 54min 0sec (3240 seconds)
Published: Tue Oct 31 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.