Build a High-Performance API with Next.js, Hono, Redis (2024)

Sdílet
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

Komentáře • 75

  • @404-not-found-service
    @404-not-found-service Před 3 měsíci +3

    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

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

    Amazing video Josh! Great way to introduce Hono and Cloudlare workers.

  • @ParishKhan
    @ParishKhan Před měsícem +2

    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!

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

    Hey Josh, that's some cool stuff you got there. Gonna try this out in my next project.

  • @Johnny-rf4iu
    @Johnny-rf4iu Před 3 měsíci

    Wow this is awesome. Learnt about searching and fast performance API. Upstash is amazing I just like it

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

    Watching from 🇦🇿 Thank you for amazing video 🙌

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

    love this bro thanks!

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

    Amazing 🔥🔥

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

    THIS GUY IS THE BEST !

  • @RatherBeCancelledThanHandled

    Great job ! 🙂Thanks for sharing any advice on where to find other grainy background images?

  • @deiminator2
    @deiminator2 Před 3 měsíci +16

    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

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

      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

    • @deiminator2
      @deiminator2 Před 3 měsíci +4

      ​@@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.

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

      ​@@deiminator2175ms supabase 😢😢😢😢😢😢😢

    • @RMarcus05
      @RMarcus05 Před 3 měsíci +9

      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).

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

    Amazing!!!

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

    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

  • @nocturno7887
    @nocturno7887 Před 28 dny

    Thank you Josh

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

    I'll take you up on the pnpm simlinks video offer 😄

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

    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.

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

    Hey Josh, Thank you so much. a friend from 48:10

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

    Awesome stuff! Any reason for using pnpm over bun?

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

    Helpful, Thank you for amazing content

  • @Deus-lo-Vuilt
    @Deus-lo-Vuilt Před 2 měsíci

    I like this from cloudflare with hono

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

    Can you make video about your extensions, I never see you import stuff etc. I dont manage to find these for this stack :P

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

    still do get the cors error on yarn dev and also deployment any sols josh? or anyone?

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

    Hono 🤘

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

    does bun also use symljnks to reduce downloads like pnpm?

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

    My site keeps crashing coz I have such a slow search (600ms-2sec) and too many users.
    Did I mention its Django.

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

    Can the basic code also be implemented Server Side?

  • @user-fg7sm9sq1l
    @user-fg7sm9sq1l Před 3 měsíci

    Can we use that in sever actions ?

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

    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?

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

    more videos like this sir 😁 how about creating a SaaS with this next.js + hono.js + cloudflare and redis sir

  • @wallacesilva6087
    @wallacesilva6087 Před 3 měsíci +1

    Foda!!

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

    Thank you a lot for the video, I am wondering, do we loose server side rendering by doing this?

    • @RedVelocityTV
      @RedVelocityTV Před 3 měsíci +1

      Ofc you do. He made the whole page 'use client'

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

      @@RedVelocityTV oh then I am isn't that *bad* ?

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

      @@RedVelocityTV but he had the layout.tsx file

    • @RedVelocityTV
      @RedVelocityTV Před 3 měsíci +1

      @@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.

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

      @@RedVelocityTV what if I want to dev a real app?

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

    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?

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

    Hey yo thanks

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

    Can you create a search page using images like Pinterest?

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

    🎉🤞

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

    I didn't quite understand why put "letter by letter" in the database. Why not just have the full names and use a includes?

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

    the upstash site really needs a dark mode

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

    Bro used all the package managers 😅

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

    Redis? Are you living in the different dimension?))))))

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

    hono nononononono hono hono hono..

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

    having Josh on your team is like having Cristiano Ronaldo in your team.

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

      More like having Kevin De Bruyne.

  • @rtorcato
    @rtorcato Před 3 měsíci +1

    this entire project could be done with cloudflare pages, cloudflare kv and cloudflare workers.

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

      Maybe, and in java, c#, python, deno
      Anything can be make in anything tech

  • @AnimelifeYT
    @AnimelifeYT Před 3 měsíci +25

    16:36 INDIA🇮🇳 mentioned

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

    Research what is "FastApi" then clickbait !🤬

  • @RedVelocityTV
    @RedVelocityTV Před 3 měsíci +7

    Long videos without timestamps 👎

  • @Alex-bc3xe
    @Alex-bc3xe Před 2 měsíci

    No timestamp = a NO GO

  • @Mr.BinarySniper
    @Mr.BinarySniper Před 2 měsíci

    Nextjs itself a garbage framework.. I don't believe the video thumbnail

  • @codewithaliii
    @codewithaliii Před 3 měsíci +1

    If anyone is facing difficulty in running it using npm
    First : Run npm i tsx
    Second : npx tsx src/lib/seed.ts