Build a High-Performance API with Next.js, Hono, Redis (2024)
Vložit
- čas přidán 5. 04. 2024
- In this video, we're going to build a pretty fast API together. Do to this, you're gonna learn how to use Hono, a leightweight web framework, Cloudflare Workers for globally distributed serverless code and Redis as a fast database.
--- Links
FastAPI on GitHub: github.com/joschan21/fastapi
Upstash Redis: console.upstash.com/login
Copypaste list: github.com/joschan21/fastapi/...
Hope you enjoyed the video! - Věda a technologie
Thank you very much for this type of content, I am glad that you left this channel precisely for this type of projects so I can study all this directly here, greetings
Amazing video Josh! Great way to introduce Hono and Cloudlare workers.
I’m starting to build an app with the same stack, but the build was failing, and I couldn’t figure out why. Finally, I found out from your video that I missed the "as never" in the default export. You’re a lifesaver!
Hey Josh, that's some cool stuff you got there. Gonna try this out in my next project.
Wow this is awesome. Learnt about searching and fast performance API. Upstash is amazing I just like it
Watching from 🇦🇿 Thank you for amazing video 🙌
love this bro thanks!
Amazing 🔥🔥
THIS GUY IS THE BEST !
Great job ! 🙂Thanks for sharing any advice on where to find other grainy background images?
Bro 75ms for a redis query? that's whack, with either Aiven or redis cloud and a GCP run docker container you can get as low as 5-8ms, I don't know what upstash is doing but that latency is horrendous
this is for multiple redis calls and all string comparisons happening on the backend as that is a much more fair basis to compare redis to postgres. Single redis call is about 2-5ms in US and europe regions and 40ms for asia pacific
@@JoshtriedupstashHmmm, but based on the code at 50:18 you only make 2 calls, one for the rank and the other for the zrange which in a zset of that size should take as you say a maximum of 5ms, at least locally.
Then you do the string comparison with JS but you are working with a n=100 array, which should be trivial because the strings are also not so long since they are just countries' names
So it should be at max 8-10ms, if you get 70+ that probably means your upstash queries are taking ~30ms to execute, in that case your bottleneck is the network and using redis instead of PG would be inconsequential.
@@deiminator2175ms supabase 😢😢😢😢😢😢😢
I think one of the issues is making a new Redis/Upstash connection during every invocation of the /search function. That’s probably 30+ ms of extra latency every search.
Instead, it should be initialized outside the /search function and it’ll get reused 99% of the time (except when new worker containers get spun up).
Amazing!!!
PNPM is awesome! I tried using the random node / npm setup I already had on my pc, then went in a rabbit hole of trying to update node with nvm for windows.... then nuked it all and just installed pnpm and ran "pnpm env use -g lts" which downloaded the latest node version and got me up and running in seconds. Damn if that's all I got from this it was worth it
Thank you Josh
I'll take you up on the pnpm simlinks video offer 😄
would love to see a video on pnpm, i am using npm but as you mentioned that it helps in caching. Make a video on pnpm if possible.
Hey Josh, Thank you so much. a friend from 48:10
Awesome stuff! Any reason for using pnpm over bun?
Helpful, Thank you for amazing content
I like this from cloudflare with hono
Can you make video about your extensions, I never see you import stuff etc. I dont manage to find these for this stack :P
still do get the cors error on yarn dev and also deployment any sols josh? or anyone?
Hono 🤘
does bun also use symljnks to reduce downloads like pnpm?
My site keeps crashing coz I have such a slow search (600ms-2sec) and too many users.
Did I mention its Django.
Can the basic code also be implemented Server Side?
Can we use that in sever actions ?
I have two questions if anyone could help me(Ik they are silly but anyways):
1) Why are we even exporting default app at the bottom in route.ts file?
2) Why are we not debouncing the input, because I think it's a bad approach to make a request on every input?
more videos like this sir 😁 how about creating a SaaS with this next.js + hono.js + cloudflare and redis sir
Foda!!
Thank you a lot for the video, I am wondering, do we loose server side rendering by doing this?
Ofc you do. He made the whole page 'use client'
@@RedVelocityTV oh then I am isn't that *bad* ?
@@RedVelocityTV but he had the layout.tsx file
@@frazuppi4897 it would be bad if he had other content on the page. But it was just a searchbox. Although it's better practice to have individual components use client than a whole of page.
@@RedVelocityTV what if I want to dev a real app?
But then what's the use of rank used with redis, is that something that is taken care by redis, I mean will the rank value gets increased everytime when search results matches or what?
Hey yo thanks
Can you create a search page using images like Pinterest?
🎉🤞
I didn't quite understand why put "letter by letter" in the database. Why not just have the full names and use a includes?
the upstash site really needs a dark mode
Bro used all the package managers 😅
Redis? Are you living in the different dimension?))))))
hono nononononono hono hono hono..
having Josh on your team is like having Cristiano Ronaldo in your team.
More like having Kevin De Bruyne.
this entire project could be done with cloudflare pages, cloudflare kv and cloudflare workers.
Maybe, and in java, c#, python, deno
Anything can be make in anything tech
16:36 INDIA🇮🇳 mentioned
Fuck off No one cares
28:35 India 🇮🇳 Mentioned
So?
@@defender2212 nothing 😂😂
You're cringe dude do you see anyone from azerbaijan doing this sh*t?
Research what is "FastApi" then clickbait !🤬
Long videos without timestamps 👎
No timestamp = a NO GO
Nextjs itself a garbage framework.. I don't believe the video thumbnail
But the makers of react recommends them
If anyone is facing difficulty in running it using npm
First : Run npm i tsx
Second : npx tsx src/lib/seed.ts