Тёмный

You don't need a frontend framework 

Andrew Schmelyun
Подписаться 34 тыс.
Просмотров 102 тыс.
50% 1

Sometimes I feel that web development has gotten pretty complicated. Fairly straightforward applications are split apart with their frontends powered by behemoth frameworks like React, Next, or Nuxt. But, it doesn't have to be that way.
In this video, I show how a basic backend framework (in this case, Laravel) with its templating language, can have full-stack applications built around the engine of hypermedia, the actual HTML in a browser.
It's a strange way of looking at development, but has the potential to remove a lot of headaches, letting the modern standards present in HTML handle the workload, being enhanced at times with a sprinkling of vanilla JavaScript.
The result is an accessible frontend that's fast and scalable, with your data and state built-in. What do you think?
Some helpful links:
htmx.org
alpine-ajax.js.org
unpoly.com
- 0:00 Intro
- 0:55 An HTML-First Approach
- 2:04 Refactoring Out The Frontend
- 3:52 Seamless New Data
- 6:40 Introducing HTMX
- 11:05 Multi-Step Form with HTMX
- 15:02 Wrapping Up
Send me new video ideas and vote on what's coming next: suggest.gg/aschmelyun
Follow me on Twitter! / aschmelyun
Join my newsletter, where I send out new information about twice a month in the PHP, JavaScript, and Docker realms: aschmelyun.substack.com

Наука

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

 

15 июн 2024

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 611   
@aschmelyun
@aschmelyun 28 дней назад
If anyone wants to check out the source code, it's here: github.com/aschmelyun/no-frontend-framework-experiment Also, let me know if you'd like to see a longer video where I'll actually build a full-stack practical application with Laravel + HTMX!
@meirbek241
@meirbek241 28 дней назад
Hi Andrew, it would be very interesting to see this combination from you as there is no longer video on YT about Laravel + HTMX
@BackUp-cz6zn
@BackUp-cz6zn 28 дней назад
i would love to see that.
@user-yq5tw7iv2x
@user-yq5tw7iv2x 27 дней назад
Yes please elaborate on more complex pagination with numbers instead of only prev and next buttons
@annaluiseblume
@annaluiseblume 25 дней назад
Yes, please!
@bicho44
@bicho44 23 дня назад
Please do the laravel + HTMX tutorial
@dukeofnorfolk1842
@dukeofnorfolk1842 Месяц назад
Javascript devs on their way to install 2.61 gigabytes of dependencies for todo app
@eraysona
@eraysona 28 дней назад
it makes even more funnier that you write gigabyte instead of gb
@AnimeZone247
@AnimeZone247 28 дней назад
@@eraysonatbh I don’t think they know the difference between GB and gigabyte 😭
@eyriusbacterius
@eyriusbacterius 28 дней назад
@@AnimeZone247where is the difference ?
@AnimeZone247
@AnimeZone247 28 дней назад
@@eyriusbacterius one is an acronym, the other isn’t
@j.r.r.tolkien8724
@j.r.r.tolkien8724 28 дней назад
Why is that a problem. If it's just a simple todo app then I don't think it's for production anyway so it wouldn't matter what they use. But if it's a big application then they definitely need to keep performance in mind and that's why frameworks are evolving. Vanilla js and big teams aren't a great combination.
@MTLSTCCLTH
@MTLSTCCLTH 28 дней назад
This is great. Is there a React wrapper for this?
@lambmaster
@lambmaster 25 дней назад
Yes, NextJS
@SylvainPOLLETVILLARD
@SylvainPOLLETVILLARD 28 дней назад
In the end, it always depends on the app, but the main reason i'm defending client-side rendering is offline capabilities. We shouldn't take internet connectivity for granted, and we can make web apps more resilient to network issues, allow users to continue browsing and interacting with the app after they lose connection for one reason or another. You indeed end up with a more complicated stack, but also reduce the computing power needed server-side, make it easier to implement an effective caching strategy, and the API layer you create for your app in the process could end up being reused by another project: a mobile app, a business intelligence tool, a new front-end for special customers... It happened too many times in my carreer to not talk about it. Be careful about what you claim you don't need, because you might regret it a few years later.
@GriboedovAnton
@GriboedovAnton 19 дней назад
only 39 likes wtf?
@carbogninalbertp
@carbogninalbertp 18 дней назад
It is also so simple with SPA and capacitorjs build android and ios app in no time
@franciscos.2301
@franciscos.2301 16 дней назад
Exactly. HTML templating is a great way to couple your frontend and backend and make your project a horror to scale.
@realdaly
@realdaly 13 дней назад
he literally says "if you're project lives only in the browser".
@Gameplayer55055
@Gameplayer55055 12 дней назад
Some webpages really shouldn't be SPAs. For example SQL query results. Or the news website. Or cinema booking tickets website.
@paulholsters7932
@paulholsters7932 28 дней назад
It’s not about a framework but about a UI library that saves time.
@peterszarvas94
@peterszarvas94 26 дней назад
make your own ui library i guess
@paulholsters7932
@paulholsters7932 26 дней назад
@@peterszarvas94 and when would that be useful?
@ivymuncher
@ivymuncher 25 дней назад
@@paulholsters7932for fun :^)
@maxivannikov4904
@maxivannikov4904 25 дней назад
I think that it's not about framework or ui library, but about reusability. If you do your todo app, surely there is no need to setup a frontend server. But if you write a real project it's better to serialize your data in a convenient format so any other service could use in their ways in the future. Idk what the author was talking about.
@diambarabas2624
@diambarabas2624 25 дней назад
Idunno. But then, using ui library, your app looks generic, like thousands of other apps using same ui framework, and winning over audiance is done by standing out. From my limited experience, even when using a minimal framework, as soon as you want to do some custom own twist, you get into a world of pain trying to struggle against that very same framework to even lets say, change the look of your buttons. You get locked in so to speak.
@blcksgnota
@blcksgnota Месяц назад
HTMX mention 🚀
@JosueRodriguez08
@JosueRodriguez08 18 дней назад
I came here just to comment that, lolololol
@razvanfilea8076
@razvanfilea8076 28 дней назад
Halfway through watching the video: You've just reinvented HTMX
@BrianTakita
@BrianTakita 28 дней назад
What's wrong with that? If it can be done with less library overhead...
@boyo_23
@boyo_23 28 дней назад
​@@BrianTakita he never said he was wrong tho?
@aschmelyun
@aschmelyun 28 дней назад
I mean, HTMX is just a wrapper for working with server-side responses through html attributes, so... yeah, I guess I did!
@notandyvee
@notandyvee 28 дней назад
You're comment screams to me why JavaScript is the way it is. "Why reinvent the wheel only to do the things I actually need when I can install a while library to do it all" 😂
@OkarinHououinKyouma
@OkarinHououinKyouma 26 дней назад
Halfway through the video, I knew that it was a buildup to introduce HTMX.
@_skyyskater
@_skyyskater 12 дней назад
As someone who did a ton of this before all of the frontend frameworks came out, I can say your estimation of 90% is overstated. Sure, there are cases where backend-rendered templates is the best solution, but for complex web apps, it is not. There is a reason why so many frontend frameworks exist and are so popular. You don't want to go back to the old days of manipulating DOM elements by hand all the time for basic things, nor can you re-render the entire dom for every change. That's where modern frontend frameworks come into play -- they manage the DOM for you. All you have to do is provide a declarative definition for the view and the state. Very similar to how PostgeSQL, MySQL, etc. work.
@markopoutiainen7108
@markopoutiainen7108 6 дней назад
For web dev I'm just a hobbyist (even though I do software for a living). I made the first version of my hobby project with pure Flask but at a certain point it just didn't cut it any more. It was too hard to improve usability or add interactivity. I was also left wondering how do you do user authentication with pure html? Where do you store the credentials? In a cookie? Doing that stuff by hand is just a pain.
@_skyyskater
@_skyyskater 4 дня назад
@@markopoutiainen7108 There are ways to do user authentication with pure HTML but it’s not great. You can of course use “modern” features such as XMLHttpRequest and Bearer Auth Tokens with LocalStorage without a framework, and I do. Again that’s not the part I want to outsource, mostly just DOM state changes. Anyway I can turn highly procedural, mutative code into declarative code I will.
@sudsy3
@sudsy3 21 час назад
yes, a secure cookie is generally the best place to store credentials regardless of js implementation
@edhahaz
@edhahaz 29 дней назад
The simplicity of moving all complexity to the backend
@h0ph1p13
@h0ph1p13 29 дней назад
It's awesome!
@CristianKirk
@CristianKirk 28 дней назад
You don't move complexity to the backend, you avoid it completely.
@SverreJohannBjrke
@SverreJohannBjrke 28 дней назад
Yes, instead of duplicating it on both the front and backend. And most backend frameworks and languages handles complexity better than JS imo.
@MrSofazocker
@MrSofazocker 28 дней назад
Well, you do end-up replicating almost all backend on the frontend otherwise... so writing it once, instead of again in another language is more simple.
@karter_devolidad
@karter_devolidad 28 дней назад
​@@CristianKirkkinda. You still have to now manage all the frontend in the backend...
@nonlinearsound-001
@nonlinearsound-001 29 дней назад
And with the upcoming view transitions as a native feature in browsers, we will have nice animations between views without a lot of code.
@aschmelyun
@aschmelyun 29 дней назад
Yes! I'm so excited about view transitions. Been seeing a lot of devs showcasing their experiments with them lately, and it's pure magic.
@Garkolym
@Garkolym 27 дней назад
Yes, and we need to wait 8 years, until all browsers support it
@aschmelyun
@aschmelyun 26 дней назад
@@Garkolym Safari's become the new IE :(
@Rudxain
@Rudxain 26 дней назад
@@aschmelyun Definitely. I hate Apple, but we gotta "give credit where credit is due": Safari was the *1st and only* browser to implement tail-call-optimization for JS. I'm still salty that Chromium didn't implement it despite being part of the ECMAscript spec
@Gameplayer55055
@Gameplayer55055 12 дней назад
​@@RudxainGoogle, Mozilla and Apple should really unite and make cool features together. Many features are available only in one browser
@MarkVrankovich
@MarkVrankovich 27 дней назад
My philosophy has always been to do everything on the server, delivering only rendered html. That is, unless you can prove a certain page needs a lot of frontend rendering, in which case you'd be amazed at how much you can get done with plain Javascript. Keep it as simple as you can, and only move up the complexity ladder if you prove you have a need.
@vlc-cosplayer
@vlc-cosplayer 25 дней назад
React says "global state bad, local state good", and enforces this by making sure that child elements can only access the information that was passed down to them by their immediate parent element. Which means that you'll need to wrap your elements in a bunch of context providers, unless you want to do prop drilling... And eventually you'll think "isn't there a better way?", and learn about Redux, try to read the docs, and not understand a thing besides a reducer being a function that takes a state, an object that defines how to change it, and returns a new state. Then you'll start wondering if you really need React, if handling global state is really that simple...
@pierrotlasticot5848
@pierrotlasticot5848 19 дней назад
KISS
@vlc-cosplayer
@vlc-cosplayer 18 дней назад
@@pierrotlasticot5848 always KISS your homies (good software design practices say so)
@krtirtho
@krtirtho 28 дней назад
Denial, Agreeing, Repent, Hope, Extreme hatred My emotions throughout the video:
@tanmaysingewar
@tanmaysingewar 28 дней назад
Seriously this is the thing. We really need to think about the frontend from the other side of the framework.
@ivagov5758
@ivagov5758 28 дней назад
If the back and front exchange data using something universal, say JSON, the back becomes client-agnostic, it doesn’t matter which client it exchanges data with. We can use such a backend for both web pages and mobile applications, and even to create chat bots. For all this we will have ONE backend. If we strictly tie the backend specifically to HTML and the web, then we will have to create our own backend for each potential client. It was not for nothing that we abandoned this approach.
@saintpumpkin
@saintpumpkin 26 дней назад
...and never had the opportunity to change backend, but hey, it's possible
@jan.tichavsky
@jan.tichavsky 25 дней назад
Mobile app can show HTML as well as desktop or TV which is the whole point of HTML. You have a universal rendering app, the browser, and keep consistent experience across platforms without needing recompiling for different devices.
@maxivannikov4904
@maxivannikov4904 25 дней назад
@@jan.tichavsky coupling backend and frontend code in one repo? Very convenient, Id love to see how frontenders would love it and how you gonna expose your api to third party apps with that, write microservices.
@straphyr
@straphyr 25 дней назад
​@@jan.tichavsky Are you implying every app should be a website or that every app should utilize WebView? Because there's so many reasons to not do either of those things in so many cases
@joaoguilhermezati6327
@joaoguilhermezati6327 24 дня назад
In my projects I create a api backend and render it with jinj2 on flask using the apis, so I get the simplicity of render html direct from back and have one backend with endpoints for all apps
@neociber24
@neociber24 Месяц назад
I always say: If you are not using a framework you are just creating your own. For most simple cases is just simple JS, but when you start creating abstractions over that logic it's just other framework at least more slim than just importing React or Vue.
@aschmelyun
@aschmelyun 29 дней назад
Agreed 100%. Once you start putting these "abstractions" all over the place, just reach for a framework (or at least a library like Alpine!)
@lollol012
@lollol012 28 дней назад
I'm both using a framework, AND did, in fact, create it (although it does use a few dozen libraries, on both front and back, and the front ones include Vue, which itself is a framework).
@MrSofazocker
@MrSofazocker 28 дней назад
well... yes. but that's bcs none of the mainstream libraries do it the way you like. Otherwise, you would use an existing one, won't you? :P The thing we want to optimize is how much code is being executed on the client. Cause.. the browser literally does most of everything already. All these js frameworks as backends... gosh it's like flushing 30+ years of development down the drain, bcs sm1 discovered he can run the javascript vm outside the browser.
@devOnHoliday
@devOnHoliday 28 дней назад
I've used jQuery ajax for years. For smaller applications like a CMS or just a frontend application loading content I've developed a slim formula to use just one ajax function to load all the backend generated html content for all the pages. I've even used ajax to pull one html content and then break it using class names and plugging it in different places in the page. To me it couldn't get easier than that. Using htmx or alpine does the exact same thing. We don't need to over engineer simple tasks
@pokefreak2112
@pokefreak2112 24 дня назад
The benefit of creating you own framework is that you can cater it to your own needs. A lot of problems are most elegantly solved by just adding new features to the framework, and that's something you can't really do with third party solutions without a hard fork or huge maintenance cost
@abdulmlaikalomayri727
@abdulmlaikalomayri727 29 дней назад
I find this really interesting, sometime we should stop diving into technology just because it's trending or has a fancy name and start asking what the problem that we are trying to solve in a simple way, without needed to add another complixty layer which make the project overwhelmed.
@teabookcodes
@teabookcodes 29 дней назад
Very nice video, definitely gonna give HTMX a try after this! 💯 I usually work with React/Next.js, sometimes with Java backend, and used Laravel/Blade and vanilla JS with Alpine in the past for a smaller personal project, but as I didn't structure the components and JS code properly, it quickly became a mess. This approach looks very clear and minimalistic to me, but also quite powerful!
@galower405
@galower405 28 дней назад
It is true that this can be accomplished with the backend just serving plain HTML, which is far more performant than using JavaScript to parse JSON and then render it. However, let's not forget the reason we use APIs: to provide an accessible entry point to the data for other clients, not just your frontend client. These clients could be a mobile app or an external library. Making REST JSON APIs allows us to have this architecture which is already accessible from any client not only the browser.
@galower405
@galower405 28 дней назад
That said this video really does a good job at pointing out how powerful a server can be
@MrSofazocker
@MrSofazocker 28 дней назад
Saying REST and json in the same sentence makes me curl up and wanna die. REST and SOAP was ought to be a standard way to communicate for WebServices, a "special" sort of API by convention that provides a common interface and restricts the return type and uses HTTP as protocol and returns XML. (normally) Like... you have a backend.. that's fine and dandy, and it has an API for other apps to communicate with it.. that's not going away. Buut, what everyone started doing was, "Well since we have an api, why don't we just call that to get the data the frontend needs, and let the frontend render it... oh and while we are writing the client-side in javascript, and make requests validation there, why don't we write the whole backend in javascript as well to share code?" And shit sandwich was made. What you ought to do is, if you want to serve to web, is make a WebService. That response to HTTP requests and spits out HTML to whoever requested it, utilizing the API of your backend. (restricting your backend to REST is also limiting, there are better ways to access and communicate with a backend, like RPCs) Why, and where you need state, or the frontend to handle anything is beyond me. You still have your frontend, you still have all your animations, view-transitions in javascript, client-side....
@galower405
@galower405 28 дней назад
​@@MrSofazocker, you have some really fair points, and yeah, Protocol Buffers are pretty dope. But to be fair, you always end up reinventing the wheel because sooner or later, you end up needing client state to handle different interactions. Not only to display data but, for example, if the user clicks or interacts with (x) button, it needs to show (y) information after (z) time. And while HTMX could handle it to an extent, you might as well have reusable components to deal with it.
@galower405
@galower405 28 дней назад
@@MrSofazocker Also why do double the work when the API clearly fits the needs and the user barelly notices the drawbacks?
@aschmelyun
@aschmelyun 28 дней назад
Exactly, the point I was trying to make is that there's a whole group of applications which never connect to other clients (mobile apps, libraries, etc). The data flows just from server to frontend, so it makes less sense to build out a full-fledged JSON API for those particular ones.
@christopheanfry2425
@christopheanfry2425 14 дней назад
Thank you so much for these explanations. The multi step form is gold 🙏
@crugg
@crugg 28 дней назад
Some of the upsides of frontend frameworks is how fluent the page switches feel + the ability to maintain state (and especially elements, such as audio players) across page switches. But returning HTML is great too for a variety of reasons. But this is why I love SvelteKit. For each route, you have the HTML markup, and the server-side code. The initial request is traditionally rendered server-side, and further page switches are rendered client-side. Also comes with things like pre-fetching on link hover which you don't have without frontend frameworks.
@ivanh1821
@ivanh1821 27 дней назад
Nice ad
@crugg
@crugg 27 дней назад
@@ivanh1821 Ad?
@peterszarvas94
@peterszarvas94 26 дней назад
you can code any of that behaviour by yourself
@crugg
@crugg 26 дней назад
@@peterszarvas94 But why would I when I can use that time actually work on things people haven’t done before. There’s no point in hundreds of people coding the same thing that’s already been done before
@peterszarvas94
@peterszarvas94 26 дней назад
@@crugg idk, maybe sveltkit is not so bloated like react, but some of us just hate using js. you dont need a framework, you can choose to use it, but you are fine without one
@pabloripoll
@pabloripoll Месяц назад
Thanks Andrew! I'm completed agree with you. Using any JS framework instead of a simplified HTMLX/JS native script costs some hours for a senior developer to build an app but thousands of dollars for companies to maintain - that the foundation of the almighty JS frameworks myth.
@BizuDesign
@BizuDesign 26 дней назад
I am currently working on a project for the software engineering course I'm taking. I am using Django for the backend (first time) and can only use vanilla JS for the front. The project needs to be a SPA, and my solution to handle this was very similar to what you presented at the beginning of the video. I had only worked with React once in the past, and I found the vanilla JS solution much more elegant for the simplicity of what I am doing. =)
@saabirmohamed636
@saabirmohamed636 29 дней назад
I agree ...we need "dumb termials" (as the browser) or treat them as such we going back to it ...they worked well like the student kiosk stations at the university back in the no internet days ...
@rrraewr
@rrraewr 29 дней назад
I mean, for an online crud app sure, but the main focus of frontend frameworks to me, which backend people kinda miss, is more like offline capabilities, stylistic changes with animations and transitions, generating stats and charts with client side data you can edit, mix and match. You can't serverside an offline pwa. There's a lot of use cases for client side js. There's more to frontend than sending a material themed hello world todo app.
@dave-7117
@dave-7117 28 дней назад
This. It Just depends on the projects needs. Roasting all JS Frameworks ist literally just another trend all the tech influencers are hopping on...
@__kvik
@__kvik 28 дней назад
Sure, but the point is that not many webapps productively use or even /need/ the features that you mention and actually are just CRUD style apps. Nobody (in their right mind) is claiming that you can or should go write Google Maps or Excel using just the hypermedia approach. Rather, people have grown absolutely sick of being fed the idea that you /need/ an extremely complex fronted / backend approach to write /any/ sort of "modern" web application. The best thing is, you are free to mix and match, combine different approaches for different parts of the application where needed.
@MrSofazocker
@MrSofazocker 28 дней назад
YES! couldn't agree more, use javascript for animations etc, you know.. for scripting the browser!? Not for plumming data, agregates, computations and building the entire UI client-side... like bro common.. And PWAs? you can do that easily with a RESTful Webservice or some websockets... there's your "native" feeling webapp for you... Regarding offline anything in the browser.... why? just why? If you need your app to be offline... why did you build a webapp instead of u know.. an app?
@aschmelyun
@aschmelyun 28 дней назад
Oh I couldn't agree more, which is something that I specifically mentioned in the video. What I said applies _only_ if the application you're building is fairly straightforward in its features and it doesn't require that an external API be available to other clients. Frontend frameworks are invaluable and I use Vue and React on an almost daily basis for a variety of other projects. I just worry that a lot of hype (especially with meta-frameworks like Next or Nuxt) can have people over-engineering projects that could be a lot simpler.
@gogudelagaze1585
@gogudelagaze1585 26 дней назад
@@MrSofazocker One app that runs on Android, iOS, MacOS, Windows, Linux, and also offers the same experience as a user can get on the web page. Or you can just idk, make the web page vOv
@saminyead1233
@saminyead1233 26 дней назад
Edit: Darn, I called it in the very beginning! The form submit you mentioned around the 2:15 minutes mark - is made more convenient by HTMX, where you don't even have to make the drop-down forms. Any element can send an HTTP request to the backend and you can get valid HTML, and you can use that to replace the table below according to the parameters.
@BackUp-cz6zn
@BackUp-cz6zn 28 дней назад
i don't know how to feel about this. on the one hand this feels a lot simpler than dealing with all the state management of the front-end, but on the other i still need things like conditional rendering and good templating ( with support for slots and complex props). i think i need to build a couple of apps before settling on how i feel about this.
@grenadier4702
@grenadier4702 23 дня назад
true
@starblaiz1986
@starblaiz1986 25 дней назад
Use what you need to get the job done, but nothing more. That's always been my guiding pricipal in development, so I completely agree with what you are saying here.
@j.j.oliphant9794
@j.j.oliphant9794 14 дней назад
This is the only way I’ve ever made a Web app and I’ve always felt like a half rate dev for doing it this way so it’s nice to have someone advocating for this method
@j.j.oliphant9794
@j.j.oliphant9794 14 дней назад
I’ll admit, though that I still probably am a half rate Dev
@CrazyWinner357
@CrazyWinner357 27 дней назад
Now you fetch data from server everytime you change the filter. With react you can fetch once than filter that data without fetching. Not only this method makes backend more complex, it increases the load.
@maxim_mazurok
@maxim_mazurok 27 дней назад
Good point, but it doesn't really work with large data where you'd end up with pagination, still have to request it from the server every time with React
@Rudxain
@Rudxain 26 дней назад
doesn't HTMX solve this "request everytime" problem?
@CrazyWinner357
@CrazyWinner357 26 дней назад
@@Rudxain no htmx is the same thing with syntax sugar
@GrantGryczan
@GrantGryczan 25 дней назад
@@maxim_mazurok In general, doing everything on the backend prevents you from having frontend state that isn't rendered, and you have to make another request every time you want to change what's rendered. Sure, if your unrendered data is very large, then that way can be better. But very often it's not, and the extra loading time is an inconvenience to users.
@vhaangol4785
@vhaangol4785 17 дней назад
_"With react you can fetch once then filter the data"_ This is the main problem with modern devs lol. You make it sound as if plain old JS / or even a thin library like Alpine JS can't achieve this.
@MrAdBounty
@MrAdBounty 25 дней назад
Agree, HTML is easy. No "translation layers", that's my philosophy in development "Avoid translation, chase simplicity" I presented HTMX to my company literally last Friday and I think we will end up using it because we build the kind of app that you showed (like 90% of people)
@jotricky
@jotricky 27 дней назад
I think this method works well for a solo full stack developer. But for teams that have separate responsibilities between backend and frontend, this is not a good idea. In the end, different tech and frameworks exist for different development purpose. But maybe I'm wrong.
@zwozoa5630
@zwozoa5630 22 дня назад
Exactly.
@franciscos.2301
@franciscos.2301 16 дней назад
You're not wrong.
@joosepkunder
@joosepkunder 11 дней назад
Offtopic but.. you have insanely good and clear voice! About the topic: i totally agree and this video showed me i am not the only one who thinks that you don't need a front-end framework for every application.
@bartoszkrawczyk4976
@bartoszkrawczyk4976 28 дней назад
Shameless plug, I'm working on a form validation library for HTML-first approach, works great with HTMX too. It's called input-validity. No js, just attributes. Thin wrapper around native HTML validation. It can give you nice SPA-like form error messages and changes dynamically while user types.
@duckeggcarbonara
@duckeggcarbonara 27 дней назад
Link It
@chiguirolover77
@chiguirolover77 6 дней назад
then put the link here you madman
@duckeggcarbonara
@duckeggcarbonara 6 дней назад
Please link it dude I am dying
@bicho44
@bicho44 23 дня назад
Today i was having a similar conversation with a friend, and is a little battle of me asking, why you need to recreate HTML to spit HTML to the browser, thanks to make it and know im not alone in this crazy idea. Regards from Patagonia Argentina PS: I'm gonna have to read more about HTMX
@lolikpof
@lolikpof 13 дней назад
I'm building a SPA admin dashboard using htmx and hyperscript. Quick tip, using template fragments (not to be confused with partials, which are also useful. Actually the terminology is a mess and different languages and engines use these interchangeably, htmx has a good article about fragments) can make you html files more dry and convenient to work with. Also scss > css :p
@tbone587
@tbone587 26 дней назад
It’s amazing to me that this is basically the way we all used to it it. We always do come full circle
@aschmelyun
@aschmelyun 25 дней назад
History repeats itself and all that :D
@ooker777
@ooker777 25 дней назад
But we don't have HTMX back then? So not a circle but more like a spiral?
@nic_s3385
@nic_s3385 27 дней назад
About 5 years ago, and before I knew about HTMX, I did a rewrite of a pretty complex app and the first thing I did was ask myself what would this look like if I move it all to the server. I made a demo and it was pretty good and I was easily able to expand on this demo by just adding more stuff in the back end. The HTML ended up just being a visual representation of my state that was also server side. I had a kind of special JSON object that is used to pass data/HTML between the front end and the back end. Every action the user could take, like entering text, or every time I needed to update the UI (or just part of the UI), this JSON object would contain what is needed. Example: User click's button to show a modal. JSON object post to server with what the user wants to do. Server uses deserialized object, appends the HTML needed for the modal, and returns it back to the browser. Some vanilla JS then looks at the object and adds the new HTML to the page. The CSS for the modal is such that it shows as soon as the HTML has been added... no js needed to show it. When the modal is closed, some js will just remove the HTML from the page again... "closing" it. Now I only needed to manage state in 1 place, the server. I only needed a little bit of vanilla JS here and there. My entire back end was the application... I could run the entire app without viewing any HTML which was great for testing. I had 100% control over how everything worked... i could make anything in the app work exactly the way I wanted instead of having to play by some framework's rules or finding workarounds. When it comes to integrating with other services or exposing data from our end, that was done using a separate service with it's own security. The UI app was it's own thing... you know... separation of concerns... What I came up with was by no means perfect... it's a V1 of sorts. I've spent some time polishing things up since then, but unfortunately I never got the chance to take things further like I wanted to. I'm at a point now where I don't write any HTML by hand anymore... I define what I want and on the other end of a generator I get HTML. The html generator also ended up being incredibly simple to do. We live in a world where some things are popular because they are popular and as a result very few people stray and try and come up with something new :(
@User-null00
@User-null00 10 дней назад
I’ve been building websites for a year, everything with a React and tailwind front end. Currently building my first project with Material UI and it has saved hours of my life. I’m never going back to plain tailwind
@JuriBinturong
@JuriBinturong 28 дней назад
Front end was so limiting for me, so I had to shift to back end with Laravel to finish the entire feature, then augment whatever interactivity I need with Vue and CSS framework like Quasar.
@aschmelyun
@aschmelyun 28 дней назад
How do you like Quasar? I've been wanting to play around with one of those "frontend for mobile" frameworks like Capacitor or Quasar, but haven't yet.
@strykeregziadahmed9562
@strykeregziadahmed9562 15 дней назад
The same thought for backend Instead of downloading tons of libraries and dependencies to shortcut a http request and some databases connection we write it Specifically in small scale applications It will be great to know what is happening behind the scenes
@pinatacolada7986
@pinatacolada7986 18 дней назад
You can build apps without a front end framework - I have. But it's usually harder to build, slower to scale, harder to read, less performant, buggy and a waste of time. For a simple todo app, you can do whatever you want - but for much larger apps, it's better to use a framework. I recommend Solid js.
@username7763
@username7763 12 дней назад
You touched on the reason why it might make sense to have an API return JSON instead; if the API is to be used outside of the browser. An application I re-architected had a separate API and web app. They had different code to do the same thing and had all sorts of inconsistencies. I was able to combine it into one using a REST API. However, the funny thing is this seems to be the exception and not the norm. Most web apps are just web apps and don't need or care about a separate API.
@mengthong_dev
@mengthong_dev 24 дня назад
nice, remaind me miss time that i working with laravel. i will back to laravel again with your idea here
@was1768
@was1768 24 дня назад
Simple pages don't need front-end frameworks complex pages where you have dynamic (user created) things, editors complex styles is a pain in the ass to do without a framework. Every front-end app I worked on for example used google material which is kinda available without a framework but it's not that good. And I don't think our backend guys would have appreciated to code js and I wouldn't want to lurk around complex backend business logics for my pretty animations. So just for separating the teams and codebases it's good too. Also if you support multiple platforms js frameworks are a no-brainer. Also if you're into webdev but you don't want to learn server stuff just handling some json-s are fun. I'm grateful that I almost never have to do backend
@FirstYokai
@FirstYokai 20 дней назад
People who only know react don't understand how simpler the standard web development can be. Most don't need the extra flexibility that frontend frameworks offer. This is a fact
@homesynthesis
@homesynthesis 28 дней назад
I guess the biggest thing is if you need your backend to serve multiple different types of clients (mobile, web, smart tv(?), etc.) -- then you wont be as able to get away with just sending HTML
@FelipeV3444
@FelipeV3444 28 дней назад
He addressed that near the beginning of the video. At around 1:41 he says the app will live solely in the browser. Ofc if you need a mobile / desktop / IoT client, then that's a whole other story.
@homesynthesis
@homesynthesis 28 дней назад
@@FelipeV3444 Oh yeah good point. I definitely heard that but I guess for some reason it didn't register.
@MrSofazocker
@MrSofazocker 28 дней назад
well... lets take Discord for example. their main app is a webapp, works totally fine, their desktop app is an electron chrome browser, works totally fine, their android app? same, IOS, yep, html! So what did you say?
@MrSofazocker
@MrSofazocker 28 дней назад
@@FelipeV3444 just bundle a browser with your app lol. Electron hello? Everyone does it, and pretty much the only reason everyone's googling "how to download more RAM." :;D
@homesynthesis
@homesynthesis 28 дней назад
@@MrSofazocker their iOS and Android apps are using React Native, so no, not HTML.
@nickmurdaugh9856
@nickmurdaugh9856 6 дней назад
I still find for most things, a hybrid setup is great. I maintain that the bar for grabbing a frontend framework of some kind should be very, very low. But that doesn't mean grab the most complex, sexy thing out there. Often, it means making 90% of a site work off a template engine, and when a page would work better as an SPA, HTMX and Alpine can probably handle it just fine. My favorite thing for getting a project off the ground quickly is the ADHD stack. Alpine, Django, HTMX, and Daisy. If your project requires more complexity than that, it'll tell you.
@michaeltendo
@michaeltendo 27 дней назад
2:13 THIS, THIS, THIS is genius, GENIUS. I should say it again. This is genius.
@robertmazurowski5974
@robertmazurowski5974 28 дней назад
You are right, I agree with you 100 percent. I am actually interested what you mean by the 10 percent.... do you EVER need to use a frontend framework?
@king_james_official
@king_james_official 24 дня назад
isn't this the same as returning the jsx in nextjs?? please respond i'm curious
@RileyShannon-ez5pv
@RileyShannon-ez5pv 28 дней назад
Quick Laravel question for you. At the 11:55 mark, whenever you generate the page for each form step, you are putting a uuid into the session. Does this not overwrite and reassign a new uuid every time a step is loaded?
@aschmelyun
@aschmelyun 28 дней назад
No, because the endpoint being hit by the form pages is through a different route. It's only the initial load at the /form endpoint does that uuid session get set. This was so I could easily have an 'identifier' and attach all of the page responses to the same data in the database.
@RileyShannon-ez5pv
@RileyShannon-ez5pv 28 дней назад
@@aschmelyun Yeah, That is normally how i assign multi page forms as well. Was just confused because I thought it was re setting the uuid each time the page route ran. Thanks for the response!
@VinayKumar-vu3en
@VinayKumar-vu3en 26 дней назад
we knew where he was going just from the title with no context whatsoever. long live htmx.
@LuisM_Santana
@LuisM_Santana 29 дней назад
I so want to do this with Go or Java. Nice video!
@aschmelyun
@aschmelyun 29 дней назад
You should! Go and HTMX are a powerhouse duo I’ve been seeing a lot recently, especially for small almost microservice-like apps
@BrotWurst
@BrotWurst 7 дней назад
so we need to modify the backend code if we want to add a pure styling class for a, for example, blue themed instead of green themed dropdown etc. seems perfectly fine for a tiny project for a tiny userbase. if you want to scale, it can get horribly bad.
@davidhida6821
@davidhida6821 11 дней назад
Thanks for this video. i hope to see the combination of Laravel and Alipine-Ajax
@oglass
@oglass 28 дней назад
to be fair, svelte's ssr and actions abstractions are pretty great
@aschmelyun
@aschmelyun 28 дней назад
Oh definitely, I haven't done much in Svelte but the little I've worked with it, it's a great frontend framework. Especially for smaller, tighter applications.
@djsargex7777
@djsargex7777 13 дней назад
I think one of the main reasons of frontend is for calculations that can be rendered frontend, without the need for constant calls to server-side scripts thereby dramatically reducing load time. Easier to do with a frontend framework.
@joaquinmendozas
@joaquinmendozas 28 дней назад
my opinion is of no importance (and completely uncalled) at all, but this is the absolute best video on web development of the last five or maybe more years
@opiniotworczyblog5090
@opiniotworczyblog5090 25 дней назад
The latest version on Next.js and React has addressed this specific issue with “use server” and “use client”.
@EvGamerBETA
@EvGamerBETA 22 дня назад
I feel like that you would run into limitations while building a big application. And it's easier to reason with data, rather than pagr fragments. Also work is often split between frontend and backend, and for this you would need to be a full-stack
@nou4605
@nou4605 28 дней назад
FORM SUBMITS? What is this the year 2000? /s
@jamesgphillips91
@jamesgphillips91 25 дней назад
Server components in react/next js essentially do what you’re saying, they return the jsx.
@MinatoCreations
@MinatoCreations 25 дней назад
How does hmtx works for the part you pass the link? When changing the select value, it loads the response on the table you passed. But how does it loads the whole page when you copy-paste the link?
@aschmelyun
@aschmelyun 25 дней назад
That's the beauty, HTMX doesn't involve anything with the initial page load, that's all handled by the traditional web server. So when you reload (or copy-paste the link) it's just handled as if you were visiting the route for the first time and returns back the whole of the HTML.
@sven10101010
@sven10101010 28 дней назад
I was wondering, how secure is this? I mean if a user would edit the address line or the link in the button.. Where and how would you check for these things?
@MattiaMari
@MattiaMari 28 дней назад
Authorization must always be enforced at the backend which would refuse to serve you data you don't have access to. That applies to REST APIs as well because you cannot rely on the frontend framework to "hide" pages to the user: a little tweak in the console and that's easily bypassed.
@MrJoefinisher
@MrJoefinisher 13 дней назад
Remeber when we didnt need state containers in the front end? It was awesome.
@thebuffman5597
@thebuffman5597 8 дней назад
Counterargument here, before even watching the video: Security vulnerabilities and number of connections. Meanwhile, yes, it is entirely possible to write backend websites, it's not really recommended to do it without any frontend. The reason being that when a user does something on the front end, it makes their machine be troubled, not the server. For example let's say as an example multithreading, it's a lot worse performance wise if you make the server do everything and not the user. Saying backend is needed only is like saying "You don't need multithreading, just use async!" and meanwhile it is true that async is good, etc. multithreading is better if you really want things seperated. As for an "accurate" depiction of your statement tho, "90% of websites can be written in only backend" is partly true. Because if we get it from word to word, that includes your local dentist who will likely max see a few thousand views on their site anyway, not millions, like a microsoft or other page. After watching video: Bruh, i did that with my final project xDDD, created the frontend in php by making different queries, etc. then made the list just generated. Still could've just used ajax tho. I am curious tho, but how would you handle "visual" websites? like ones with for example vanta.js ? or something similar. let me guess, those are the last 10% lol.
@rumbazumba3189
@rumbazumba3189 26 дней назад
It vould make sense on admin dashboard apps, which are already barebones as can be, but does not make absolutely any sense to do on a landing page or anything similar.
@itandcoder
@itandcoder 20 дней назад
Sending HTML to the browser so the remote computer assembles the interface using resources in that remote computer, it is the same logic. A front end logic. Having a front end release work to the back end so is more efficient for more connections.
@rasalas91
@rasalas91 27 дней назад
0:42 because different clients might need the same data but they render them differently. But often this is web only (like you say), soo...
@noided7071
@noided7071 25 дней назад
Splitting the frontend and backend improves scalability, and it's a nice separation of concerns. Maybe it could be considered over engineering in some cases, but it's useful experience to have since it's what everyone in the industry is doing, having experience with templates won't get you anywhere. Plus, building APIs is fun :) But I mean if it's a really lightweight website I would probably just use something like Sinatra or Express and call it a day.
@aschmelyun
@aschmelyun 25 дней назад
Don't tell anyone, but I also love building frontends (Vue!) and definitely agree on the separation of concerns part :)
@TheMrblaster2012
@TheMrblaster2012 13 дней назад
When does one know a website is lightweight or not? if it weren't lightweight? What would you use or what would you change?
@username7763
@username7763 12 дней назад
How does this improve scalability? Scalability gets harder the more communicating parts there are.
@noided7071
@noided7071 12 дней назад
@@username7763 because you can scale each part independently, for example if you're experiencing a heavier load on your backend you can scale that independently. You can also split your backend into microservices and implement load balancing.
@username7763
@username7763 12 дней назад
@@noided7071 That heavy load will result in more network communication which slows down the system with scale. The more pieces you break things up into, the more network-dependent you will be. This only makes sense in very high cpu-demanding applications which is generally not the case with web apps. They are typically network-bound already. Scalability is incredibly tricky.
@dev.MuhammadAlaminIslam
@dev.MuhammadAlaminIslam 29 дней назад
Hey man, can you tell me the VS code theam name, and font name? please. I love the theme and font.
@aschmelyun
@aschmelyun 29 дней назад
Thanks! Theme is called Palenight, and the font is Comic Code
@120artyom
@120artyom 14 дней назад
For laravel, there are livewire and filament. But I don’t know when businesses will use them, instead of react or vue
@Lestibournes
@Lestibournes 25 дней назад
At work we have a web app that uses graphql to communicate with AWS using JSON, including the server pushing updates to the client. I think in this case HTMX doesn't make sense anymore.
@DaveSmithHayes
@DaveSmithHayes 24 дня назад
goated example of why rendering HTML on the server is the best option.
@user-od1mt8qr8y
@user-od1mt8qr8y 28 дней назад
as a Front-end developer I 100% agree with this!
@ridabrahim7604
@ridabrahim7604 27 дней назад
I just render the html from the backend in Django right now because i still didn't learn much about the front end lol, this looks like something i would use but let's be honest, if this is not what everyone is using we can't just go and do this except if it's a personal project, I don't want to write code that nobody understands just because it isn't the main way people connect their backend to the frontend and near coming days i will also stop rendering the html from backend
@ceopaludetto
@ceopaludetto 26 дней назад
Using web standards its so good, thats why i like remix
@GabrielRodrigues-br5qf
@GabrielRodrigues-br5qf 25 дней назад
I think you point of view is great. But as a front-end developer I'm completely drilled of making bad software. Sometimes simple solutions are ok, but you can always raise the bar and I really think we should be making better and better (event though, more complex) to improve the internet as a all.
@SomebodyYouUsedToSee
@SomebodyYouUsedToSee 11 дней назад
html with little bit of vanilla js to filter it out and we can keep it simple and have the separation of concern too .
@shamseerahammed4094
@shamseerahammed4094 7 дней назад
This is how it was done in the olden days, all good for simple UI like this but when front end requirements gets complicated it just gets messy, just think about adding a row in a table with a button to do that you have to write html of tr with tds inside like a string append dynamic values inside string and then append everything togather to dom, i just remember how complicated these things where back in the jQuery days
@baware80
@baware80 Месяц назад
BACKEND dev is king, API should be used for mobile apps.
@MrSofazocker
@MrSofazocker 28 дней назад
well... no... most mobile apps are literally browsers that show you a web-page... same applies there.
@tuna1867
@tuna1867 28 дней назад
⁠​⁠@@MrSofazockerwell… no.
@JohnSmith-yr4vi
@JohnSmith-yr4vi 26 дней назад
Backend APIs are used in pretty much all mobile apps already???
@davidvalencia6256
@davidvalencia6256 13 дней назад
I have tried with django and java web applications that use jsp, even overleaf, even thymeleaf, but the performance is very bad. It's simply too slow to reload an entire page for a simple request. Also, returning html is called high coupling, because you depend on how the information is structured instead of being able to structure it yourself. Remember that the frontend and backend are developed by different people.
@alexclaz
@alexclaz 26 дней назад
You don't need a framework, the project needs. For small projects you dont need frameworks like Laravel, Django, Angular, or Vue. However, a backend framework can save a lot of time if the project involves a lot of backend work. Same for a JavaScript framework, it can be very efficient for projects requiring a lot of interactivity and dynamic content
@kiranugale88
@kiranugale88 14 дней назад
I agree with all your explanation. Thanks
@Fuscao_Preto
@Fuscao_Preto 25 дней назад
I'm learning how to use javascript in emergency mode as i need only a login page and dashboard for a uni project to show data from an esp32. I can not find a single tutorial without frameworks. I don't need them, I only need a graph with two variables and two gauges.
@Matt-li5pm
@Matt-li5pm 24 дня назад
My goto for this kinda things are SVGs. Specifically when I need some simple, non-interactive graph.
@aschmelyun
@aschmelyun 21 день назад
You can also use a JavaScript graphing library without a framework. Chart.js is perfect for this, and has been around long enough that you can ask ChatGPT or Copilot for some helpful examples!
@Topakhok
@Topakhok 27 дней назад
Yeah, but how do you store state and process real-life updates this way? You’re talking about very static websites, which is definitely not 90% of the cases
@thuanquoc1231
@thuanquoc1231 29 дней назад
But but... my "separation of concern 😭😭😭
@guerra_dos_bichos
@guerra_dos_bichos 27 дней назад
We had separation of concerns long before reactivity
@sayib
@sayib 25 дней назад
This is cool, but im wondering how about if a user filled the first form, but on the second form he leave, this will create unfinished data, won't it? or what if he did a typo on the first form, and want to correct it?
@aschmelyun
@aschmelyun 25 дней назад
You're correct, and there should be measures in place to allow someone to a) finish a form, or b) go back to the previous page and correct the information. I didn't include these in the video on account of time, but it's something that's possible with this pattern and should be addressed!
@trevormanhuwa
@trevormanhuwa Месяц назад
I will defend my opinion that JetBrains PHP Storm or any JetBrains product is better than VS Code
@aschmelyun
@aschmelyun 29 дней назад
Rare instance of me not using PHPStorm
@saabirmohamed636
@saabirmohamed636 29 дней назад
neovim or hx , with zellij (if you dont have any money) otherwise jet.
@devstuff2576
@devstuff2576 28 дней назад
windows is better than linux .
@yudi8204
@yudi8204 28 дней назад
​@@devstuff2576That's obvious
@MarcoDamaceno
@MarcoDamaceno 26 дней назад
This is gold! Back to the basics. New developers think they need React for everything, but no. They think websites started to be made after 2014. 😂
@lukmanblemka3652
@lukmanblemka3652 26 дней назад
am working on a project right now using django template and htmx its good
@klukiyan
@klukiyan 25 дней назад
What Theme are you using? it looks very nice
@aschmelyun
@aschmelyun 21 день назад
The color theme is Palenight, and the font is Comic Code
@0ninetyseven97
@0ninetyseven97 27 дней назад
im seeing a comeback on this with next with using "use server" in the component.
@MePeterNicholls
@MePeterNicholls 27 дней назад
I hand coded an exhibition stall contact address database, input taker and mail out system in an hour from scratch while sat on the stall using it. And I made it so that public uses couldn’t accidentally resubmit forms by using back in the browser using …. PHP. Just. PHP. Lol. (HTML/css/mysql sure. But it was so simple and straightforward)
@aschmelyun
@aschmelyun 26 дней назад
Those simple solutions are arguably the best!
@natalieeuley1734
@natalieeuley1734 15 дней назад
There's so much to balance in the modern web. Personally I feel like the only real way to do it right is to focus hard on minimizing dependencies. The point of something like React is almost the opposite- to build things in top of but it only does so much on its own. And to me, that's part of the problem. The goal of a web page should be to do whatever the job is, not to be easy to make.
@CristianKirk
@CristianKirk 28 дней назад
Only watched the video to hear HTMX mentioned. I agree with everything presented here except with calling "apps" to web sites :D
@FelipeV3444
@FelipeV3444 28 дней назад
My understanding is the following: - if the content is static, it's a web site. - If the content is dynamic (state), it's a web app. Am I wrong?
@ChuloTurtle
@ChuloTurtle 26 дней назад
This was really cool
@albertcito
@albertcito 26 дней назад
Now try to use the same endpoint to create a native app or other services?
@aschmelyun
@aschmelyun 25 дней назад
That's when I'd switch to a separate API/Frontend situation 100%
@Naton
@Naton 28 дней назад
my only gripe with htmx is you cant revalidate once valid. @13:18
@MrSofazocker
@MrSofazocker 28 дней назад
Whaaaat? Where would you have to re-validate something you already sent? Changing anything on the client-side then and there wouldn't change anything on the server!?
@ReidQuisenberry
@ReidQuisenberry 24 дня назад
What font/typography are you using here? I want your typog
Далее
From React To HTMX
40:01
Просмотров 300 тыс.
Why Don't We Have A Laravel For JavaScript?
12:36
Просмотров 82 тыс.
КТО ДОЛЬШЕ ПРОЖИВЕТ НА 10$
31:43
Просмотров 588 тыс.
The Most Important Skill You Never Learned
34:56
Просмотров 139 тыс.
HTMX - What they don't want you to know!
13:28
Просмотров 79 тыс.
PHP on the frontend! No more Javascript!
14:47
Просмотров 117 тыс.
Harder Than It Seems? 5 Minute Timer in C++
20:10
Просмотров 132 тыс.
HTMX: 3 IRL Use Cases
18:33
Просмотров 105 тыс.
Your backend is too complicated
9:47
Просмотров 57 тыс.
No-Nonsense Backend Engineering Roadmap
10:16
Просмотров 166 тыс.
HTMX Sucks
25:16
Просмотров 91 тыс.
The Importance of Specialization in Coding
7:13
Просмотров 174 тыс.
Калькулятор в iPadOS 18 ➕
0:38
Просмотров 146 тыс.
Девушка и AirPods Max 😳
0:59
Просмотров 16 тыс.
How To Unlock Your iphone With Your Voice
0:34
Просмотров 22 млн
Ноутбук без экрана
0:22
Просмотров 16 тыс.