I Stopped Using Express.js: Because Bun and Hono 🔥
Ғылым және технология
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
Пікірлер: 238
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
JS developers change frameworks more often than they take a bath.
@jotaroisdarius1918
3 күн бұрын
yeah this is getting rediculous lol
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
amazing demonstration Sam!
Amazing! We’re waiting for a full Tutorial ;-)
Your content is really amazing, i would love to see a vite and hono full fledged tutorial.
looks so cool! I'm gonna try it out for sure, thanks for the info!
Dude, super well paced and explained, mint.
Gratefull, I'll waiting for your tutorial using Hono🤩
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
4 ай бұрын
yep
@tobeythepancake
2 ай бұрын
It’s pretty straight forward though, anyone with react and express knowledge will pick this up in an hour.
@Sammysapphira
2 ай бұрын
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
Ай бұрын
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
the use of context reminds me of how Golang Web Frameworks like Gin and Echo work. Pretty nice!
@gusparr28
5 ай бұрын
Same here! I was looking for this comment
Subscribed for the hono+vite magic that you'll drop
amazing, seems like something's great is growing out of bun. im excited to see where it will go.
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!
that absolutely look great!, would be nice to see hono - monorepo tutorial :D
Yo, can't wait for Hono+Vite+React setup tutorial!
@armandsalle8447
5 ай бұрын
I've tried a couple of time to make it works but failed! Can't wait to see the video!
@jarnathan-snow
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
4 ай бұрын
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
Ай бұрын
beth stack but hono @@jarnathan-snow
@alaskandonut
Ай бұрын
It’s here he just posted it. It was more of a walkthrough but so far has been very enjoyable.
we need more Hono videos! this was great!
ok you've sold me! next project will be with hono (bun i already use :D)
Great, as always. ✌️
Bro will you make a full stack application using Bun, so that we can learn something from your experience
@dinckelman
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_
5 ай бұрын
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
Hono is awesome! Would love seeing more content on hono
The client/server type safety is a nice feature!
Nice intro! Well done.
that is soo good dud, i see yesterday.
This is great! Is there support to integrate Bun into a AWS lambda runtime and Hono into an AWS lambda proxy?
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
5 ай бұрын
Google is your friend: "Node.js vs Deno vs Bun: Express hello world server benchmarking"
What are your thoughts on Hono vs. Elysia? What do you prefer about Hono?
Super Cool video! Subbed!
Yes we would love a tutorial on vite and hono please 🙏
That is very cool I usually use python for backend development but I am excited to try hono and bun
Great video! I would love to see a Hono, Vite, React tutorial.
Would be nice to see more vids on this topic
Which cli and cli font are you using? I'm so obsessed with the fonts, ain't I?
Outstanding 😊
awesome content . subbed :)
yea i tried this ~ 12 - 18 months ago but couldnt stick w it for larger stuff glad the ecosystem has improved w it
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.
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
5 ай бұрын
Luckily hono supports node too
@uchennaofoma4624
5 ай бұрын
@@WillDelishtrue
@juststudying1019
Ай бұрын
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
You had me at “Because Bun” it’s always about the bun
Damn, Hono looks incredible!
Looove hono + bun combo. Also sprinkle some htmx and its pretty magical
@SamMeechWard
5 ай бұрын
Don’t forget drizzle
More bun and Hono please! Maybe build full rest api with swagger, mongo and some sort of autorization it is be nice
What about the server folder you created at the start, Sam? 😁
Hono is beautiful. Been using it so much.
Could you compare Hono and tRPC? It appears they both have similar capabilities. Thanks!
Hello sam, how about ElysiaJs?
im always wanting to try bun , but i don't know if its stable for production yet or not
Tutorial for hono/vite if possible. Idk if you already did it but thanks ahead of timeif you are thinking about it.
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
4 ай бұрын
Did you ever test elysia i'm looking for something performant and reliable
Is it sending a Server Sent Event stream with the stream.write stuff?
This is DOPE
Great content
I wish Bun had Windows and Nextjs support ... hopefully soon
Hey sam please make a comparison between Hono and ElysiaJS
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!
Hah, I'm doing the same! With drizzle orm and vitest it's perfect stack for me.
Is Bun.serve() necessary? when already using bun run --hot src/index.ts??
What about elysia? Can you also review that project?
Do you get any memory leaks?
How about koa js. It's like similar with hono right ?
do you think hono is production read?
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)
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
Please more of hono.js 🙂
Hey Sam, how can we connect to a database while calling APIs
Thanks!
With qwik can be good solution for full stack, how about SSR, IRS kinda things like NextJS. Thanks for tutorial, keep it up 🎉
can you also make a video on elysiajs and bun
Hono seems cool, but after Sveltekit I can’t see me using another tool for api
I would like to see this working with vite, it sounds interesting.
Being able to serve HTML using JSX instead of EJS or other template language is so good!!!
never tried hono but tried elysia i was a pleasant experience
This looks great for use with HTMX with built in JSX
Wow, this is nice I love hono
Yes please make tutorial with react and hono
bun update command not update version numbers in package.json in my local, do you know how to fix it?
Have you tried Elysia? The DX is really amazing
@jarnathan-snow
4 ай бұрын
it is not. Have you tried nesting guards?
@killerdroid99
4 ай бұрын
@@jarnathan-snowyh that's a chore but I prefer beforehandle function
Would love to see the version with client side
How does it compare to Elysia?
Thanks now I understand why Hono is better that ElisiaJS too 🎉
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
6 ай бұрын
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
6 ай бұрын
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
I'm interested in hono + react app and how the live together and interact
how to handle concurrency or multithread using Hono ?
Have they solved Bun not working with SSH-ed25519? I couldn't use Bun due to my SSH dependencies not working with it.
how does this compare to fastify?
what about security like helmet plugin?
do you have a video about exposing an ML (AI) model thourgh a JS/TS API?
Could you make a video integrating tRPC with hono?
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
4 ай бұрын
Nope use deno …
Someone lmk what extension is showing errors right from inline
Waku synergizes well af
laravel with vue js using inertia js is stll awesome
How hono vs Elysia?
waiting to watch a vite and hono full fledged tutorial
error: Cannot find module "react/jsx-dev-runtime" from "/Users/sam/Documents/server/src/app.tsx"
Where can this be deployed?
Are you able to run a successful docker build with Bun? I've been bashing my head for the past 6 versions
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
3 ай бұрын
And the fact I get 0 users lol
It's kinda mix of express.js and golang. But anyway looks so cool and clean
how to make something like nodemon with hono + node