What the hell is HTMX?

Поділитися
Вставка
  • Опубліковано 3 січ 2025

КОМЕНТАРІ • 157

  • @ranarisonluckas9745
    @ranarisonluckas9745 Рік тому +78

    Thanks nerd!

  • @Stefan-bs6ty
    @Stefan-bs6ty Рік тому +66

    We have adopted htmx a couple of months ago and can confirm that our productivity skyrocketed. I totally agree with your statement "The client should be dumb". "Modern" frontend frameworks add so much complexity that it hurts. The first time you tell people what a browser is actually capable of *besides* JS is always mindblowing.

  • @CodingWithLewis
    @CodingWithLewis Рік тому +88

    I gotta give HTMX a try. I never realized how much time I wasted doing conditionals in my React code

    • @typecraft_dev
      @typecraft_dev  Рік тому +2

      Can’t wait to build something substantial with it!

    • @KuroManX
      @KuroManX Рік тому +8

      now you gonna do it on the server

    • @adamwarvergeben
      @adamwarvergeben Рік тому

      Didn't you make an Video about HTMX a few months ago...?

    • @d7584
      @d7584 Рік тому

      yooo lewis sup

    • @UwU-dx5hu
      @UwU-dx5hu Рік тому

      What is this clown doing here

  • @dreamsofcode
    @dreamsofcode Рік тому +39

    Nice video, dude! Hyped about htmx. Would love to see more on it ;)

  • @sleeepey
    @sleeepey Рік тому +19

    This is the best explanation of htmx I have seen, and in under 4 minutes! well done

  • @ВладиславГайсюк-ъ7ц
    @ВладиславГайсюк-ъ7ц 2 місяці тому +1

    10+ years full stack web dev here.
    IDK if that htmx theme is a big meme that I do not understand, but after that video feels like everybody has forgoten the main build blok of the web.
    Backend system should newer know about your web app state.
    Backend system can comunicate in any way it wants, by default everybody uses nowdays JSON, but there was a time it was XML instead of JSON. (JSON simplified a lot)
    You backend system should always be stateless. Its just a point of your application that does business processes with data.
    When you are creating your backend system - you should not think about web app, web app is just a tool to call your backend.
    Any other solutions, like TV app, mobile App, Desktop App etc is just a proxy between user and your backend.
    So what we have with HTMX?
    Your backend system should generate web related templates. (??? how mobile app client will work with this html - idk)
    Saying that there is no JS - is absurd, because HTMX is basicly a big JS file.
    Idk why should I use HTMX, if I can use Alpine :/
    That allowes me do the same things, even making old style HTML swap.

  • @himurakenshin9875
    @himurakenshin9875 Рік тому +6

    Less things to learn on client side and able to try new languages in the backend. Its a win.

  • @BlackxesWasTaken
    @BlackxesWasTaken Рік тому +12

    The funny part is that in order to enhance and achieve the "get back to the roots"-ish behaviour and methods to use html
    we used JavaScript to build a little library which helps building simple reactive frontends with backends spitting out raw html as it used to back in the day
    As soon as the complexity of the frontend increases we would still need to get back to writing JavaScript in order to granularly adapt results to the frontend

    • @typecraft_dev
      @typecraft_dev  Рік тому +7

      It’s true. But that’s because HTML never added more functionality (for server communication at least) so JS is the easiest way to implement this behavior ironically. BUT this is a far better pattern then the heavy single page apps

  • @aspiring_millionaire
    @aspiring_millionaire Рік тому +3

    Wow! This is the greatest video introduction of what htmx is, it's clear, concise, straight to the point and very fun to watch! referring to your video lol, not htmx :)

  • @typecraft_dev
    @typecraft_dev  Рік тому +5

    This video is based on the ebook found here: hypermedia.systems

    • @paulstaszko31
      @paulstaszko31 Рік тому +2

      I bought the hardcover book, I really enjoyed reading it and am happy to support the authors. It will be a real trophy on my shelf

  • @JFromAcc
    @JFromAcc 11 місяців тому +2

    Good lord. I just listened to another UA-cam video on the same and damn near stabbed myself in the eye. I won't say which one, but this is fantastic. Thank you.

  • @p07a
    @p07a Рік тому +1

    algorithm blessed me with your channel. subscribed. love the quick, to-the-point pace. no more 20 minute videos. thanks nerd!

  • @daffy1981
    @daffy1981 Рік тому +15

    After having my first JS written in 98' I'm so tired of continuous flow of frameworks, but this one looks a pretty new paradigm. Will need to check out ... (or maybe I still stick to plain HTML5, as there is no silver bullet)

    • @hansdietrich1496
      @hansdietrich1496 Рік тому +3

      I'd love to see htmx become integrated into HTML6.

  • @JoshMedeski
    @JoshMedeski Рік тому +5

    Oooo, I’m ready to start exploring this new tool. Thanks for the great explanation!

  • @joseph0x45
    @joseph0x45 Рік тому +7

    I really like the way you explain stuff :)) Great vid

  • @maskman4821
    @maskman4821 5 місяців тому +2

    Awesome, I love Htmx, the createor of Htmx is a genius 🤩😍

  • @vectoralphaSec
    @vectoralphaSec Рік тому +2

    I have given up on JavaScript and have switched fully to HTMX. Its so much easier and overall better.

  • @ansidhe
    @ansidhe Рік тому +14

    This sounds like kids discovering flare jeans 😉😂 but I’m all happy we’ve finally reached this stage 👍🏻
    SPAs are all great for their specific functional niches but world would be a much happier place if server-heavy websites and especially internal-use CRUD apps were built using SSR. Not everything needs to be Figma 😉

  • @pr.loremarguimaraes7284
    @pr.loremarguimaraes7284 Рік тому +1

    You've just convinced me to take HTMX seriously. Liked, subscribed. Thanks!

  • @luckrunner
    @luckrunner Рік тому +4

    First of all, avoid the opinions of most JS programmers. Anyone who is not sarcastic will be fundamentally skeptical. They will talk about how HTMX handles JSON, they will say that it is not secure. They will even cite PHP to illustrate that you are using a new templating system. Forget the haters. The thing works, and serves the purpose. The learning curve is small and, unlike other models such as Angular, Vue and React, it requires project planning with another level of maturity.
    Just as today, immature programmers make fun of PHP (which brought home the bacon for many developers and therefore deserves its place of respect), in the near future JS will be treated like mullets and fanny packs.

  • @games4us132
    @games4us132 10 місяців тому +1

    btw how htmx can help with GraphQL or OData apis ? and what about UI libraries? Backend developers should send us fullblown components to swap?

  • @games4us132
    @games4us132 10 місяців тому +1

    so you basically tell that with htmx now backend developer should know how to design html web pages with paddings, margins, flexboxes and so on?

  • @elkadiriabdellah1119
    @elkadiriabdellah1119 Рік тому +2

    when u using htmx u will get a lot of requests from client to server and those request can atchive that easy by javascript, problem is if u have alot of traffic that will do problem is servuer from requests i guess

  • @semikolondev
    @semikolondev Рік тому +2

    Makes thinking of the famous "The Thirty-Million Line Problem" so much bloat and layer these days even in the web.

  • @nanonkay5669
    @nanonkay5669 Рік тому +11

    This is definitely the future

  • @alivenumber5
    @alivenumber5 Рік тому +2

    Whew you got me PUMPED on it. Hard agree. The client should be UI interactivity only. In my day job I found myself replicating similar principles in a microcosm of our React framework. We went from sending one large chunk of data to the front and having a heavy front-end to many smaller requests based upon user interactivity. Guess which one was snappier! The idea that we can offload all that data handling to the client is a falsehood when you still need data from the back-end anyways.

  • @lolikpof
    @lolikpof Рік тому +4

    For someone who has very little experience with html/css and javascript, what would you recommend learning, if I'm only interested in learning one framework, svelte or htmx? I'm actually a data scientist and mostly use python, but would like to learn one good framework, but only one. Thanks :3

    • @typecraft_dev
      @typecraft_dev  Рік тому +1

      If you want something more mainstream go with svelte. If htmx is something that speaks to you, feel free to go there too! HTMX is lighter in concepts than svelt/react/etc…

  • @hansdietrich1496
    @hansdietrich1496 Рік тому +2

    Looking at this now, I wonder about two things: a) why did it take decades to realize, how all this JS BS can be thrown out of web development again and b) when will these attributes get standardized, so that browsers implement them natively and we even get rid of the last bit JS to make this work?

  • @darkwoodmovies
    @darkwoodmovies Рік тому +1

    I don't think anyone is going to use this directly, but I'm excited to see how React and its derivations use this to improve over time.

    • @punkweb
      @punkweb Рік тому +2

      I use this directly... why the fuck would you use this with react?

    • @darkwoodmovies
      @darkwoodmovies Рік тому

      @@punkweb "Use this directly" meaning open an html file and start adding your s and stuff with HTMX.
      I never said use it WITH React. That said, I realize now that this is a library and not a browser-supported technology, which makes my other statement (how React and its derivations can embrace this tech under the hood) irrelevant. So nvm

    • @punkweb
      @punkweb Рік тому

      @@darkwoodmovies I think you've missed the point. You don't just start using htmx in an html file. You use it with something like django or php where you're already server rendering html.

    • @punkweb
      @punkweb Рік тому

      You set up backend endpoints that return html and use htmx to call them and swap out/in parts of the dom.

    • @darkwoodmovies
      @darkwoodmovies Рік тому

      @@punkweb Aah I see, hmm interesting. Feels a bit old school but I suppose that's the idea :)

  • @thegrumpydeveloper
    @thegrumpydeveloper Рік тому +2

    I’m wondering how fragments of ui split across front and backend is going to make things easier. Global mutable state causes challenges. Global split mutable state seems even harder. At least with json and apis the two were independent. An api that returns ui coupled to a frontend seems to add more tight coupling. At least conceptually.

    • @upsxace
      @upsxace Рік тому +2

      Not everything is state -_-
      With HTMX you have an event-based approach, you don't use state.

    • @ryanleemartin7758
      @ryanleemartin7758 Рік тому +1

      It's good old web 1.0 stateless request / response.
      get->handler-> db call -> html template -> response.
      post-> json->handler->db update->response.
      Where's the added global mutable state? I must be missing something.

    • @ryanleemartin7758
      @ryanleemartin7758 11 місяців тому

      @danielhalachev4714 you'd have a json api service for those other clients. It's not about eliminating json apis.. It's about simplifying web clients.

  • @VANTYCSolutions
    @VANTYCSolutions Рік тому +3

    Awesome! thank you for this information.

  • @joey2545
    @joey2545 Рік тому +3

    Very interested in learning more about HTMX. I work primarily in Rails so I wonder how it compares to Hotwire and if I should try HTMX with Rails?

  • @paulstaszko31
    @paulstaszko31 Рік тому +4

    Htmx is the future and the past rolled into one

  • @eddyk564
    @eddyk564 Рік тому +1

    I don't understand the example you gave. Based on the example, the frontend would make a request to "/users/1" and whatever would be returned would be based on what the backend was designed to return. The "hx-target" is just the element ID that you want to put the data that was returned in, right? How is that any different from using fetch(), getting the data, and then putting it into the HTML?

    • @shrin210
      @shrin210 Рік тому

      What if you want to change the UI/data in Navbar? Then you need to create a Root state then pass it to the children to update the UI.
      In this you do not need to any of that and it will directly apply UI to Navbar

    • @crispi_shots
      @crispi_shots Рік тому +1

      Instead of fetching json data and then parsing it on the client and putting into html
      You simply retrieve the already built html.

    • @eddyk564
      @eddyk564 Рік тому

      @@shrin210If you want to change the data in the navbar you just type- document.querySelector(#navBar).innerHTML= (and just put what you want it to look like here).

    • @eddyk564
      @eddyk564 Рік тому

      @@crispi_shots Isn't that what the HTML tag is doing anyway with hx-get (or whatever it's called)? It's clearly a request to the backend/server. The hx-target is just the ID of what you're changing.

    • @gradycdenton
      @gradycdenton Рік тому

      If a data API changes then it breaks the front end in a SPA. Your fetching code has to understand the shape of the data it is expected to get back from the endpoint. Either you have full-stack type safety or you have to look up the API documentation. The front end is tightly coupled to the back end. In HTMX, you just fetch the endpoint and display it. Your front end doesn't have to understand anything about the resource on the back end. Since all the buisiness logic is on the back end, you are free to change said logic without breaking the front end. @@eddyk564

  • @KonstantinosFylaktopoulos
    @KonstantinosFylaktopoulos 7 місяців тому

    very nice and clean explanation!

  • @CYXXYC
    @CYXXYC Рік тому +1

    3:28 Caching, where/howto?

    • @typecraft_dev
      @typecraft_dev  Рік тому +1

      With the html “cache-control” header. Sorry didn’t go into detail on it in this video

  • @yuhanlian991
    @yuhanlian991 Рік тому +3

    3:20 i have been saying this for so long!

  • @ascourter
    @ascourter Рік тому +1

    Great video! htmx is awesome!

    • @typecraft_dev
      @typecraft_dev  Рік тому +1

      Thanks I agree. I’ll have to build something with it

  • @OM-bs7of
    @OM-bs7of Рік тому +3

    Htmx cant be used for building standalone apps though, as seen with ionic. There are pros and cons with all technologies. It is important to never disregard any specific technology

  • @hassanghalib-aj
    @hassanghalib-aj Рік тому +5

    I like the fireship style of delivery😂

  • @gofullstack
    @gofullstack Рік тому +1

    If I have my API return HTML doesn't it mean I can no longer use this same API on my mobile/desktop app?

    • @typecraft_dev
      @typecraft_dev  Рік тому +4

      You could have different namespaced endpoints for mobile/desktop apps. You could also use hyperview if you want the same hypermedia paradigm. Also HTMX isn't a one-stop solution, I think the idea is to use the simplest tools for the job, whichever job that may be

    • @gofullstack
      @gofullstack Рік тому +1

      @@typecraft_dev Gracias

    • @danxdev
      @danxdev Рік тому

      ​@typecraft_dev so maintain two sets of apis one so that we can use htmx on a website and then another to handle the same data calls for everything else?

  • @everyhandletaken
    @everyhandletaken Рік тому +1

    PWA’s.. it was nice knowing you..

  • @skr4u
    @skr4u Рік тому +2

    after a long time in more than a decade with the mess of react, angulat, vu...... etc... , this HTMLX seems logical

  • @Vinylll04
    @Vinylll04 Рік тому

    This will definitely be great for making new custom web apps but that doesn’t mean don’t learn JavaScript and your frameworks since many companies or jobs cannot keep up with these new changes quickly

  • @Qmxire
    @Qmxire 5 місяців тому +1

    I hope that there will come a time when people can escape the complexity of JavaScript and make a living using this language.

  • @Noritoshi-r8m
    @Noritoshi-r8m Рік тому +2

    Looks amazing, guess i'm fullstack now

  • @enterusername7746
    @enterusername7746 Рік тому

    HTMX is great but falls short for some tasks. For exampe if I want to hide and show a part of my website. It is overhead to male a roundtrip to the server and load the whole part again and again for each toggle.

    • @ryanleemartin7758
      @ryanleemartin7758 Рік тому

      Totally but that's where javascript comes in. There's this misconception that if you use htmx then you can't or shouldn't use any javascript at all.

    • @AndersBaumann
      @AndersBaumann Рік тому +1

      I used to think the same thing. But there is actually little overhead in the server roundtrip, and it keeps things very simple. If you need to update multiple places at the same time, then return a larger portion of the screen that includes both places. Very simple and you will be surprised how fast it works. I have implemented a web site with a SPA-feel using this technique. The site has less than 500 lines of JavaScript and they are mostly used for setting up DataTables components.

  • @ComputerProgramming-ig9kn
    @ComputerProgramming-ig9kn 2 місяці тому

    I found that htmx is basically JavaScript. And it also has logic in its JavaScript file.

  • @autohmae
    @autohmae Рік тому

    Now what to do about offline ? I guess we put the logic in the service worker ? Or maybe it's just not a use case it's trying to solve ?

  • @Tim-again
    @Tim-again 9 місяців тому +1

    I'm techincally a Blerd, my ninja

  • @Aimsport-video
    @Aimsport-video Рік тому

    Then in 3-years… how do we reduce the massive number of calls to the server?

    • @typecraft_dev
      @typecraft_dev  Рік тому +3

      Doesn’t that already happen?

    • @Aimsport-video
      @Aimsport-video Рік тому

      @@typecraft_dev not to the fine granularity of UI updates.

  • @fakdapeditz4937
    @fakdapeditz4937 Рік тому +3

    Yeaaa now implementing my backend projects in web will be much easier

  • @kahnfatman
    @kahnfatman Рік тому +1

    Define free, great, smart... I know JS sucks and being abused but I am truly skeptic and not ready to jump on another techwagon. Good luck guys.

    • @typecraft_dev
      @typecraft_dev  Рік тому +1

      I think the great part about htmx is that it isn’t a “tech wagon”. It’s very lightweight and isn’t meant to be used as a framework

  • @n8o_
    @n8o_ Рік тому +1

    Still waiting to see a live example of this

  • @emerelle3535
    @emerelle3535 7 місяців тому

    I'm also excited about htmx, but not creative enough for coming up with content I could show on a website. :P There is already everything made. :P

  • @mp6086
    @mp6086 Рік тому

    Isn't returning html from the server coupling it was supposed to eliminate? If we decide to change the UI structure, that has to be done in the API, or am I missing something?

  • @laughingvampire7555
    @laughingvampire7555 4 місяці тому

    is also the return of Rails to prominence

  • @codecaine
    @codecaine Рік тому +1

    Well explained

  • @nickpatella1525
    @nickpatella1525 Рік тому +3

    I don’t think this is what the web needs. Can you stream data with it? Will this not open new vectors for XSS attacks?

    • @typecraft_dev
      @typecraft_dev  Рік тому +7

      SPAs are still extremely useful in certain situations (like data streaming, etc...). But for the most part, websites (blogs, stores, etc..) don't need to be SPAs. I'd argue something like htmx is a far easier way to build/maintain those kinds of apps.

    • @EDC.EveryDayCode
      @EDC.EveryDayCode Рік тому

      Ok u mention data streaming. what i think is nuts is that Steam company uses people's own hardware to store 70Gb games, and this is just normal. I Think that's nuts and I think this is how most pc gamers would do things. What if u want 50-500 games, do they just archive it then redownload b4 they want to play? that seems like a step backwards from disks. lol! I was listening to a programming podcast and apparently it is a very big lift to get games to stream like we do all our video apps. @@typecraft_dev

  • @CristianKirk
    @CristianKirk 6 місяців тому +1

    I've being waiting for years for js frameworks to die.

  • @TriNguyenKV
    @TriNguyenKV Рік тому +5

    I love htmx; I loath modern js frameworks that adds too much overhead. Make the web simple again is great! Love htmx and alpinejs. Simple, elegant and just work!

  • @joaquinnunezgarcia9279
    @joaquinnunezgarcia9279 Рік тому +1

    In terms of separation of concerns this is going a step back by coupling frontend and bancked work. But if you are not concern about this and want a full stack approach, this is good

  • @EDC.EveryDayCode
    @EDC.EveryDayCode Рік тому +1

    frontend should be dumb... as I'm learning React 🙄. It probably should be, but there are so many approaches to web dev it's really annoying. Like I've heard u can build sites really fast with Hugo / static site generators... this seems like apple to orange comparison tho. here's some buzzword ideas for your next videos: JSX, XML, AJAX, Wasm, websockets, vue, react when will it end???

    • @typecraft_dev
      @typecraft_dev  Рік тому +1

      I agree its confusing. But from my experience. The best applications have the mantra "the frontend should be dumb". Even the best React apps are made better when complexity is taken out of them. Its just a philosophy for web development. But I think its the right approach. (react is great btw)

  • @DavidConnerCodeaholic
    @DavidConnerCodeaholic Рік тому

    Yeh but this is basically exactly what Angular the JS was supposed to be.
    Also, what about the WASM? And does the DSL of HTMX limit the expression of logic in the UI?
    I like HTMX, especially given the it “just works” for things like SEO: no alternate static site req - which is suspect to begin with if your robots know that they’ve landed on “planet namek”

    • @Stefan-bs6ty
      @Stefan-bs6ty Рік тому +5

      You think too much in SPA world. When talking about htmx, you shouldn't make a connection to Angular or WASM at all. Because htmx is just an extension to good old server-side rendering: It helps you replace parts of your frontend state, in a very smart manner. But that's about it.

  • @antinityfx
    @antinityfx Рік тому

    i though this was fireship until i heard the voice lol

  • @yousef_beta3a
    @yousef_beta3a Рік тому +1

    I thought that Elon musk rebranded html .....

  • @roysupriyo10
    @roysupriyo10 Рік тому +4

    There is absolutely no difference between the JS libraries and htmx. They all use the same dreaded JavaScript. You only write the frontend differently which i would argue that the react or the standard 'framework' setup is more modular and readable as well as easier to maintain because of good organisation. This just looks like another tailwind css library i have to learn to only get limited functionality

    • @paulstaszko31
      @paulstaszko31 Рік тому +5

      If you're open to having your mind blown, read the hypermedia systems book. The fact that htmx is written in js is a funny little implementation detail. It should have been done directly in the html spec decades ago.

    • @ryanleemartin7758
      @ryanleemartin7758 Рік тому

      That's like saying there's no difference between a studio apartment and a skyscraper.

  • @erikschiegg68
    @erikschiegg68 5 місяців тому

    Ok, sounds like Javascipt parent child manipulation for lazy to me. We did that with a 2 GB RAM stick back then, dude!

  • @sootynemm
    @sootynemm Рік тому +2

    bring back car phones!!!!!!!!!

  • @chrishyde952
    @chrishyde952 Рік тому

    how is the htmx example not equally coupled to the api response, like the js fetch example is?

  • @flogzer0
    @flogzer0 Рік тому +1

    Daddy rambled about the good old days, skip to 2:30

  • @naranyala_dev
    @naranyala_dev Рік тому

    golang + htmx

  • @cenkakay3506
    @cenkakay3506 Рік тому +1

    nice framework grandpa

  • @jamelelhadjhamlaoui8753
    @jamelelhadjhamlaoui8753 9 місяців тому

    why the front should be dumb and we should make everything in the back ?

  • @coben6669
    @coben6669 Рік тому

    It may be useful ony on simple frontend apps, but why use htmx on simple frontend while you can use already battle tested template engines? Can't see a point of using this.

  • @hammock6871
    @hammock6871 Рік тому

    Oh cool, someone has reinvented jQuery again

  • @S-Lomar
    @S-Lomar Рік тому

    💞💞😍🥰🥰🥰🥰💕💕💕💕🥰🥰🥰🥰🥰🥰🥰🥰

  • @QueeeeenZ
    @QueeeeenZ Рік тому

    As a frontend developer, I don't like htmx. I don't see how you could create a large complex app with it.

    • @roelvaneyken211
      @roelvaneyken211 Рік тому +3

      You write the app on the backed, instead of in the frontend.

    • @QueeeeenZ
      @QueeeeenZ Рік тому

      @@roelvaneyken211 htmx is for all the javascript haters

  • @edhahaz
    @edhahaz Рік тому

    What HTMX does it does better, but what it can't do React can. On the web the framework that does it all will always "win".

  • @liquidcode1704
    @liquidcode1704 Рік тому +1

    nah u wrong, http obviously mean "hop to the page" lmao