HTMX Crash Course | Dynamic Pages Without Writing Any JavaScript

แชร์
ฝัง
  • เผยแพร่เมื่อ 11 มิ.ย. 2024
  • Learn HTMX by creating a couple of small projects with a Node.js and Express backend, including a contacts search, temperature converter, mock weather app with polling and form validation component. We will learn about the common HTMX attributes like hx-get, hx-post, hx-swap, etc.
    Final Code:
    github.com/bradtraversy/htmx-...
    Alpine Crash Course:
    • Alpine.js Crash Course
    Check out my courses:
    traversymedia.com
    Social Media:
    Github - github.com/bradtraversy
    Twitter - / traversymedia
    Instagram - / traversymedia
    Facebook - / traversymedia
    Linkedin - / bradtraversy
    Timestamps:
    0:00 - Intro
    3:42 - Node.js/Express Server Setup
    9:23 - Simple request with hx-get & hx-trigger
    11:12 - hx-swap
    11:58 - Route to get a list of users
    16:04 - hx-target
    17:00 - hx-confirm
    17:30 - Get users from jsonplaceholder
    18:40 - hx-indicator
    21:06 - hx-vals
    23:27 - Temperature converter with hx-post
    29:44 - Polling
    33:23 - Mock weather app with polling
    36:44 - Contacts search widget
    39:50 - Backend route for search
    47:08 - Inline form validation
    50:12 - Backend route for validation
    56:01 - Wrap up
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 241

  • @Readraid_
    @Readraid_ 3 หลายเดือนก่อน +13

    > uses htmx to avoid writing js
    > node js server backend

  • @anggaradotnet
    @anggaradotnet 3 หลายเดือนก่อน +13

    If one day a lot of people manage to create an app that revolutionizes the world, they should thank you for making such clear tutorial. Thank you so much! HTMX is cool!

  • @jkiamafish
    @jkiamafish 5 หลายเดือนก่อน +41

    You are the only person who has mad an actually valuable HTMX tutorial, to my knowledge. I needed to learn this for school and the docs were not super helpful for getting started. I'm 12 minutes in and I now understand how to get HTMX running.

    • @BGdev305
      @BGdev305 หลายเดือนก่อน +1

      I was just thinking the same thing! This is because he's a really good "teacher".

    • @saitaro
      @saitaro 25 วันที่ผ่านมา +2

      Do you have an HTMX class in your high school?

  • @aham.manishverma
    @aham.manishverma 21 วันที่ผ่านมา +2

    Hands down, this is the best HTMX tutorial on TH-cam!

  • @joel-rg8xm
    @joel-rg8xm 5 หลายเดือนก่อน +10

    heck of a "how a Crash Course should be", nice variety of mind-opening mini projects as well. Kudos

  • @gedaredorke5941
    @gedaredorke5941 5 หลายเดือนก่อน +4

    First of Happy New Year to Brad. Your Crash Courses provide a wealth of knowledge and they always lay the foundation for exploring in-depth topics. Looking forward to more content this and hope that this year will be extremely great year for you.

  • @veenmikki27
    @veenmikki27 5 หลายเดือนก่อน +15

    It's great to finally get a good HTMX tutorial. Happy New Year Brad and thanks for the great tutorials.

  • @anakobe
    @anakobe 5 หลายเดือนก่อน +18

    Always there for the community! Thanks Brad!

  • @scotthallett
    @scotthallett 5 หลายเดือนก่อน

    Amazing! Been waiting for a course on this - Thank you Brad! Happy New Year.

  • @samnako
    @samnako 5 หลายเดือนก่อน +26

    Happy new year to you Brad. Thanks again for enriching our learning. Wishing you good health in 2024.

    • @TraversyMedia
      @TraversyMedia  5 หลายเดือนก่อน +1

      Thank you 😊Same to you!

  • @zapphoddbubbahbrox5681
    @zapphoddbubbahbrox5681 5 หลายเดือนก่อน +4

    htmx, finally ;) You've just scratched the surface... Hope you will continue on this path as, IMO, you are probably the only YT coding instructor that is clear and devoid of fast-edit/fast-speak. Thanks!

    • @outwithrealitytoo
      @outwithrealitytoo 3 หลายเดือนก่อน

      My pet peeve is demos where the person keeps having to retype things because they are trying to talk and type at the same time. "Every once in a while... fine... but that's the third line in a row you've have at least three stabs at... and you have code completion switched on".

  • @nizamuddinshaikh3185
    @nizamuddinshaikh3185 5 หลายเดือนก่อน +7

    A simple but lucid explanation of HTMX. Anyone can use this as a stepping stone in further advancement in web development. Thank you Brad for sharing. 😃

  • @user-yx1ic8kv5s
    @user-yx1ic8kv5s 5 หลายเดือนก่อน +4

    New Years gift from Brad is here!
    Thank you a lot! 😊

  • @ryandsouza7100
    @ryandsouza7100 5 หลายเดือนก่อน +2

    Thank you Brad. Had been waiting for this one.

  • @MarkVolkmann
    @MarkVolkmann 5 หลายเดือนก่อน +6

    Excellent video! Thanks for sharing it!
    When picking a server-side stack, I think it’s a good idea to choose one that has good support for generating HTML (not just string concatenation) and has tooling support that gives syntax highlighting and understands what is valid in HTML.

  • @gbengaomoyeni4
    @gbengaomoyeni4 5 หลายเดือนก่อน +3

    Thank you Brad, the best and award-winning programming instructor in the world. Keep up the good work. May the good Lord bless you and water your garden as you water ours. Happy new prosperous year.

  • @giuzp95
    @giuzp95 5 หลายเดือนก่อน

    Wow, what a treat! I've been looking for a quick and simple tutorial for HTMX. Thank you!

  • @wazeeharaa8100
    @wazeeharaa8100 5 หลายเดือนก่อน

    The Excellent! Clear Notch Voice, Pace and Modulation which makes easy understanding

  • @chrisnortonjr
    @chrisnortonjr 5 หลายเดือนก่อน

    Whenever I want to learn something, I always check your channel first man.

  • @davidriveros5422
    @davidriveros5422 5 หลายเดือนก่อน

    I was searching for an HTMX guide to start my next project, this came up right on time. This was a great tutorial, thank you!

  • @blue_mustang_
    @blue_mustang_ 5 หลายเดือนก่อน +2

    Thax Brad.This is really cool! Happy new year!

    • @TraversyMedia
      @TraversyMedia  5 หลายเดือนก่อน +1

      Happy New Year!

  • @codybishop7526
    @codybishop7526 5 หลายเดือนก่อน +1

    I'm in love with this. It makes reasoning about what is going on, so much simpler than react. God, hooks and the complexities of react these days just makes my head hurt. This is so elegant, minimal and wonderful. Here's to hoping that HTMX becomes a web standard and breaks us away from these overly complex "solutions".

  • @adrianmisak07
    @adrianmisak07 2 หลายเดือนก่อน

    that was just amazing… thank you, I needed an introduction to htmx, and this was better than i could have hoped for

  • @judevector
    @judevector 5 หลายเดือนก่อน +43

    You never disappoints always coming through for the community when needed the most, now I can finally learn HTMX. Videos I have been seeing are not worth it
    Thank you and Happy New Year to everyone 💖🥳

    • @TraversyMedia
      @TraversyMedia  5 หลายเดือนก่อน +5

      Thanks so much. Yeah surprisingly, not a lot out there as far as content on HTMX. Happy New Year!

    • @user-bf6yx4nn5k
      @user-bf6yx4nn5k 5 หลายเดือนก่อน

      Also here to learn this new paradigm. Happy new year 🎉

    • @marilynlucas5128
      @marilynlucas5128 5 หลายเดือนก่อน

      @@TraversyMedia You should do a codux tutorial

    • @noodlespwn42
      @noodlespwn42 4 หลายเดือนก่อน

      you know you can read the docs ?

  • @NoahNobody
    @NoahNobody 5 หลายเดือนก่อน

    I'm really happy you took an interest in HTMX. I've been using it for personal projects and am very happy with it.

  • @SiteStudio
    @SiteStudio 5 หลายเดือนก่อน

    Love seeing more HTMX knowledge content popping up.

  • @arnaudpoutieu1331
    @arnaudpoutieu1331 5 หลายเดือนก่อน

    Hey Brad, I wish you all the best for 2024!!!
    Regarding the vid, this is the best one I have seen about HTMx thanks 👍🏿

  • @atibyte
    @atibyte 5 หลายเดือนก่อน

    I was waiting for an HTMX video from you. Thanks for posting!

  • @stiofanmacthomais
    @stiofanmacthomais 2 หลายเดือนก่อน

    Excellent overview - easy and clear to follow along!

  • @mohammadjalifathi6193
    @mohammadjalifathi6193 5 หลายเดือนก่อน +16

    Brad we really need a full great next js course I really love your courses

    • @TraversyMedia
      @TraversyMedia  5 หลายเดือนก่อน +16

      Working on it next (pun intended)

  • @MarkusEicher70
    @MarkusEicher70 5 หลายเดือนก่อน +1

    Hi Brad and hello community. Thank you for this intro to HTMX. I like the simplicity and the low footprint of HTMX. I want to use it with Rust and now need to figure out how. Overall it looks very nice. May you all have a great 2024!

    • @Bargains20xx
      @Bargains20xx หลายเดือนก่อน

      I will be doing the same, there is something about performance that's very fascinating

  • @daymaker_bybit
    @daymaker_bybit 3 หลายเดือนก่อน

    I love you! ♥ Learning from your courses since 2019

  • @omomer3506
    @omomer3506 5 หลายเดือนก่อน

    Following your github i always know new video is coming when you have a new repo, love it

  • @therealnoel.
    @therealnoel. 5 หลายเดือนก่อน

    Yes 🥂. That's the course I've been waiting for. I literally used the documentation to learn it 6 months ago - something I never do 😂.
    Anyways, Happy New Year Brad 🎉

  • @smddev
    @smddev 4 หลายเดือนก่อน

    This crash course was extremely helpful for a school project I’m working on.

  • @tanaht23
    @tanaht23 5 หลายเดือนก่อน

    HTMX... by Traversy MediaX
    >>
    Happy New Year BradX !
    Thank you.

  • @stronglycorrelated
    @stronglycorrelated หลายเดือนก่อน

    Great tutorial, gets straight to the point.

  • @DarrelDavis
    @DarrelDavis 5 หลายเดือนก่อน

    Great video. It's what I needed to get on with HTMX. Thanks.

  • @borisclark4136
    @borisclark4136 19 วันที่ผ่านมา

    Honestly, fantastic. Coming from a background where I can work with NPM, this is an excellent tutorial.

  • @Sergatx
    @Sergatx 5 หลายเดือนก่อน +1

    Awesome, I’ll have to actually watch this course soon, I’m still learning some JS. From what I’ve seen online, lot of the content surrounding Htmx makes it seem like it’s not a serious thing.

  • @JavedURRehman
    @JavedURRehman 4 หลายเดือนก่อน

    Thanks Brad, this is really a great introduction of HTMX.

  • @The-Untitled-One
    @The-Untitled-One 5 หลายเดือนก่อน +11

    TH-cam Intro Tutorials are a requirement nowadays for people who cant even understand the documentation.
    Videos like this actually explain what you should/and should not do and I appreciate that. ❤
    If more tutorials are done like this first, developers will understand the documentation better. Then they will he able to use these "steel lego bricks" to build "tools" to build components that (feel) very easy to reuse.
    You are the first best teacher on these things and I appreciate that. ❤ Thank you. ❤️

  • @rangabharath4253
    @rangabharath4253 5 หลายเดือนก่อน

    Impressive as always Brad. Just want to notify the fellow developers if you are facing an issue while running the project as fetch is not defined. Please install node-fetch package and import it in server.js.
    import fetch from "node-fetch";
    Thanks

  • @NNNedlog
    @NNNedlog 5 หลายเดือนก่อน

    I just finished watching the tutorial. Thanks a lot for these videos sir, I really appreciate you and your efforts

  • @donovan8031
    @donovan8031 5 หลายเดือนก่อน

    Thanks Brad, been curious about HTMX.

  • @MrPanzerDragoon
    @MrPanzerDragoon 5 หลายเดือนก่อน +2

    Thanks for posting this!

  • @azizkira7505
    @azizkira7505 5 หลายเดือนก่อน

    Happy new year 🎉🎉
    And thanks a lot because of you i learn dev the way it's supposed to be ❤❤❤❤❤

  • @paulthomas1052
    @paulthomas1052 5 หลายเดือนก่อน

    Thanks for another great demo !

  • @jamesbell8148
    @jamesbell8148 5 หลายเดือนก่อน +1

    The man is backkkkk 😊

  • @prashlovessamosa
    @prashlovessamosa 5 หลายเดือนก่อน

    Happy New Year Brad

  • @user-zs6bp4qu8j
    @user-zs6bp4qu8j 5 หลายเดือนก่อน

    Great content! Thank you for this tutorial. Happy New Year. Do you have tutorials for framework agnostic components ? Like say LitElement or Adobe Spectrum ?

  • @alnahian2003
    @alnahian2003 5 หลายเดือนก่อน +1

    New Year started with this big ka-baooom from Brad
    Thanks so much for making the first day of the year so special

  • @evanter8180
    @evanter8180 3 หลายเดือนก่อน +1

    Thank you for this amazing tutorial.
    I think you could explore more the potential of HTMX and Django in another tutorial, showing how to manipulate fetched data with jinja or post processing after a POST request.
    A CRUD application with python, django and htmx will be welcome.

  • @Andy-vh3ns
    @Andy-vh3ns 5 หลายเดือนก่อน +1

    This is awesome, thank you for sharing! =)

  • @TomNook.
    @TomNook. 5 หลายเดือนก่อน

    Happy new year Brad

  • @nftsasha
    @nftsasha 3 หลายเดือนก่อน

    Really great, thanks dude!

  • @matteyahmed8956
    @matteyahmed8956 4 หลายเดือนก่อน

    Great HTMX Crash Course . **thumbs up**

  • @dee.s.4513
    @dee.s.4513 5 หลายเดือนก่อน +5

    A book fitted into a 58 min video. HTMX is really amazing; hope there are no caveates. The code you give is so multi-utility. Thank you Brad! (Would be so happy to see more on Express.js from you.)🌻

    • @abhinavadarsh7150
      @abhinavadarsh7150 5 หลายเดือนก่อน

      Book(Hypermedia systems) is more than htmx tutorial. Its about what hypermedia is? why we should use it? What REST really means...

  • @tomasnovellino5980
    @tomasnovellino5980 4 หลายเดือนก่อน

    That's a great video. I loved it. I kinda don't like the fact you still have to kinda pre-render or generate front-end HTML(X) code from the back-end.
    But I can also see how a multi tiered app can have a pseudo back-end just as a bridge between front-end and proper backend responses.
    I can't wait to try it

  • @soumadip_skyy_banerjee
    @soumadip_skyy_banerjee 5 หลายเดือนก่อน +1

    Happy New Year sensei 🎊

  • @gnuter3000
    @gnuter3000 5 หลายเดือนก่อน

    Mr Traversy! can you read my mind? I needed this htmx intro from YOU!!! Over the years I learned a lot from you. By the way: your voice sounds like having a cold?!

  • @Rajisunusi
    @Rajisunusi 5 หลายเดือนก่อน

    I was about to email you and recommend this crash course.

  • @LalitKumawat53
    @LalitKumawat53 5 หลายเดือนก่อน

    Happy New Year! 🎉

  • @scoppyeah
    @scoppyeah 5 หลายเดือนก่อน

    Brilliant as always

  • @vectoralphaAI
    @vectoralphaAI 4 หลายเดือนก่อน +1

    This is cool. Anything that lets me not write any JS is a plus. Man, i hate JavaScript.

  • @peterkulik5943
    @peterkulik5943 5 หลายเดือนก่อน +2

    Everywhere I hear about "no-js," "0% js," etc.
    Is htmx suitable for enterprise-level web applications?
    Can someone provide an example where htmx is used with a normal datagrid-like functionality?
    I'm not referring to a basic table but rather features such as column resizing, drag-and-drop movement, etc. Something like AgGrid.

  • @demystifyingdev
    @demystifyingdev 5 หลายเดือนก่อน

    Thanks for doing this... just what people need to progress beyond the htmx example page and/or learn python for backend... question: have you considered Astro partials as "backend" for HTMX???

  • @markg1netsg
    @markg1netsg 4 หลายเดือนก่อน

    Hey Brad, great tutorials as per usual, quick question, if the form is updating some other part of the page like adding an item to a list, how do you clear out the form with htmx after updating the list - thanks

  • @ehabbustami7691
    @ehabbustami7691 5 หลายเดือนก่อน

    thank you very much for a very useful course. It would a great addition to have another course on both HTMX and Alpine.js from your experience how to get the best of these two libraries.

  • @LongJourneys
    @LongJourneys 5 หลายเดือนก่อน +1

    YASSS I'm loving HTMX so far. I'm trying to move away from stuff like React/Vue as much as possible.

  • @PhilParadis
    @PhilParadis 4 หลายเดือนก่อน

    Very nice intro; I’ve seen others use it in videos but none yet who explained it as well or as thoroughly.
    PS The regex for email addresses is outdated now ICANN has allowed vanity TLDs; there are now plenty of TLDs >4 characters.

  • @owenwexler7214
    @owenwexler7214 4 หลายเดือนก่อน +4

    Excellent video and a very good primer for HTMX.
    Very important note: anyone using HTMX to make a user-facing production project that takes user input should use a templating system that escapes user input to send the HTML as part of whatever backend stack they choose. res.send()ing raw HTML in strings is a big XSS vulnerability, as someone could easily inject a tag that does bad things into unescaped user input.

    • @PaulSpades
      @PaulSpades 4 หลายเดือนก่อน

      User input needs to be sanitised before it gets stored, in your backend controller. All input checks need to be performed on the server, not in the browser - because all users and malicious agents have full control of their browser (not just a text input), including js scripts. Escaping text input twice is also a common problem in inexperienced projects.

  • @harpo187bling
    @harpo187bling 5 หลายเดือนก่อน

    Thanks Brad!

  • @ukaszzbrozek6470
    @ukaszzbrozek6470 5 หลายเดือนก่อน

    Thank you for the tutorial ! It was very interesting.
    We should think of HTMX as a replacement of back end templates 🤔

  • @user-tg8yf7sg8g
    @user-tg8yf7sg8g 5 หลายเดือนก่อน

    Great Brad ! A quick question - Since we don't use JS at client side , there is no way to do some client validations ? Lets say , we want to validate email format at client side before even hitting the server ?

  • @Woeden
    @Woeden 5 หลายเดือนก่อน

    This is so magical wtffff

  • @arijitRoyFullyStressedOut
    @arijitRoyFullyStressedOut 5 หลายเดือนก่อน

    thanks, more HTMX videos please.

  • @Hit307
    @Hit307 5 หลายเดือนก่อน +3

    Imagine using Htmx and Tailwind in your project... No comment , HTMX powerfull!💀

  • @pratiyushs381
    @pratiyushs381 5 หลายเดือนก่อน

    Happy new year

  • @Ipadstands
    @Ipadstands 2 หลายเดือนก่อน

    Thanks for the introduction. I am not a web developer and have stayed away because of the Giant Complex frameworks. Maybe certain sites like FB need those beast frame works but probably 80% of web sites do not. IMHO. So a easy to learn , expressive functionality and ease to maintain like this HTMX appears is a good thing., It would be neat to see a TH-cam tutorial building a site like this TH-cam web page I am editing this comment in. Any Takers ?

  • @HuynhLuong227
    @HuynhLuong227 5 หลายเดือนก่อน

    Thank for sharing 🎉🎉🎉

  • @StannYo
    @StannYo 5 หลายเดือนก่อน

    Thanks !
    Is htmx a good addition for the app developped in the course "PHP From Scratch 2024" ?

  • @likandokayombo
    @likandokayombo 5 หลายเดือนก่อน +1

    Helpful video

  • @pjosxyz
    @pjosxyz 3 หลายเดือนก่อน

    thanks Brad

  • @charlesbaldo
    @charlesbaldo 3 หลายเดือนก่อน

    This reminds me of the goal for originial Angular

  • @mycloudvip
    @mycloudvip 4 หลายเดือนก่อน

    Awesome content! Where can I find your courses ONLINE? Kudos!

  • @razdelovski
    @razdelovski 3 หลายเดือนก่อน

    thanks for the great tutorial
    imho, implementation of the email validation though doesn't look like a good practice - having that complex piece of markup both in the frontend and backend is an issue in case that markup needs to be updated, it would be better to use a dedicated separate element to hold the validation message and only fetch that from the backend, keeping markup and styling only in the frontend

  • @TomislavMiletic
    @TomislavMiletic 5 หลายเดือนก่อน

    Big thank you👏👏

  • @OhFega
    @OhFega 5 หลายเดือนก่อน

    Thanks Brad

  • @teaman7v
    @teaman7v 5 หลายเดือนก่อน

    Thank you for this

  • @grandpowr
    @grandpowr 5 หลายเดือนก่อน +1

    Really liking what I'm seeing, I vastly prefer this style over what Next does currently (but still a must to learn because of jobs requirements), simplicity is king always

  • @berndeckenfels
    @berndeckenfels 4 หลายเดือนก่อน +1

    Btw beware injection attacks if you render html from the server and don’t use protection there (that’s better with the automatic quoting of eg angular)

  • @AtacamaHumanoid
    @AtacamaHumanoid 4 หลายเดือนก่อน

    I saw people on Twitter regularly mocking htmx for reasons I didn't understand. I think some were saying it opens up security issues that haven't been around since the earlier days of javascript, but then I saw other people saying "nu-uh, you don't know what you're talking about" and explaining why their claims were wrong. But, after seeing that whole conversation a couple times, I gave up trying to figure out who was right because I'm trying to learn other stuff right now.

  • @m3w7ub3
    @m3w7ub3 5 หลายเดือนก่อน

    I wasn't sure if I should learn Vue or HTMX for my next project and I just happened to look at my notifications. HTMX it is.

  • @AHRienks
    @AHRienks หลายเดือนก่อน

    Brad, I would like to know the settings.json that you are using in this demo. I have seen a dozen of suggestions on StackOverflow, but I can not get it the way you have it. I want to be able to place every attribute on its own lin, if there are many, like in an input. But in other cases, where there are only 2 or 3 attributes, they can all go on one line.
    All presets do one thing or the other, but not as want it to be. What is the wrapping setting you have in VSCode? (on windows)?

  • @ChristiaanHunter
    @ChristiaanHunter 4 หลายเดือนก่อน

    what theme are you using in VS code which makes your html tags green please? (mine are blue tags) I looked though a few videos of yours but this I could not find. Thanks

  • @963design8
    @963design8 หลายเดือนก่อน +1

    I had a ton of issues even with the very first steps, try with node versions 10, 13, and 20 and got the same error: "[nodemon] app crashed - waiting for file changes before starting..." this is pretty weird

  • @_nightfall_artist
    @_nightfall_artist 4 หลายเดือนก่อน +1

    I have installed XAMPP already, Now if I install Express js Server does it cause any issues?

  • @victormendoza3295
    @victormendoza3295 5 หลายเดือนก่อน

    Isn't offline mode a problem for htmx? I'm sticking with Svelte for the frontend and I can add in HTMX as needed.

  • @prasanthyas
    @prasanthyas 5 หลายเดือนก่อน +1

    First view brother ❤