Тёмный

The "SQL In React" Drama 

Theo - t3․gg
Подписаться 298 тыс.
Просмотров 58 тыс.
50% 1

I think we can all learn from this. Next/React, server actions, sql, "use server", I get why we're confused. Hopefully this clears up a lot of that confusion.
SOURCES
x.com/t3dotgg/status/17993560...
x.com/tomdoes_tech/status/179...
x.com/AdamRackis/status/17176...
nextjs.org/blog/security-next...
Check out my Twitch, Twitter, Discord more at t3.gg
S/O Ph4se0n3 for the awesome edit 🙏

Наука

Опубликовано:

 

11 июн 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 361   
@ktxed
@ktxed 18 дней назад
this is not fun, this is just php in new clothes
@SebastianGrantElKiva
@SebastianGrantElKiva 15 дней назад
Modeselekting
@lukasmolcic5143
@lukasmolcic5143 15 дней назад
Nothing wrong with PHP, but this also gives us types and LSP support inside our templates, which is missing in PHP templating languages, my ideal paradigm would be db to html in as least steps as possible + LSP in templates, this is really close, but I would prefer to do it in a BE first framework (GO keeps calling me to learn it), and do the client stuff with vanilla.js, the whole rerendering model is convenient for writing interactive stuff, but its bad in performing, its too much bloat served to the client for our convenience of writing state dependent UI's declaratively.
@jenreiss3107
@jenreiss3107 17 дней назад
I think at the end of the day the big issue here is that pretending that the boundaries between server and client are completely arbitrary is just a lie. in 99% of situations, the server is on one machine in one physical location, and the client is in a different one, often separated by hundreds of miles and many network hops. This SQL in Component code pretends like the internet is the one giant monolith and that you can access any part of it from anywhere it, which is just patently false. Eventually, no matter how sweet the lie is, somebody is going to run into a use case, or situation where the real fact that there are two separate machines communicating with two separate sets of data and two separate permissions schemes, will conflict, and this giant house of cards will come tumbling down and they'll be stuck with their heads in their hands trying to debug 5+ years of idealistic client developer dreams
@wlockuz4467
@wlockuz4467 17 дней назад
Well this has actually happened already. So when dealing with dates and server side rendering there is an obvious problem. If you generate a date on server and then try to hydrate it on client then you get two slightly different dates because some time has passed between the two events. This results in a hydration error because the hydration needs the state to be the same between server and client. The proposed fix by react team is to monkey patch the standard Date class which is a horrible idea imo. I'd much prefer if they just gave their own wrapper around Date instead of messing with the standard classes.
@super_b3aver
@super_b3aver 16 дней назад
@@wlockuz4467 Where can i find out more about this decision by the react team?
@GrumpyGrebo
@GrumpyGrebo 15 дней назад
100%. No matter how many frameworks people get tricked into supporting, the scaffolding stays the same. If you only know the framework, and not the scaffolding, you have always built a house of cards. Imagine that React has an unresolvable critical security flaw in it, or Primeagen becomes CTO of your company. You have to pull the framework, and 99% of your "engineers" are gone instantly because they know how to framework, not architect. It just takes one such instance and people are back to the old stuff, and the new guys aren't getting paid for that...
@ImperiumLibertas
@ImperiumLibertas 5 дней назад
I think server side rendering in general is a mistake. The majority of end user devices are very fast at rendering web pages. It leaves all of that compute power entirely unutilized. The last thing I want in my UI is for a backend change to cause a cascading affect throughout my application. In angular we separate out an api mapping layer specifically to handle server communication and map it to a front end contract so when a backend change is made only the mapper layer is affected the majority of the time. I don't want my UI to be exposed to backend complexity. Nothing to do with "separation of concerns." Instead we are isolating and segregating the complexity of the two applications.
@cblanquera
@cblanquera 17 дней назад
No methodology approach. There is no server. There is no client. No need to separate. Just put everything in your page file and build up that technical debt.
@shadowpony9243
@shadowpony9243 16 дней назад
method 1: need nothing but when over 10 lines put in own file 🤡
@HamdiRizal
@HamdiRizal 18 дней назад
We've come full circle back to PHP
@nou4605
@nou4605 18 дней назад
This is what we used to do years ago with PHP and it was considered bad practice. Now you are telling me it's cool?
@SirFrey
@SirFrey 18 дней назад
mix php with not composable markup was bad practice ofc HAHA
@amogh708
@amogh708 18 дней назад
This is still not the best, because most of the time I'm confused what is client and what is server
@connormc711
@connormc711 18 дней назад
You didn’t though this is setting up an rpc. I’m not saying it’s right but get your brain rot out of here
@SirFrey
@SirFrey 18 дней назад
@@amogh708 That's a thing, I hope that with the new tools that comes these months that problem it's settled, you can learn though
@meepk633
@meepk633 18 дней назад
It isn't what you used to do with PHP though. It's specifically different, which makes it different.
@nordern1
@nordern1 18 дней назад
My problem with these tag literal functions is that they always *look* like the wrong thing. Like, we have spend years training people to be afraid of exactly this kind of string, and now we make a syntax that makes that OK. I'm not saying taking the obvious naive solution and just making it work and making it safe is bad, but that it comes build in with disgust and fear around it, and such a reaction to it is perfectly understandable and predictable. Same might go for the use-server stuff. I have seen beginners in PHP confused why they can't run their PHP code when someone clicks a button. It's a classic beginners trap. So now these people learned "the proper" way this works and when they see code with "use server" that they assume it's just uneducated, or subconciously get mad at it because they had to learn all this other stuff.
@SwoopWoW
@SwoopWoW 18 дней назад
Yep. Accidentally add some brackets around this and it's vulnerable to injection. Makes it much harder to catch mistakes like this if the "correct" way looks the same at first glance.
@Kitulous
@Kitulous 18 дней назад
@@SwoopWoW I hope the devs have thought of that and calling the sql function with 1 string argument (when template functions requires the 1st argument to be an array, and 2...N args are any type, or they may not exist) will yield an error or something... preferably even before running the code, e.g. highlight it as an error in the IDE.
@meepk633
@meepk633 18 дней назад
Doesn't sound like a problem at all. If someone is writing an app using a stack that generates server code, they have more than enough capacity to understand what is happening. New users have to learn all kinds of things. It's not like you could drop this in a random HTML script tags and accidentally nuke your DB. It doesn't point anywhere without the compiler.
@MrManafon
@MrManafon 18 дней назад
Well perhaps we should have "spent years" teaching developers WHY writing SQL with concatenated variables is bad, as opposed to teching them to be afraid of seeing SQL.
@nordern1
@nordern1 18 дней назад
@@MrManafon That's not the point. They know why concatenated SQL is bad. That's why it causes issues when you introduce a syntax that looks exactly like concatenated SQL.
@lionlike5856
@lionlike5856 18 дней назад
These hipsters just can’t help themselves….
@dimitrisefstathiadis6562
@dimitrisefstathiadis6562 18 дней назад
Well. All is fine, but in reality the backend is needed for non trivial projects. If y have 3 resources that Crud cool. But when you have Authentication, Authorization, RBACs, Sessions, Postgres + Caches, Stripe Subscription + Payments, Plans, SMS, Email Scheduling you typically need a robust backend. The problem with tutorials is real..
@limp6986
@limp6986 18 дней назад
Did you watch til the end? You can do exactly what you stated. Separate concerns at will. The first demo was just to show one way of doing it and it was mentioned that this is NOT the recommended way for production projects. But it's a good way to write code when you just want to prototype something quickly.
@BCRooke1
@BCRooke1 18 дней назад
If you’re building a pet project, separation of concerns is not as big of a deal. But can you imagine migrating to a different technology when there isn’t a nice separation? It’d be so much harder
@David-gj6dc
@David-gj6dc 18 дней назад
This is why a strive for less dependencies, which admittedly is very difficult in Node land. The more abstraction you pour on top of everything, the more locked in you usually are.
@airkami
@airkami 18 дней назад
I understand you and I properly disagree. If you are designing something specifically to be migrated later, just writer it in the language that is its final destination the first time. If someone 20 sprints from now wants to migrate it, it should be never be the dev that gets blamed for the fact there wasn’t a design choice to make it easier to migrate. Do you see what I’m trying to say?
@BCRooke1
@BCRooke1 18 дней назад
@@airkami changing technologies or refactoring code is quite common, and almost always without foresight. Maybe you have a new customers and therefore new requirements. Or scaling issues. Or maybe a product feature didn’t land well and you need to redesign. One recent example that comes to mind is Uber moving from Postgres to MySql. Ain’t no way 20 sprints ago they said, “alright let’s implement it in Postgres, but ultimately we want MySql”. That’s asinine.
@OrhaninAnnesi
@OrhaninAnnesi 18 дней назад
@@airkami No one is designing anything to be migrated later on, its just that in real world changes are bound to happen. You can not always predict the whole product specification and requirements from the first step and you might need to pivot at some point. You pretty much always need to pivot at some point if you have an actively developed product, the question is usually not if but when and how much. The dev should be blamed for not accounting for the possibility of a pivot because any decent dev should know that they are bound to happen but the dev shouldnt be blamed for the lack of a full fledged migration case planning. I really like Theo and his content but those "arbitrary boundaries" are not really that arbitrary, they are there for a reason. I dont suggest going crazy over very strict rules and making a very simple project a fragmanted mess in the name of separation of concerns but striving for those "boundaries" without losing sight of what and when you want to achieve something is the key imo.
@l10nbit
@l10nbit 18 дней назад
People overthink this. Separation of concerns is frequently an exercise in futility. CSS and markup seperation for instance. 50% of the time beneficial and 50% detrimental depending on the project ie Apps vs Information sites. When structuring code, the lines of separation are also very arbitrary. For example, the vast majority of SPA's have a custom endpoint on a custom backen for a specific purpose that is so tightly coupled that it is really only useful from that one place it used in the frontend, but now it is split into two places. I separate based on future anticipated pain points. Sometimes a monolith makes sense. Sometimes a bunch of micro functions make sense.
@okikejiani
@okikejiani 17 дней назад
Please tell me this is satire... There is nothing about the example that is shared here that is good clean maintable code. We did this for years in PHP, eventually realzied it was wrong. History repeating itself.
@simonebottino5165
@simonebottino5165 18 дней назад
Too "magic" for me
@deadchannel8431
@deadchannel8431 18 дней назад
Thats why I only use assembly
@RepChris
@RepChris 18 дней назад
@@deadchannel8431 assembly is magic too, do you really trust an "assembler"? Thats why I only directly write the machine code, just like von Neumann intended (yes, really. Look up his stance on assemblers)
@CHN-yh3uv
@CHN-yh3uv 17 дней назад
@@RepChrisyou’re using computers? Pathetic, I bang 2 rocks together like my ancestors did in the neolithic period
@Adityacode
@Adityacode 15 дней назад
Just use remix then.
@Tackgnol
@Tackgnol 12 дней назад
@@Adityacode To me "Just use Remix", for like 99% of people in the small group that actually needs strong SEO, the bloat of Next and it's "magic" will just impede them.
@CottidaeSEA
@CottidaeSEA 18 дней назад
The reason why I am against things like this is for a single reason. People will make abominations. I've already worked in multiple codebases where people fetch, mutate and render data in a single file and has made things impossible to maintain.
@manekedark
@manekedark 18 дней назад
Like old PHP
@fionnlanghans
@fionnlanghans 18 дней назад
It has been done since the dawn of programming UIs. It will be done again.
@fionnlanghans
@fionnlanghans 18 дней назад
e.g. PHP "templates"
@pokefreak2112
@pokefreak2112 18 дней назад
How is it impossible to maintain? If everything is in 1 file you can just modify whatever you need, it's very nice and straightforward And if you need the same logic in multiple places you can always extract it into a common function and call it from whichever file needs it
@CottidaeSEA
@CottidaeSEA 18 дней назад
@@pokefreak2112 You're essentially suggesting a rewrite and at the same time claiming it's maintainable. Do you see the issue?
@rifaldhiaw
@rifaldhiaw 17 дней назад
I think the problem is that React used to be a framework with very less magical things, and that is why it's popular. and now it become hey this mark mean this and this
@pushyoch.8252
@pushyoch.8252 18 дней назад
"use server" acts wayyy too much like a magic word/phrase. is there no other more pleasant way to wrap the functionality?
@dvhh
@dvhh 18 дней назад
Kind of remind me the old "runat=server" attribute for asp (?)
@smoked-old-fashioned-hh7lo
@smoked-old-fashioned-hh7lo 18 дней назад
solidstart used to have a server function macro which was a lot better in my opinion. they switched over to "use server" not that long ago unfortunately.
@shapelessed
@shapelessed 18 дней назад
First thing I would think of when seeing SQL inside of a client-component would be "Oh, nice, they probably use some kind of compiler or what not to replace the sql with a fetch call on the client and generate a corresponding REST endpoint on the server". The only thing I would be wondering how it's done is authentication in this case, but otherwise it looks really nice. I always found it frustrating to do a bit of frontend, then a bit of backend to check if everything works, debug both and repeat. I hate it when I have to switch between the two, because when you can focus just on a single thing, you get into a deeper state of focus and it just goes faster.
@tomaslachmann171
@tomaslachmann171 18 дней назад
Yes, this is what I want to see, authentication and some security mechanics when using this approach.
@aakarshanguptaa2_013
@aakarshanguptaa2_013 18 дней назад
wait wait why would anyone do that? if something like that is gonna be compiled away anyway to REST endpoint ?
@fathinfadhil
@fathinfadhil 18 дней назад
you can access the request header and cookie inside the server action to do authentication and authorization, they basically recommend to treat server action like a public facing api.
@dealloc
@dealloc 18 дней назад
It's not the sql call that is transformed, its the call site of the action within client components. The action will be placed in the server bundle, then the call in client components will be transformed to an endpoint (actions are executed based on their ID from the same queue). Your sql call will stay as-is on the server-side.
@shapelessed
@shapelessed 18 дней назад
@@dealloc You just said that I'm both right and wrong..?
@AncientSocrates
@AncientSocrates 18 дней назад
Web dev is a joke. And I dislike frameworks that try to be too smart, and do magic behind the scenes. This doesn't also teach you anything, because you have no clue what is going on, you are just a tech witch doctor.
@filipg4
@filipg4 18 дней назад
Couldn't be web devs fighting over syntax instead of solving problems. This industry has done nothing in the past 10 years other than glue together stupid syntax and frameworks in 1000 different ways. It's not SQL in react server actions that is stupid. It's the entire industry, you all need to do some serious grass touching and realize I don't want to wait for 10 seconds for your bullshit code to draw a button. Web would work just fine with 95% less code, you have lost the plot.
@nou4605
@nou4605 18 дней назад
Based
@toadman5184
@toadman5184 18 дней назад
Yeah, I've been web developing since the late 90's and can attest that the problems we solve today are not much different from 25 years ago. Back then the tools were much simpler, now web tooling is like a fever dream. But they are all within the same basic paradigm: Read the data storage, template it into html, display. Receive user input, broadcast to server, save to data storage. Over-engineering and the pursuit of 'hip' tooling prevents web development from ever leaving its adolescence.
@infantfrontender6131
@infantfrontender6131 18 дней назад
You will wait for 10 or more seconds because the business wants SPA and all this beautiful interactive stuff. We have a lot of light frameworks of meta frameworks, but businesses are more interested in heavy SPA
@vitorwindberg4212
@vitorwindberg4212 18 дней назад
this is completely based... web has gotten a lot better, websites got significantly faster in the last years with better UX/UI and easier to build just because of the advance of technologies like react.js,next.js and its competitors
@underflowexception
@underflowexception 18 дней назад
What happens if you want to add middleware to a server action to ensure the user is authenticated etc?
@kabukitheater9046
@kabukitheater9046 16 дней назад
more react code spaghetti that's for sure.
@connorskudlarek8598
@connorskudlarek8598 15 дней назад
What do you mean? The middleware would just be a function.
@Mr_Simmons
@Mr_Simmons 18 дней назад
I'm curious. If your goal for your project was to also make an API that is consumable for 3rd parties, would you also just make an API layer which exposes your DL object (in this example), and then in your main application use all the server component stuff for the nice usage pattern (among other things)? Or would you approach it a more like how you would before server components were a thing. I find myself still wondering about that as in my current job a lot of the projects that we make / maintain are designed for 3rd party integration. I would really like to start using this, but haven't quite wrapped my head around how you would handle a scenario like this.
@elmalleable
@elmalleable 18 дней назад
You'd probably go api first and someone or team take care of api since api will now have to be documented, maintained and enhanced as requirements dictate and evolve. The api becomes it's own living project with challenges and complexities.
@drosi1994
@drosi1994 18 дней назад
If you are creating a 3rd party API, why you even use Next.js?
@elmalleable
@elmalleable 18 дней назад
@@drosi1994 maybe recency effect and his brain has freshly cashed knowledge on next js backend stuff. Why would you pick and not pick next?
@Mr_Simmons
@Mr_Simmons 18 дней назад
@@drosi1994 We are not yet. I'm evaluating options for a project that we are starting in a few months. I'd like to be able to use RSC because the pattern seems cool and would work well for the first party UI of the application, but the requirement of having the API accessable by 3rd parties is my sticking point
@elmalleable
@elmalleable 17 дней назад
@@Mr_Simmons I think it's going with the api approach and consuming the api is your best option. This is because doing rsc would effectively duplicate data calls. But I believe you can still consume your own api using rsc. You will have to build your api either ways for the consumption of external parties. Dog food the api by consuming it yourself. That way you see also validating the api. But what weighs more in making the project successful? Third parties consuming your api or your internal use?
@richardhaddadau
@richardhaddadau 18 дней назад
Supabase capitalises on this a lot. Taking advantage of the server side, feeding into the component. It's made my most recent projects so much smoother and cleaner when working on them.
@daveism1
@daveism1 18 дней назад
Watched the whole video and am even more concerned. Mainly, how can you enforce authentication and per-endpoint authorisation (or even something like Role Based Authorisation)? Also, everything posting back to the root directory of the site seems like an analytics nightmare, no? For example, how would I go about investigating the API surface for issues? Please reply if you have answers.
@MichaelBilenko-florio
@MichaelBilenko-florio 17 дней назад
It looks like another abstraction layer is needed. Theo created only data abstraction layer, but to have per-endpoint authorisation another layer will be needed, like controller/presenter layer, which will check that current user actually has rights to access this resource. So final code will look something like: formAction={async() { "use server"; await UserPresenter.deleteUser(id); }} const UserPresenter = { deleteUser(id) { const currentUser = await getCurrentUser(); if (hasPermissons(currentUser)) { await DL.deleteUser(id); } } }
@moritzschuessler
@moritzschuessler 14 дней назад
do these in the server action. Basically your auth your user before the db part is fired. If the user isn't allowed to do the thing you return an error
@weifengmao
@weifengmao 18 дней назад
.net and specifically ef core has something similar. SQL injection had been so well publicized and understood most frameworks will probably automatically handle interpretations.
@jimiscott
@jimiscott 18 дней назад
Yeah, but the EF core framework is specifically to deal with SQL ORM - this is just some straight SQL bang in your react code.
@Kitulous
@Kitulous 18 дней назад
wym? do they use a custom InterpolatedStringHandler?
@Zayelion
@Zayelion 18 дней назад
Reminds me of linq, but my problem with it is it's not terribly clear where everything is happening. The framework is doing a bit to much work.
@across_the_rainbow_bridge
@across_the_rainbow_bridge 18 дней назад
"a bit" :D :D
@naughtiousmaximus7853
@naughtiousmaximus7853 18 дней назад
Idk I like dotnet a lot. You can also always inspect what kind of queries are ran by LINQ.
@kassios
@kassios 18 дней назад
the crazy part is when you use "use client" and the component is still rendered on the server initially
@ilyavasylevsky3229
@ilyavasylevsky3229 17 дней назад
In the old good days when PHP had PHP, HTML, JS and SQL in 1 file, we called it spaghetti code and were rewriting, or just burning it. Nowadays people writing JS, HTML, SQL, CSS in 1 place and call it "thats so cool"... I hope server side rendering will come back because it's not even funny anymore...
@normalmighty
@normalmighty 16 дней назад
I honestly just think the choice to make a magic "use server" string to tag this kind of thing was a huge mistake, and is always going to look awful to a lot of people. I don't understand why it isn't some form of wrapper tage that surrounds the server action instead. It just feels like a gross hack.
@t3dotgg
@t3dotgg 16 дней назад
A “wrapper” would be describing different compiler behaviors via an import, that sounds much worse to me
@SanderCokart
@SanderCokart 17 дней назад
I raised this at work and their reactions were of the charts 🤣🤣 how it's soooo unsafe lol. I told him the only way this is not safe is if you have a developer that's gone rogue lol
@br3nto
@br3nto 17 дней назад
5:59 how do you specify that endpoint requires authentication or permissions?
@neatkefe
@neatkefe 18 дней назад
Feels like I've lost my very personal battle agains the "fullstack" title. In my experience, what fullstack ends up meaning, is a decent front end developer and an ok backend developer. Separation of concern is about more than clean code. IMO it's about making it clear to stakeholders (and junior devs) that moden tech is not a one-skill-does-all thing. You'll need experts. And the more those patterns are broken, the more debt you gather for the day you need to scale just slightly. On that note, so much of the new things in JS libs are dons just because they are cool, and would work perfectly for small singular dev projects. There is a use case for them, for sure. But I think JS influencers should talk more about how you would actually want to do things when you're working with ten teams of 8 developers, in 15 repos and 10 different apps :)
@alvarolozano007
@alvarolozano007 11 дней назад
And does the static generation work when using SQL? For fetch calls, you could tag every request, set the cache and revalidate it, but with SQL calls I don't see the option
@umm_iter
@umm_iter 16 дней назад
this react SQL query is a very clean abstraction . It all depends on the devs how good and bad they are in managing abstractions. There are no rules but good designs - which is simple to understand and easy to apply / decipher
@Omeha2
@Omeha2 16 дней назад
Backend developers * trying to split everything into microservices, use onion architecture etc * Frontend devs - Let's try to write everything in a "single" file.
@robertlenders8755
@robertlenders8755 18 дней назад
How do I understand the API surface of my app? Oh that's easy! just go through every file and UI component and pick through the JSX for magic strings
@angshu7589
@angshu7589 18 дней назад
Or... you watch the video for long enough to realise he suggested a solution for that: having a data access layer, where you abstract away the DB functions in their own file/folder and call them in your server actions. But better question: Why do you want to understand the API surface of your app anyway? APIs, for us web devs, are just a means to an end, to get DB stuff or Auth to run on the server. It's only so that our UI can work. The only time you'd need to worry about your whole API like you suggest is if you made a public-facing API, but you'd obviously not use this pattern for that.
@jackjsy
@jackjsy 18 дней назад
Most apps are being built to serve some kind of frontend, so if you wana see what the "api surface area" is, just go to where it's being displayed it can't really get any clearer tbh.
@chipmo
@chipmo 17 дней назад
Well, if you wanted an API you should really consider building an API. Do you laugh at racing cars because they don't have pickup beds? Do you insist that all buildings should be built from the same materials?
@robertlenders8755
@robertlenders8755 17 дней назад
@@chipmo if you're building some website, the API is all publicly available endpoints whether they were designed or not. From both a security and maintenance standpoint, obscuring the API by embedding it in UI components is a complete nightmare
@jackjsy
@jackjsy 17 дней назад
​@@robertlenders8755 The amount of security/DX/UX issues caused by creating an API layer just to serve a frontend is the exact reason these new patterns exist. Having an API doesn't equal good security and maintenance, having a good a setup and good practices ensures that, there's no reason this cant be achieved by "embedding" it in the UI, just abstract the functions to an "API" folder and structure however you like, and you've got the exact setup an API could have, but just without the crappy network code. so much cleaner.
@marcelosyd
@marcelosyd 18 дней назад
Is that Poimandres Storm or normal theme?
@theodorealenas3171
@theodorealenas3171 15 дней назад
I like it! I've read a lot of Robert Martin's blogs recently (the SOLID and Clean Code guy) and I assume he'd go "meh, nice enough." I wonder what exactly he'd have to say.
@infantfrontender6131
@infantfrontender6131 18 дней назад
We have two chairs: frontenders who want to use SQL in their components and backenders who avoid JS in client applications by replacing it with WASM
@tomaslachmann171
@tomaslachmann171 18 дней назад
Not really, this just feels too much like magic.
@smoked-old-fashioned-hh7lo
@smoked-old-fashioned-hh7lo 18 дней назад
most of the wasm frameworks are based on js frameworks. leptos is a clone of solid/solidstart with colocated server functions. dioxus also has server functions. the main benefit is server side performance, not necessarily dx on the client. although in my opinion, the dx is better but that's subjective.
@dahahaka
@dahahaka 18 дней назад
one "issue" i see is that you might end up writing a client function which calls multiple server functions, maybe even in a loop, and it might not necessarily be obvious that you are calling a server function, resulting in an excessive amount of requests being sent to the backend
@dahahaka
@dahahaka 18 дней назад
although that is probably something that can be easily cought by a linter (calling multiple server actions from a client function => fix: turn this into a server action instead)
@jackjsy
@jackjsy 18 дней назад
But whether it's a function or whether it's an api call, you still are running the risk of sending many requests? so to me it doesnt seem any different - other than the fact you dont have to wire up a network call anymore, so long REST/gql :D
@dahahaka
@dahahaka 17 дней назад
​@@jackjsy From what i read in the docs you can just call the server actions as normal functions inside a server function, which means that instead of sending out 20 requests form the client to the server, you would just call the function 20 times serverside Also even if those 20 calls weren't other server functions but actual requests, if those requests are sent to your service infrastructure, sending them from inside the cluster will have almost 0 latency And then there's also ratelimiting which might get triggered with smth like that :D It's not a massive issue, but i think one of the only "fair" criticisms i can come up with for this "pattern"
@jackjsy
@jackjsy 17 дней назад
@@dahahaka Fair points!
@oldmonkplays
@oldmonkplays 18 дней назад
Are they going the PHP way? 🤔
@programmerjowo
@programmerjowo 18 дней назад
React is PHP way. Angular is java way
@nou4605
@nou4605 18 дней назад
It always was the PHP way.
@ticler
@ticler 15 дней назад
It is PHP all the way down. Always.
@rivomananamandaniaina5193
@rivomananamandaniaina5193 14 дней назад
I do implement all my recent projects since stable server actions this way, have my plain typescript service functions organised, use it directly on server components, and when if external clients needs api, just create api routes end expose thoses exact service functions. Not only it makes code more cleaner, it's really fast to implement. What i like the most is switch from ORM or any database and external services easy..
@yojou3695
@yojou3695 18 дней назад
there's nothing you can say to me, when i see that "use server" i will ALWAYS cringe
@adityaanuragi6916
@adityaanuragi6916 18 дней назад
Is it because things are rendered on server by default? sry if it's dumb I don't use next js Edit : ah mb I continued watching the video
@taylorsabbag6962
@taylorsabbag6962 18 дней назад
“use strict”
@serveshchaturvedi2034
@serveshchaturvedi2034 18 дней назад
That's the best part, you don't have to use it if you don't like it. It just gives us another option to compose how we want
@lyovson
@lyovson 17 дней назад
You seem to think that people care about how you feel about this.
@yojou3695
@yojou3695 17 дней назад
@@lyovson well you seem to be offended, who knows why
@JacobSantosDev
@JacobSantosDev 18 дней назад
I love the thumbail with the sql injection security problem. That look and the sql injection was just a chef's kiss. E: that is cool and i totally forgot about that usage. I would never use that usage since i want to ensure explicit control along with function comprehension. Which is why i ignored it completely and forgot it existed. The day someone removes sql from the beginning and i have to use my tools is the day i remove it from the codebase completely.
@Atmos41
@Atmos41 17 дней назад
Nice endpoint security. Now you don't even know where the endpoint is. Hacking websites in 2030 is going to be a piece of cake.
@Tackgnol
@Tackgnol 12 дней назад
This would be a revolution, but in in the 10+ year NextJS tradition it shipped in a horrible state, with tons of bugs and inconsistencies. The whole thing where this ships with React 19 features, where React 19 is not out yet, it's just such a mess... Many early adaptors are just going to bounce of it, and leave horror stories online for people. You are doing good work by clearing up lies, and when the AppRouter and server-actions/components are going to be ready in Next16, you will be able to say 'I told you so'.
@sadasspanda
@sadasspanda 17 дней назад
This SQL drama's cool but where'd ya get that shirt??
@asteinerd
@asteinerd 18 дней назад
1:10 in; I have virtually no real-world experience with React, and I'm mostly working in dotnet and Angular... and I immediately see the 'sql' before the literal template and realized React created some sort of interpolated string generator that parametrizes and sanitizes the values it's inferring. But I'm also curious why a much more portable service-layer isn't being used... code like this is fine for rapid application development, but it's kinda grinding against the standards and norms of enterprise code.
@elmalleable
@elmalleable 18 дней назад
Can you elaborated on the standards and norms. I've tried. DotNet a few times and it boggles me to infinity the amount of configuration and intermediate stuff the must be setup just to get some things working. Did DotNet /enterprise become that way because of things like regulations and traceability?
@asteinerd
@asteinerd 17 дней назад
​@@elmalleable Yea, pretty much. It's so traceable that it has a ILogger interface baked into it that you can leverage with any number of "Factory" solutions (NLog, Serilog, etc) It's written that way so you can flip out modules, components, libraries at-will even if very few teams ever make use of that flexibility. --- ... so. .NET implies .NET Framework; which is 4.8.1 and earlier; this is what WinForms and MVC 3/4 were most likely written in. When you see 'dotnet' written out like that it's implying it's dotnet core; so effectively dotnet 5/6/8 (usually whatever the LTS version is at that point in time). .NET Framework = 80% configuration dotnet 8, one file of dependency injection and configuration, the rest is code. At the end of the day dotnet is all about rapid application development on enterprise solutions, so it needs to be durable but also dynamic enough to handle oddities/nuance that business logic dictates. It's meant to be written with "do not repeat yourself" in mind, but "enterprisey" code is also supposed to be written in silos, meaning THIS branch of logic shouldn't effect THAT branch of logic directly. That's why most modern dotnet is going towards CQRS and/or Mediator Patterns where you can just write hot-swappable micro-services that simply move data around to conduct individual pieces of business logic.
@b0jang
@b0jang 17 дней назад
@@elmalleable It's more that Microsoft products and their ecosystem are just very well suited to large organisations. Doesn't matter if the dev experience sucks, they're not the ones making the decisions on what to use.
@thegreekgodapollo9787
@thegreekgodapollo9787 18 дней назад
Even though I enjoy seeing boundaries being pushed, I still don’t know why the way it is today is not the way 😅 is it just me that likes having two different codebases (even with different technologies and languages) to handle frontend and backend separately? It’s not even about the separation of concerns to me, it’s more about not wanting to use JavaScript more than I have to
@NicoRTM
@NicoRTM 18 дней назад
I think we only have the discussion because of the example using directly sql in the react component. If the example used a data access layer I'm pretty sure no one would have complained
@null9974
@null9974 13 дней назад
So are tag functions in React the equivalent of Dapper parameterized queries in .NET?
@MuffinologyTrainer
@MuffinologyTrainer 15 дней назад
We have come full circle, god dammit.
@jhkmatthews
@jhkmatthews 18 дней назад
With the button example at 5:50 - what does the POST request look like? URL and body
@jhkmatthews
@jhkmatthews 18 дней назад
ah, shown at 21:13 - the form has hidden input fields with encrypted data, those values are POST'd in FormData to `/`
@Cyrigar
@Cyrigar 17 дней назад
Not starting this with an off-key "Oops I did it again" is one of the worst misses of the modern age
@jak3legacy
@jak3legacy 18 дней назад
Another issue with server actions is transportability between react web and react native, if you're multi-platform. A more SPA approach to begin with is much more translatable to a mobile app / React Native
@oligreenfield1537
@oligreenfield1537 17 дней назад
We are back to php 2006 and htmlspecialchars
@flipperiflop
@flipperiflop 17 дней назад
Damn, not sure what direction I feel about this - on one side it's really nice to now have to write API endpoint on the backend, add the front-end version of that and do all the boilerplate code to make things work, just mark a function as "use server" instead and be done with it. On the other side it does seem like it can get messy quite fast, especially on bigger applications. Wrote a quick test using next's where the server function just reads a text file and returns the content, and it is quite a nifty way of doing things.
@Animesh878
@Animesh878 18 дней назад
What that fuck r doing the dev community SSR -> SPA -> SSR
@paw565
@paw565 16 дней назад
For bigger projects I still prefer react query. It's amazing and you can also prefetch on the server 😊
@bryanenid1228
@bryanenid1228 14 дней назад
"Use Server" means => Use this block only on the server
@anatolydyatlov963
@anatolydyatlov963 11 дней назад
11:23 see, this is exactly the issue. I don't want to have to worry about server-side stuff accidentally bleeding into the client-side. It shouldn't be possible at all, no matter if I make a silly mistake or not.
@markeggers8356
@markeggers8356 18 дней назад
The DAL (we call this DAO in Java on the server side) is exactly how code is structured at $work. We do this so that we can have a services (microservices) with defined contracts that multiple front end applications can use. As long as we maintain the contract, no one cares how we provide the information. If a new application needs something similar but different, we can make a v2 of the service. Then other v1 service consumers can migrate when ready (or not). I can definitely see an advantage of making a component-based structure for API / service accesses that are unique to a particular application. Going through extra hoops "just because" engenders lots of extra code to maintain. However, if not done correctly, clarity and maintenance become challenges. This is where a well-designed DAL (like you are doing when I paused the video) is key. This enables developers new to the code base to find, fix, and extend an application with less chance of breakage. And as we all know, the cost of an application is not in its creation, but in its maintenance. And developer burnout is increased by being shackled to a code base that only that particular developer understands.
@MrOboema
@MrOboema 18 дней назад
SQL in your front-end code? *Ancient PHP programmer enters the chat*
@elmalleable
@elmalleable 17 дней назад
🤣
@ehm-wg8pd
@ehm-wg8pd 17 дней назад
but acktchually php era the Frontend is backend code eh?
@ilyavasylevsky3229
@ilyavasylevsky3229 17 дней назад
🤣
@gFamWeb
@gFamWeb 17 дней назад
If the template function ends up using prepared statements, I think it's fine. If it uses bog-standard sanitization, I think that's still an attack surface. Using prepared statements moves the issue into the database library itself. Using sanitization keeps the issue in front of the library, inside your sanitization logic. All it takes is one single case that you didn't think about to get past the sanitization layer, and you have SQL injection. Prepared statements avoid SQL injection entirely. As long as it's using those, I think it's ok.
@shadeblackwolf1508
@shadeblackwolf1508 15 дней назад
My only complaint here, is doing SQL and web UI formatting in the same object and the same function. I would probably make homefeed either make or accept a PostRepository, that has the methods to query posts. Then i can ship in a mock repo instead to test behaviors with the data.
@dvhh
@dvhh 18 дней назад
I think I can appreciate the fact that he is defending the pattern by saying that it is "magical", and that a lot of parts are very very confusing. And that is probably my biggest issue with this pattern, I think separation of concern allow the clearly express your intent, not mentioning the benefits of focus mostly on what you should be concerned about, and not care about backend stuff that you should consider as abstraction. Because as long as SQL has been around, it is not the only player in town anymore and I feel like abstraction erasure will either prevent improvement because backend change would mean modifying a large mass of code that has a lot of stakeholders, or either block frontend change because those generated endpoint are being used by other unrelated clients. Meaning as it is this would probably be a great pattern to obfuscate your code.
@br3nto
@br3nto 17 дней назад
5:03 I think the fact that it isn’t obvious that it is doing some sort of query parameteristation and sanitising is problematic. Sue I question one you know it’s tagged with the sql at the front maybe…. But I can see how it causes a certain kind of habit which could devs could easily mistakenly use in incorrect ways and accidentally introduce vulnerabilities. It’d be quite easy to skip introduced vulnerabilities in PRs too. Maybe it’s convenient, but it looks fraught with long term problems.
@clementdato6328
@clementdato6328 16 дней назад
I think it is either 1. sanitized, then it is just a syntactic sugar that why not just call the actual JS function instead of using seemingly SQL syntax which is only a false impression. Embedding another language is ALWAYS more demanding in terms of tooling such as linters. You code formatter and linter and conventions multiplies into exponential complexity. 2. Not sanitized, then it is security issue. There is absolutely no win here.
@TomDoesTech
@TomDoesTech 18 дней назад
Glad you liked the memes :)
@charliecarrot
@charliecarrot 18 дней назад
I think a lot of the people hating on server components and server actions 1) haven't taken the time to learn how to use them, and 2) have difficulty understanding when to and when not to use the features they enable. Making certain things easier and opening up possibilities is a good thing, at least in this case. A little CRUD app probably doesn't need a separate dedicated backend, or an API, or microservices. If you're working at a large company with lots of separate teams, and need different types of system integrations, and have established technologies in place, maybe it's not smart to choose a full-stack framework like Next and implement everything through server actions. And for a greenfield web project, maybe it doesn't make sense to over-architect at the beginning, but instead use Next and server actions to get something simple and usable out fast. The different technologies themselves aren't GOOD or BAD, they're just more or less suited to different situations based on the needs of the project.
@trietang2304
@trietang2304 18 дней назад
What is not fine is the same as anyway you code, just validate your data before touching the db. What I wish Next can do is have a way to specify server actions so that we can build a backend compatible with it.
@br3nto
@br3nto 17 дней назад
As long as you can quickly unit test without having to load up an entire system
@hughmungusbungusfungus4618
@hughmungusbungusfungus4618 18 дней назад
All you've done is separated React into client and server libraries. How is that not separating concerns?
@neociber24
@neociber24 18 дней назад
It is
@Frostbytedigital
@Frostbytedigital 18 дней назад
It's separated in functionality, not separated in files/code. Your server needs can live right next to the client needs. However I feel like this just makes things less straight forward to address in the future. I'd rather them be more separate so I can address them separately as needed.
@hughmungusbungusfungus4618
@hughmungusbungusfungus4618 18 дней назад
​@@FrostbytedigitalI tend to agree. I have API services that operate as a backend to multiple different clients, and having all of these in React doesn't seem to be a particularly good solution to me. On top of that, this seems like an abstraction over the communication that's actually taking place and that seems like a really easy way to shoot yourself in the foot.
@urstrulypriyankrai
@urstrulypriyankrai 6 дней назад
For multiple clients the backend api makes sense. For site only I don't need them
@codechapin
@codechapin 18 дней назад
You probably could do the original option with Views to make it more “scalable”. The thing is that you need to be disciplined on avoiding the usage of SORT, GROUP, any FUNCTION, etc. In the JS side. The views should do that, another tip is to avoid using * in your views. Always list the columns in the SQL for the view, this will allow you to change the SCHEMA a lot easier. Also, keep the code for those views in your source control. Obviously, not for high scale but great for prototyping and MVPs. Then later move to Data Access Layer pattern and an API model. Great thing is that when you start using Views this way, you start to see that they are a great way to abstract your SCHEMA from the app and they bring a ton of flexibility without adding more layers of services.
@codechapin
@codechapin 18 дней назад
I have to say I’m not big fan of React, it has some usages but for most cases HTMX, Go/Kotlin/Gleam and strong usage of Views are perfect for a lot of web apps that I need to build and maintain.
@VincentFulco
@VincentFulco 15 дней назад
Some folks are claiming too many server actions can block the UI. Is this why we useOptimistic liberally?
@doofer149
@doofer149 18 дней назад
It is not "sanitized" it is passed as a parameter to the postgresql statement
@t3dotgg
@t3dotgg 18 дней назад
Do you think the value gets passed in without being sanitized?
@doofer149
@doofer149 18 дней назад
@t3dotgg it is not changed in any way,it is not sanitized, it it just passed as a parameter. But it is safe to use, sql injection is prevented by using parameters for sql queries.
@blenderpanzi
@blenderpanzi 18 дней назад
Back in the day sanitation meant rejecting strings that contain quotes or backslashes, or stripping those characters. Some even spit more backslashes into the string when accepting HTTP parameters assuming that makes it safe to use, assuming that is how it is done in the used DB, whatever that DB is. These days you don't do any of that. You either generate a proper string literal when the query is generated, or even better if the DB interface allows it, you pass the SQL string with ? for where the parameters go and pass the parameters in a separate array (however that all gets serialized) and let the DB's SQL parser handle the ?s. I assume that this is what is happening in the background here. It's not what was classically understood as sanitizing SQL strings. Maybe the meaning changed nowadays.
@dahahaka
@dahahaka 18 дней назад
@@doofer149 sql`` is a function which sanitizes any parameters passed into it
@juliansoto2651
@juliansoto2651 18 дней назад
​@@blenderpanzi It doesn't need to be sanitized. Postgres, at least, prevents SQL injection by parameterization. That is exactly what this template JavaScript module does. I genuinely think this "use server" thing is awful, but it has nothing to do with SQL template literals. In my opinion these are better than most ORMs.
@kr30000
@kr30000 18 дней назад
I would recommend everyone to never write sql in react. I have seen the same in PHP and other frameworks. It's not the way. Having a 3000 line component in 5 different languages is not the way.
@JeremyAndersonBoise
@JeremyAndersonBoise 18 дней назад
Is that what you see here? 5 languages and 3k LOC? No.
@yojou3695
@yojou3695 18 дней назад
​@@JeremyAndersonBoisebecause this is a trivial example, but we all know that's what ends up happening
@jitx2797
@jitx2797 18 дней назад
Then what's the way?? Also 3000 line components is really bad. Sign of a horrible code. Basically what I do in server component is fetch the data and pass along to other component. That component can be client or server depending on use case. You can always split the component into multiple files. Even if multiple components wants the data just pull out the data call into separate file and use cache functiion, the cache function ensures that it is run only once.
@kr30000
@kr30000 18 дней назад
@@jitx2797 Yea I think we completely agree. There needs to be some basic separation. I was just saying in the previous comment that I have seen what having no separation leads to. I have literally seen files in PHP where it starts with html, then some PHP functions, then some SQL, then CSS, then back to html, then javascript functions, etc. And it's sprinkled like that in no order in the entire file switching between 5 languages.
@christoffer1125
@christoffer1125 14 дней назад
I feel like this would only be maintainable for smaller projects.
@kabukitheater9046
@kabukitheater9046 18 дней назад
can't wait for react to backpedal and say that this was their most horrible idea ever.
@mohitkumar-jv2bx
@mohitkumar-jv2bx 18 дней назад
Couldn't agree more. Wasn't some time while back someone exposed the "secrets" in nextjs because of this "use-server" shit ?? I think theo covered it too.
@rampandey191
@rampandey191 18 дней назад
I don't agree. The future lies in server + client combo. The components that do not require client interactivity will be rendered on server and the rest on client. Super slick combo
@gabrielbianchi2246
@gabrielbianchi2246 18 дней назад
@@rampandey191your comment is a bit ambiguous.
@nou4605
@nou4605 18 дней назад
​@@rampandey191What future lmao. You soydevs are funny trying to spin decade old paradigms as something new that JS is doing.
@rampandey191
@rampandey191 18 дней назад
@@nou4605 The old paradigms of the past only had server side rendering and not client side rendering. For client side rendering they had to use jquery which is a different ecosystem with its own set of problems. While in react everything is react no need to leave the ecosystem. This is very different from the past. Please understand things rather than copy pasting things from twitter.
@super_b3aver
@super_b3aver 18 дней назад
i gave this a chance. i watched the entire video. i agree it's cool that a framework _can_ do this. i still don't see why _should_ anyone do this. this just seems like it would teach wrong mental models to beginners. tho i have to admit that i do love the irony of the framework being unopinionated about how a dev should separate _some_ concerns (because it's uber flexible and that makes it aWeSoMe!1!111!), but goes on to force a crap ton of other opinions on their users. maybe i'm just an old man that should get out of web dev...
@vitorwindberg4212
@vitorwindberg4212 18 дней назад
yeah it's complicated for beginners I agree, but the technology is very cool once you understand it and you can save yourself a bunch of time and build stuff writing a lot less code and boilerplate while maintaining separation of concerns and security
@anon5597
@anon5597 18 дней назад
You knew this would be triggering 🤣
@tbfromsd
@tbfromsd 17 дней назад
All those boundaries are arbitrary, "said every JS/TS library ever ".
@siphamandlambokazi331
@siphamandlambokazi331 18 дней назад
Broe I woud do this in my side project, get the job done quicker and learner.
@ashnur
@ashnur 18 дней назад
how can i simultaneously agree and disagree this much...
@drazzo777cod7
@drazzo777cod7 17 дней назад
We r getting SQL injection with this one 🔥🔥🔥🔥
@DarkzarichV2
@DarkzarichV2 17 дней назад
That autocomplete is it Copilot?
@tefkah
@tefkah 17 дней назад
supermaven
@DarkzarichV2
@DarkzarichV2 16 дней назад
@@tefkah awesome, thank you :)
@pacifico4999
@pacifico4999 18 дней назад
Instead of Use Server, it should be Use Endpoint, since that's what it is. Or maybe Use Controller, because that's what it is effectively
@GearIntellixTV
@GearIntellixTV 18 дней назад
I am not sure it's has been handled by react team or not during design server action, here is the scenario: let say a server action in button on click, it's already in production for a week and then we update the implementation by adding something or refactor the button then deploy it. What happens to users that still use old version clicking the button with server action? It's used old logic or new logic or not found because the hash is changed..
@t3dotgg
@t3dotgg 18 дней назад
Skew protection is pretty cool :)
@jasonrooney1368
@jasonrooney1368 18 дней назад
It’s not security that’s the problem. It’s that you’re coupling all the way through your application layers, basically guaranteeing that your dev speed will crawl to a standstill in a years time when your architecture crumbles beneath the weight of change requests.
@joaocoelho2929
@joaocoelho2929 18 дней назад
I feel like he addresses in multiple parts of the video. He lays out how you can separate concerns
@rajikkali2381
@rajikkali2381 16 дней назад
Either edit it in one place, or edit 5 files like we do currently. Not sure why you think this is more work than now when underlying architecture changes. Seems more DRY to me
@zapphoddbubbahbrox5681
@zapphoddbubbahbrox5681 18 дней назад
yout state two things that are not congruent... that the string text is separated and is therefore sanitized and it is trivial to write into the function the methods to sanitize. So, out of the box, is it sanitized or just Schrodinger's cat waiting for you to notice that it isn't?
@flufster777
@flufster777 18 дней назад
My only issue is the hand-waving around auth. I haven't seen any examples of how to lock down (require auth) on the server (and would this boilerplate be needed in *every* function?), nor any mechanisms for including, e.g., authorization headers from the client.
@DavidChalifoux
@DavidChalifoux 18 дней назад
No. There are middleware and layouts you can run your auth checks in. To be extra safe, you can as double check with within the actions.
@l10nbit
@l10nbit 18 дней назад
Authentication is usually done at the route level (there is frequently a shared file that represents the "root" of a route and set of subroutes. And usually in a server action. Authorization is usually handled in every server action running server code, sprinkled througout by typically a function like checkPermission("note", "rw");
@flufster777
@flufster777 13 дней назад
Thanks, I found an example with a middleware.ts file that looks like it would intercept requests on the server-intake side, but I'm still missing the mechanism for how the client calling the use-server function is augmented to pass the authorization token.
@DavidChalifoux
@DavidChalifoux 13 дней назад
@@flufster777 it’s better to store the token using cookies because that can easily be read by server actions.
@DavidChalifoux
@DavidChalifoux 13 дней назад
@@flufster777 there is definitely a bit of hand-wavy black magic that happens under the hood which I think is tripping you up
@overwatch_is_hard9654
@overwatch_is_hard9654 18 дней назад
Watching Theo reinvent basic concepts in this frankenstein's monster-esque trainwreck of a system (server components) has truly cursed my eyes. The moment I could feel the last of my sanity drain from my brain was at 12:43 where he reinvents the concept of a basic service class used in almost every good backend framework that has dependency injection on the planet. Just dont do this man, it sure seems neat, and nice, - so cozy to wrap up all the code backend and frontend in '1 framework' but when you put the cards down for any project requiring maintenance, bugfixes, support, etc - this approach will only lead to a bloated, convoluted, spaghetti bolognaise of a codebase - as soon as the application needs to handle even the barest minimums of complexity - as most applications of any real use have to. I guess if you want a highly opinionated approach, where the opinion is objectively wrong for 95% of use cases, go with this approach. Oh and i hope your pentesters are good - in a more complex codebase you're practically guaranteed to have at least one critical security issue caused by developer error - in the same way you'd have a car crash by driver error if the road was made out of ice, coated in oil, and covered in a thick layer of fog that prevents vision more than 2m in front of you.
@dahahaka
@dahahaka 18 дней назад
Maybe you should actually step back a bit and try to understand what this does because i don't think you do 😅 and i say that as someone who themselves doesn't really like using js on the backend
@perc-ai
@perc-ai 18 дней назад
Theo is a react Andy these nerds literally don’t know what their missing on with rails & Hotwire or laravel or phoenix liveview …
@vitorwindberg4212
@vitorwindberg4212 18 дней назад
why do you think his data layer pattern is that bad compared to a more standard backend? honest question
@thewiirocks
@thewiirocks 16 дней назад
Separation of concerns people are right in this case and definitely should NOT "shut up". The problem is the so-called "modern" stack. It's a broken bunch of components that won the popularity contests rather than being selected for architectural advantage. And thus the "modern" stack circles the drain looking for solutions to the very problems this popularity contest has caused.
@bennetb01
@bennetb01 18 дней назад
Everyday we are reaching closer and closer to PHP
@vmiguel1988
@vmiguel1988 18 дней назад
The pattern is nice but using a SQL Query as example is why front end devs should not write backend code ;)
@serveshchaturvedi2034
@serveshchaturvedi2034 18 дней назад
If you watch carefully, Sebastien's article already mentions that this pattern is best for learning and prototyping only and http api and data access layer is the way if you want to follow otherwise
@tomaslachmann171
@tomaslachmann171 18 дней назад
For small projects this is totally fine, however for reusing/scaling/3rd integrations it can't be used. Also this next js hype is just keeping junior devs being junior devs.
@tleytek
@tleytek 16 дней назад
This is just going to hurt newer developers who will in future be told to learn this first.
@Xetrill
@Xetrill 18 дней назад
Am I not getting it? Because this looks completely ridiculous to me. Why would you want to so something like this? Why?! Whether it is secure or not comes after. _Modern_ web development is just broken. Do any modern web devs actually know what their code does? In any meaningful way? Does anybody even know even a single spec? I believe the answer is _no_.
@vitorwindberg4212
@vitorwindberg4212 18 дней назад
yes you are not getting it. the idea is that you don't need a bunch of files and a separated BE, you can have the same functionality of a full stack application with a lot less boilerplate and code writing - while maintaining separation of concerns and security
@Interpause
@Interpause 5 дней назад
i hate server components. if you really needed that slight speed up in load time at the cost of server CPU load, go use jinja instead. i dont imagine the JS bundle required for client components was ever large enough to be an issue. isnt the main load time images that arent properly lazy loaded?
@ikirachen
@ikirachen 16 дней назад
thanks Theo you convince me in twitch, but i have to admit and here that i have been wrong :)
@pacificape2469
@pacificape2469 15 дней назад
I don’t get why people freak out a lot, they added an option, If you wanna use it, go ahead, no one’s forcing you to fuckin rewrite your codebase again just to use this, if you already have an API, then why are y’all getting so mad, not everyone is making the next Facebook, and if you’re doing it you may already know that certain patterns are just unmanteinable, and the other way around too, if you’re doing a simple ass project you don’t need to fucking add a lot of services and clean code, if straight SQL “in your fronted” makes your business run, do it and don’t bitch about by others tendencies.
@jonathinmwoann
@jonathinmwoann 17 дней назад
Really interesting video!
@FujiLivz
@FujiLivz 17 дней назад
This video absolutely made me want to try next. This video will change more lives than you probably realize, whether intentional or not, you touch a LOT of points that are incredibly useful - specifically with regards to the great showcase of data model patterns / how you've done some implements of those, etc. Just awesome. My fav theo video ever ^^.
Далее
I Parsed 1 Billion Rows Of Text (It Sucked)
39:23
Просмотров 68 тыс.
Я нашел кто меня пранкует!
00:51
Просмотров 468 тыс.
How the hell is this done#joker #shorts
00:14
Просмотров 2,2 млн
How React Query Won
34:52
Просмотров 65 тыс.
Fetching Data Doesn't Get Better Than This
6:58
Просмотров 84 тыс.
Revisiting Server-Driven UI
56:17
Просмотров 4,7 тыс.
If this ships, it will change javascript forever
25:54
Просмотров 192 тыс.
I Drank A $335 (£265) Espresso. How Did It Taste?
9:28
From React To HTMX
40:01
Просмотров 305 тыс.
The Horrors Of Patching Globals
54:04
Просмотров 32 тыс.
DHH discusses SQLite (and Stoicism)
54:00
Просмотров 52 тыс.
Why I Use C | Prime Reacts
13:00
Просмотров 133 тыс.
Falling In Love With Gleam
33:26
Просмотров 191 тыс.
Развод с OZON - ноутбук за 2875₽
17:48