I Stopped Using Express.js: Because Bun and Hono 🔥

Sdílet
Vložit
  • čas přidán 6. 06. 2024
  • Express has been around for almost as long as node has existed. It’s an awesome framework, it’s how I learned to make web servers in node and how i’ve been teaching people to make web servers for the past 8 years.
    But it’s time to move on, because the alternatives are just so much better. It’s mind blowing how much the web has changed recently.
    Chapters:
    0:00​ Hono
    0:42 Bun Server
    1:52 Routing
    3:33 Streaming
    4:18 Middleware
    4:50 JSX
    6:32 Testing
    8:21 Validation
    Help support me make more videos: ko-fi.com/meechward
    🔗
    My Website: www.sammeechward.com
    Instagram: / meech_ward
    TikTok: / meech.s.ward
    X: / meech_ward
    Threads: www.threads.net/@meech_ward
    Github: github.com/orgs/meech-ward
  • Věda a technologie

Komentáře • 231

  • @raident29
    @raident29 Před 4 měsíci +7

    JS developers change frameworks more often than they take a bath.

  • @romank1ng528
    @romank1ng528 Před 4 měsíci +54

    Amazing video! I don’t know if it’s just me but: being able to write your server logic in Typescript without extra tooling, the fact you can write JSX, just amazing, my only concern with these new and better technologies is compatibility with existing libraries and packages, maybe you could do a video addressing that

  • @thequang9234
    @thequang9234 Před 4 měsíci

    amazing demonstration Sam!

  • @faahkoo
    @faahkoo Před 5 měsíci

    looks so cool! I'm gonna try it out for sure, thanks for the info!

  • @AjayYoutube-rz2so
    @AjayYoutube-rz2so Před 5 měsíci +50

    Your content is really amazing, i would love to see a vite and hono full fledged tutorial.

  • @ayushgogna9732
    @ayushgogna9732 Před 5 měsíci +17

    i wanted to use hono for a time now but bun and hono combined looks crazy fun. I think the next project will be with bun and hono

  • @hugodsa89
    @hugodsa89 Před 3 měsíci

    Dude, super well paced and explained, mint.

  • @Marujah07
    @Marujah07 Před 5 měsíci +7

    Amazing! We’re waiting for a full Tutorial ;-)

  • @davidhombe2313
    @davidhombe2313 Před 2 měsíci

    Gratefull, I'll waiting for your tutorial using Hono🤩

  • @ainulyaqin1958
    @ainulyaqin1958 Před 2 měsíci

    that absolutely look great!, would be nice to see hono - monorepo tutorial :D

  • @aldrickdev
    @aldrickdev Před 5 měsíci +5

    the use of context reminds me of how Golang Web Frameworks like Gin and Echo work. Pretty nice!

    • @gusparr28
      @gusparr28 Před 4 měsíci +2

      Same here! I was looking for this comment

  • @ArielBenichou
    @ArielBenichou Před 8 dny

    ok you've sold me!
    next project will be with hono (bun i already use :D)

  • @fullstack_journey
    @fullstack_journey Před 4 měsíci +2

    Subscribed for the hono+vite magic that you'll drop

  • @zunnoorainrafi5985
    @zunnoorainrafi5985 Před 5 měsíci +52

    Bro will you make a full stack application using Bun, so that we can learn something from your experience

    • @dinckelman
      @dinckelman Před 4 měsíci +5

      The way you can learn from this experience is if YOU make a full-stack app using Bun. His knowledge isn’t magically transferred into your head

    • @Agent_Six_
      @Agent_Six_ Před 4 měsíci

      Is it that you're not sure how full-stack works? Here.
      OPEN THE TERMINAL AND RUN
      > mkdir HotelTrivago
      > cd HotelTrivago
      > bun init
      > bun install express cors
      CREATE FILE CALLED "server.js" IN THE "HotelTrivago" FOLDER THEN BUILD AN API THAT SPITS OUT SOME TEXT USING THE BELOW CODE
      START CODE BLOCK
      const express = require('express');
      const cors = require('cors');
      const app = express();
      app.use(cors());
      app.get('/', (req, res) => {
      res.send("Trivago");
      });
      app.listen(3000, () => {
      console.log('listening on port 3000');
      });
      END CODE BLOCK
      BACK TO THE TERMINAL AND START UP THIS BAD BOY
      > bun server.js
      OPEN BROWSER AND GO TO 'localhost:3000/' AND BEHOLD, OUR SERVER/API HAS RESPONDED WITH THE WORD "Trivago"
      NOW WRITE A CLIENT APP THAT USES THIS API ENDPOINT
      CREATE AN "index.html" FILE ANYWHERE, OPEN WITH A TEXT EDITOR AND INSERT THIS MARKUP
      START MARKUP BLOCK
      async function clickityclickity() {
      let response = await fetch('localhost:3000');
      let data = await response.text();
      document.querySelector('p').innerHTML = data;
      }
      Hotel?
      Click Me
      END MARKUP BLOCK
      NOW OPEN "index.html" WITH A BROWSER
      CLICK THE BUTTON AND BEHOLD THE "Hotel?" TURNS INTO A "Trivago"
      FULL STACK, BABY

  • @mikebradbury3997
    @mikebradbury3997 Před 4 měsíci

    Great video Sam, curious as to which keyboard you're using (i'm trying to find a silent one you can't hear over a microphone), thanks!

  • @rmnkot
    @rmnkot Před 4 měsíci +6

    It would be great to see the performance part in comparison with express, fastify on node to understand the capabilities of this modern framework

    • @blender_wiki
      @blender_wiki Před 4 měsíci

      Google is your friend:
      "Node.js vs Deno vs Bun: Express hello world server benchmarking"

  • @exapsy
    @exapsy Před 4 měsíci

    amazing, seems like something's great is growing out of bun. im excited to see where it will go.

  • @koteelok2014
    @koteelok2014 Před 5 měsíci +38

    Yo, can't wait for Hono+Vite+React setup tutorial!

    • @armandsalle8447
      @armandsalle8447 Před 5 měsíci

      I've tried a couple of time to make it works but failed! Can't wait to see the video!

    • @jarnathan-snow
      @jarnathan-snow Před 4 měsíci +4

      Man just ditch React and Client frameworks once and for all. You have JSX on the server with these. What else do you need?

    • @voidmind
      @voidmind Před 4 měsíci

      I'd love to see that too. Where I work, we use Next.js (page router) for a big web app and the DX is terrible. The dev server crashed at least one a day and take close to 2GB of memory. All I care about in Next if getServerSideProps(), so if I could use something lightweight to replace it, that would be awesome.

    • @ustav_o
      @ustav_o Před měsícem

      beth stack but hono
      ​@@jarnathan-snow

    • @alaskandonut
      @alaskandonut Před měsícem

      It’s here he just posted it. It was more of a walkthrough but so far has been very enjoyable.

  • @jjrise
    @jjrise Před 4 měsíci

    we need more Hono videos! this was great!

  • @ivv3393
    @ivv3393 Před 4 měsíci +6

    The problem with this new tech is that the industry doesn't implement it. They stick with the OG tech. So spending time learning something like that could be wasting of time sadly.

    • @wobsoriano
      @wobsoriano Před 4 měsíci +1

      yep

    • @tobeythepancake
      @tobeythepancake Před 2 měsíci +2

      It’s pretty straight forward though, anyone with react and express knowledge will pick this up in an hour.

    • @Sammysapphira
      @Sammysapphira Před měsícem +1

      It doesn't take any time to learn this if you already know express. That was the point of bun, to supercede node, express, npm, but actually fast since it runs on zig.

    • @juststudying1019
      @juststudying1019 Před měsícem +1

      JS developers are sick to be honest they always run for new things without any need, searching for the perfect library or runtime or framework and they never find one or will.
      I am a js developer but the community is just too much, and I am not against developing more libraries that are better, but not hundred of solutions for the same problem and most of them are the same

  • @lukor-tech
    @lukor-tech Před 5 měsíci

    The client/server type safety is a nice feature!

  • @harryzachariou1
    @harryzachariou1 Před 4 měsíci

    This is great! Is there support to integrate Bun into a AWS lambda runtime and Hono into an AWS lambda proxy?

  • @easywest1
    @easywest1 Před 5 měsíci

    Hono is awesome! Would love seeing more content on hono

  • @7doors847
    @7doors847 Před 5 měsíci +1

    Great, as always. ✌️

  • @Fullflexno
    @Fullflexno Před 4 měsíci

    Super Cool video! Subbed!

  • @DoudouCircus
    @DoudouCircus Před 4 měsíci

    That is very cool I usually use python for backend development but I am excited to try hono and bun

  • @misterlinuxfriendly947
    @misterlinuxfriendly947 Před 4 měsíci

    Nice intro! Well done.

  • @2xxxtrem
    @2xxxtrem Před 5 měsíci +6

    What are your thoughts on Hono vs. Elysia? What do you prefer about Hono?

  • @tinypell3ts
    @tinypell3ts Před 3 měsíci

    Great video! I would love to see a Hono, Vite, React tutorial.

  • @brunoacev
    @brunoacev Před 5 měsíci +1

    that is soo good dud, i see yesterday.

  • @WillDelish
    @WillDelish Před 5 měsíci +1

    Looove hono + bun combo. Also sprinkle some htmx and its pretty magical

  • @cyrilgeorge7818
    @cyrilgeorge7818 Před 5 měsíci +2

    You know what I have an old express project, I will try migrating it to bun + hono . Want to see what are the gotchas in this combo.

  • @haroonalbar2725
    @haroonalbar2725 Před 4 měsíci

    awesome content . subbed :)

  • @pedapudiraviteja7388
    @pedapudiraviteja7388 Před měsícem

    Which cli and cli font are you using? I'm so obsessed with the fonts, ain't I?

  • @CSkyGameGen
    @CSkyGameGen Před 4 měsíci

    Yes we would love a tutorial on vite and hono please 🙏

  • @lastink444
    @lastink444 Před měsícem

    Would be nice to see more vids on this topic

  • @DaxSudo
    @DaxSudo Před 4 měsíci

    yea i tried this ~ 12 - 18 months ago but couldnt stick w it for larger stuff glad the ecosystem has improved w it

  • @Hut-181
    @Hut-181 Před 2 měsíci

    What about the server folder you created at the start, Sam? 😁

  • @kodekorp2064
    @kodekorp2064 Před 5 měsíci +17

    While bun is great, Bun is still reliant on one primary developer.
    I love bun and will continue to use it for smaller projects or side projects, but until it becomes reliable longevity wise, I prefer to stay with the standard tech for now for business focused work.

    • @WillDelish
      @WillDelish Před 5 měsíci +5

      Luckily hono supports node too

    • @uchennaofoma4624
      @uchennaofoma4624 Před 4 měsíci

      ​@@WillDelishtrue

    • @juststudying1019
      @juststudying1019 Před měsícem

      JS developers are sick to be honest they always run for new things without any need, searching for the perfect library or runtime or framework and they never find one or will.
      I am a js developer but the community is just too much, and I am not against developing more libraries that are better, but not hundred of solutions for the same problem and most of them are the same

  • @damianjanus1990
    @damianjanus1990 Před 4 měsíci

    More bun and Hono please! Maybe build full rest api with swagger, mongo and some sort of autorization it is be nice

  • @jaymartinez311
    @jaymartinez311 Před měsícem +1

    Tutorial for hono/vite if possible. Idk if you already did it but thanks ahead of timeif you are thinking about it.

  • @sujjee
    @sujjee Před 5 měsíci +2

    Hey sam please make a comparison between Hono and ElysiaJS

  • @anasaitzouinet9699
    @anasaitzouinet9699 Před 25 dny

    im always wanting to try bun , but i don't know if its stable for production yet or not

  • @VictorMongi
    @VictorMongi Před 5 měsíci +3

    Hello sam, how about ElysiaJs?

  • @zlatkoiliev8927
    @zlatkoiliev8927 Před 4 měsíci +1

    I am absolutely blown away! 😮 This is so much better than Node and Express! If they come up with a framework like Nest or Adonis with bun and hono, it will absolutely dominate the backend world!

    • @blkgames1447
      @blkgames1447 Před 4 měsíci

      Did you ever test elysia i'm looking for something performant and reliable

  • @brtk7
    @brtk7 Před 4 měsíci

    Could you compare Hono and tRPC? It appears they both have similar capabilities. Thanks!

  • @maguiskader7771
    @maguiskader7771 Před 5 měsíci

    Outstanding 😊

  • @ChrisJaydenBeats
    @ChrisJaydenBeats Před 3 měsíci

    Hono is beautiful. Been using it so much.

  • @gryg666
    @gryg666 Před 5 měsíci +1

    Hah, I'm doing the same! With drizzle orm and vitest it's perfect stack for me.

  • @darkoplax7688
    @darkoplax7688 Před 5 měsíci +5

    I wish Bun had Windows and Nextjs support ... hopefully soon

  • @Bookingtr
    @Bookingtr Před 4 měsíci

    With qwik can be good solution for full stack, how about SSR, IRS kinda things like NextJS. Thanks for tutorial, keep it up 🎉

  • @flipperiflop
    @flipperiflop Před 5 měsíci +1

    Damn, Hono looks incredible!

  • @aprilm2941
    @aprilm2941 Před 5 měsíci +2

    You had me at “Because Bun” it’s always about the bun

  • @debadipti
    @debadipti Před 5 měsíci +3

    Hey Sam! Great video as always! I am curious how this works with bigger projects where I have JSX templates and layouts just like Next, but without all the hassle, it just renders HTML. I would appreciate if you could make a longer video on that.

    • @SamMeechWard
      @SamMeechWard  Před 5 měsíci +3

      It’s not opinionated like next, so you would just have to create your own layout components. You could make it work however you want but you wouldn’t get default caching behaviour or default 404 or error pages.

    • @debadipti
      @debadipti Před 5 měsíci +2

      I don't think 404 pages or error pages are that much difficult to handle. But I can't say the same about caching. Caching seems very hard. If you could make a video on caching different parts of your website i.e mixing database caching, CDN caching and all that good stuff, that would be really good. @@SamMeechWard

  • @kurniamassidik5798
    @kurniamassidik5798 Před 17 dny

    since i only new about express js, could be more risk to implement this to my project, but i will try my best to use it from my next project

  • @ChristianEscalante
    @ChristianEscalante Před 4 měsíci

    I would like to see this working with vite, it sounds interesting.

  • @uchennaofoma4624
    @uchennaofoma4624 Před 4 měsíci

    One of the issues i still have with the validator is that your validator has to return strings (if you try a number itll just throw a ts error)

  • @TechnologicNick
    @TechnologicNick Před 5 měsíci +1

    I just had to rewrite a small webapp because Flask doesn't handle SSE nicely, and Bun + Hono works so much better. Thanks a lot for showing this setup!

  • @bipinsingh9318
    @bipinsingh9318 Před 5 měsíci +1

    Great content

  • @gadgetboyplaysmc
    @gadgetboyplaysmc Před 4 měsíci +5

    Have you tried Elysia? The DX is really amazing

    • @jarnathan-snow
      @jarnathan-snow Před 4 měsíci

      it is not. Have you tried nesting guards?

    • @killerdroid99
      @killerdroid99 Před 4 měsíci

      ​@@jarnathan-snowyh that's a chore but I prefer beforehandle function

  • @zb2747
    @zb2747 Před 3 měsíci

    Being able to serve HTML using JSX instead of EJS or other template language is so good!!!

  • @BunnyMolester
    @BunnyMolester Před měsícem

    Hey Sam, how can we connect to a database while calling APIs

  • @blkgames1447
    @blkgames1447 Před 4 měsíci

    What about elysia? Can you also review that project?

  • @ayushgogna9732
    @ayushgogna9732 Před 5 měsíci +1

    can you also make a video on elysiajs and bun

  • @cartermckay1509
    @cartermckay1509 Před 4 měsíci

    Thanks!

  • @mnchabel8402
    @mnchabel8402 Před 3 měsíci

    Wow, this is nice I love hono

  • @crimsonautumnsun
    @crimsonautumnsun Před 4 měsíci

    Is it sending a Server Sent Event stream with the stream.write stuff?

  • @sam3k
    @sam3k Před 4 měsíci

    Would love to see the version with client side

  • @austinmudd6372
    @austinmudd6372 Před 5 měsíci +3

    Could you make a video integrating tRPC with hono?

  • @kasper369
    @kasper369 Před 2 měsíci

    do you think hono is production read?

  • @christianangelomsulit3759
    @christianangelomsulit3759 Před 2 měsíci

    Is Bun.serve() necessary? when already using bun run --hot src/index.ts??

  • @danvilela
    @danvilela Před 2 měsíci +1

    Hono seems cool, but after Sveltekit I can’t see me using another tool for api

  • @kumarvishalben
    @kumarvishalben Před 5 měsíci +1

    This is DOPE

  • @ronaldtejada8846
    @ronaldtejada8846 Před měsícem

    I'm interested in hono + react app and how the live together and interact

  • @Erandros
    @Erandros Před 4 měsíci

    Do you get any memory leaks?

  • @ArielBenichou
    @ArielBenichou Před 8 dny

    do you have a video about exposing an ML (AI) model thourgh a JS/TS API?

  • @JohnMcclaned
    @JohnMcclaned Před 5 měsíci +8

    How do you feel about there only being basically 1 contributor to bun? Do you still recommend bun for production even though it doesn't pass the bus test?

    • @perc-ai
      @perc-ai Před 3 měsíci +2

      Nope use deno …

  • @swikarsharma3118
    @swikarsharma3118 Před 4 měsíci

    never tried hono but tried elysia i was a pleasant experience

  • @NattaWang
    @NattaWang Před 4 měsíci

    bun update command not update version numbers in package.json in my local, do you know how to fix it?

  • @natainditama
    @natainditama Před 5 měsíci

    How about koa js. It's like similar with hono right ?

  • @shouryansharma
    @shouryansharma Před 14 dny

    error: Cannot find module "react/jsx-dev-runtime" from "/Users/sam/Documents/server/src/app.tsx"

  • @saadowain3511
    @saadowain3511 Před 5 měsíci

    Yes please make tutorial with react and hono

  • @zenithdevgroup
    @zenithdevgroup Před 4 měsíci

    Have they solved Bun not working with SSH-ed25519? I couldn't use Bun due to my SSH dependencies not working with it.

  • @ajinkyax
    @ajinkyax Před měsícem

    Thanks now I understand why Hono is better that ElisiaJS too 🎉

  • @returnZeroo
    @returnZeroo Před 5 měsíci +1

    waiting to watch a vite and hono full fledged tutorial

  • @patrick_kabwe
    @patrick_kabwe Před 5 měsíci +2

    Hi Sam,
    have you built a production app with bun? if yes how has been your experience?

    • @SamMeechWard
      @SamMeechWard  Před 5 měsíci +2

      It’s been awesome, only great things to say about using bun. I’ve been deploying to fly.io.

    • @patrick_kabwe
      @patrick_kabwe Před 5 měsíci

      @@SamMeechWard Wow! will definitely try it. Thanks

    • @mdmathewdc
      @mdmathewdc Před 5 měsíci +2

      Definites on what a production app is - if you mean an app with thousands of live users, then Bun isn't stable for that.

    • @patrick_kabwe
      @patrick_kabwe Před 5 měsíci

      @@mdmathewdc Please share your experience.

    • @blender_wiki
      @blender_wiki Před 4 měsíci +1

      We have few public API running with bun, it is just great.

  • @makisetakashi
    @makisetakashi Před 5 měsíci

    how to handle concurrency or multithread using Hono ?

  • @yoskokleng3658
    @yoskokleng3658 Před 4 měsíci

    laravel with vue js using inertia js is stll awesome

  • @elephant_888
    @elephant_888 Před 5 měsíci

    There’s a Safari bug that prevents Bun web servers from successfully sending binary downloads like images and files to that web browser. 😢

  • @crimsonautumnsun
    @crimsonautumnsun Před 4 měsíci

    How does it compare to Elysia?

  • @vickylance
    @vickylance Před 4 měsíci

    what about security like helmet plugin?

  • @danlazer741
    @danlazer741 Před 2 měsíci

    I do trpc with zod and I don't get why I should use hono or bun unless there's a trpc hono adapter

    • @danlazer741
      @danlazer741 Před 2 měsíci

      And the fact I get 0 users lol

  • @oleksiistri8429
    @oleksiistri8429 Před 4 měsíci

    idea about having context argument instead of req, res is actually convenient

  • @StarsOfMinecrafttr
    @StarsOfMinecrafttr Před 5 měsíci +2

    you may want to switch rust/axum it also looks like express but much faster and lightweight than ever, also supports multithreading with tokio

  • @MattChinander
    @MattChinander Před 2 měsíci

    Where can this be deployed?

  • @domw2391
    @domw2391 Před 4 měsíci +1

    How hono vs Elysia?

  • @ajdinpipo08
    @ajdinpipo08 Před 5 měsíci +1

    It's kinda mix of express.js and golang. But anyway looks so cool and clean

  • @DamirSecki
    @DamirSecki Před 5 měsíci +3

    You are going so fast... is hard to follow... but none the less... very valuable content. thanks

    • @blender_wiki
      @blender_wiki Před 4 měsíci

      In YT you have a great option to slow down the playback speed of a video and also an advanced button called "pause".🤷🏿‍♀️🤷🏿‍♀️🤷🏿‍♀️

    • @DamirSecki
      @DamirSecki Před 4 měsíci +1

      @@blender_wiki will this magic button also give all the context that I need? Is not the speed of the video that is fast... but the flow... but thanks for such a lovely condesending and mansplaining comment! We def. need more of these!

  • @trejohnson7677
    @trejohnson7677 Před 4 měsíci

    Waku synergizes well af

  • @1apostoli
    @1apostoli Před 4 měsíci

    Someone lmk what extension is showing errors right from inline