Choosing a Rust Web Framework

แชร์
ฝัง
  • เผยแพร่เมื่อ 8 ม.ค. 2025
  • The Rust web ecosystem has a lot to offer, but a lot of it is in crates you'll have to discover and choose to use. In this video we cover the choice I made to build the new Rust Adventure API in: Axum.
    arewewebyet: www.arewewebye...

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

  • @jaysistar2711
    @jaysistar2711 ปีที่แล้ว +40

    If you go to other languages and frameworks, the Bevy ECS-like query that you're talking about is called "dependency injection" in this context. I like it as well.

    • @ValAllenSamonte
      @ValAllenSamonte ปีที่แล้ว +4

      yeah i was like "isn't just dependency injection?"

    • @josearmas1511
      @josearmas1511 ปีที่แล้ว +2

      I was looking for a nestJS-like framework in rust, thanks for the context

    • @usmanjamil3934
      @usmanjamil3934 ปีที่แล้ว +1

      @@josearmas1511 have you find similar to nestjs in rust ?

  • @realsong-fake
    @realsong-fake ปีที่แล้ว +35

    Most of the rust web frameworks are similar. They only have tiny difference on surface level api and under the hood they are mostly hyper/tokio.

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

      Youre the first youtube user?

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

      @@artemxyi I think so haha

  • @michaeljamescollins6800
    @michaeljamescollins6800 ปีที่แล้ว +2

    thank you for your effort. love watching your vids and glad they will be recorded online for years to come

  • @altairbueno5637
    @altairbueno5637 ปีที่แล้ว +15

    Axum is hands down the best web framework for rust. Its also fast to compile and iterate

    • @romanstingler435
      @romanstingler435 ปีที่แล้ว +5

      Absolutely and David (developer) is a great guy

    • @LolLol-ig5tb
      @LolLol-ig5tb ปีที่แล้ว

      why I should use Axum instead Actix-Web?

    • @altairbueno5637
      @altairbueno5637 ปีที่แล้ว

      @@LolLol-ig5tb Compiles faster. No macro magic, just approachable (and clever) Rust code. Tokio ecosystem. 100% safe Rust. Great docs. Nice maintainers

    • @David-iq1kd
      @David-iq1kd ปีที่แล้ว

      Is it actor based like Actix?

    • @CalifornianViking
      @CalifornianViking ปีที่แล้ว +1

      What are the advantages over Rocket?

  • @adamglass2599
    @adamglass2599 ปีที่แล้ว +2

    i think i preferred the previous style of presentation. These last two seem to be in a hurry to get to the conclusion with lots of fast edits at the start. re: title. Is this about choosing a rust web framework or your choice of web framework for this project? More the latter.

  • @AreQ212
    @AreQ212 ปีที่แล้ว +4

    I've had opportunity to work with axum as well as with poem, and from those two, I prefer second option. Axum forced me to use trait objects, which is not ideal, as not every struct can be used in that way. Also poem supports open api, so creating documentation is as easy as rust docs ;)

    • @chrisbiscardi
      @chrisbiscardi  ปีที่แล้ว

      it *is* nice that poem also chose to support Tower's Service trait

  • @SkegAudio
    @SkegAudio ปีที่แล้ว +2

    Chris, ngl, if you had a thick golden Cuban on you, the thumbnail would have you looking like a real G haha

  • @jeanchindeko5477
    @jeanchindeko5477 ปีที่แล้ว +2

    4:56 @chris Biscardi what is the CLI tool you’re using here?

  • @irlshrek
    @irlshrek ปีที่แล้ว +2

    id love a video on tower!

  • @Kragal0n
    @Kragal0n ปีที่แล้ว +1

    Railway is my fav host, super simple to setup.

  • @darknetworld
    @darknetworld ปีที่แล้ว +1

    Really I was looking using bevy and web interface. One reason is wanted to try it out as well remind of me of the old game using like ragnarok online and unreal tournament from rpg invasion mod game. It was fun days.

  • @akillersquirrel5880
    @akillersquirrel5880 ปีที่แล้ว +1

    There's always Rust on Nails, if you want rails-like

  • @coindotlol
    @coindotlol ปีที่แล้ว +1

    Love the videos and the channel chris! Are you planning to create a discord server in the near future?

    • @chrisbiscardi
      @chrisbiscardi  ปีที่แล้ว

      yup! I have a discord server for Rust Adventure that I'm currently reworking for this purpose. I'll post about it when its open to the public.

    • @chrisbiscardi
      @chrisbiscardi  ปีที่แล้ว

      Discord server invite link is in the description for tomorrow's video

  • @verified_tinker1818
    @verified_tinker1818 ปีที่แล้ว +1

    What's the sense in using Tower's load-balancing, rate-limiting, etc. when it's included in reverse proxies and load balancers? Does it reduce complexity? Genuine question.

    • @johnw.8782
      @johnw.8782 ปีที่แล้ว

      Tower allows you to build networks applications. What so you think Reverse proxies and Load Balancers are? They're network applications. So you could use a framework like Tower to build those types of applications.

    • @khuiification
      @khuiification ปีที่แล้ว +2

      @@johnw.8782 im pretty sure he meant in the context of a web framework, valid question

    • @johnw.8782
      @johnw.8782 ปีที่แล้ว

      @@khuiification I didn't say it wasn't a valid question? I gave the usage of Tower.
      In the context of a web framework, the answer is still the same. Not all services sit behind http load balancers or proxies. Not all services are infinitely scalable in the cloud. Some are snowflakes. Those services can still fail. So you would want to be able to write backoff and load balancing functionality using Tower.
      Proxies and Load Balancers are no different than any other service that can be written with a web framework. they just handle traffic in specific ways.

    • @khuiification
      @khuiification ปีที่แล้ว +2

      @@johnw.8782 well, your answer isnt relevant to the context. Also, maybe its just me but asking ”what do you think xxx and yyy are?”, insinuating that OP is in some way in the wrong for asking, is a bad way to put.
      It is also not the same at all in the context of axum. Existing libraries, middleware etc. is a major part of why this is bonus and why i believe it is mentioned. Really nothing in particular to do with load balancers and proxies.

    • @johnw.8782
      @johnw.8782 ปีที่แล้ว

      @@khuiification Well then I'm sorry that your feelings were hurt when I was answering someone else's question, but it seems you have a very narrow understanding of web programming.
      If a service receives an http request and has either 1) and internal error or 2) a downstream error, the service can either decide to continue to serve requests or not. That is what rate limiting is. That is application that be built with axum using tower middleware.
      If a service receives an http request and has to rout that request amongst a defined set of downstreams, the service can decide which downstream to route to. That is load balancing. That is application that be built with axum using tower middleware.
      Both of these can be done in a reverse proxy fashion.
      I'm not sure why you don't think that this matters in the context when the OP asked what is the use of Tower's middlewares in comparison to external load balancers and proxies?

  • @andres-hurtado-lopez
    @andres-hurtado-lopez ปีที่แล้ว

    Have you considered warp ? Instead of evaluating extractors at runtime it es evaluated at compile time.

  • @artemivasyuk1699
    @artemivasyuk1699 ปีที่แล้ว +1

    Hey Chris! What were you using to generated unique ids? Doesn't look like uuid.

    • @chrisbiscardi
      @chrisbiscardi  ปีที่แล้ว

      In this project it was ksuid, so I continued using that. ulid would be another similar choice.

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

    which one is the better option for a gaming platform's backend, Actix or Axum?

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

      both can work. my personal choice is Axum still, and Axum tends to be what I see new projects choose.

  • @charlesbcraig
    @charlesbcraig ปีที่แล้ว +1

    I’d be curious to know about rust hosting options.
    Also, do you still put nginx in front of it and pass the request on to rust like you do with PHP?

    • @chrisbiscardi
      @chrisbiscardi  ปีที่แล้ว +2

      I typically don't use something like nginx because I tend to prefer either serverless deployments or the newer generation of heroku-style container-based platforms (fly, render, etc).

    • @charlesbcraig
      @charlesbcraig ปีที่แล้ว +2

      @@chrisbiscardi maybe this is in the works already since this video series is about web apps, but a video from basic web app with db to deployment would be cool.

    • @chrisbiscardi
      @chrisbiscardi  ปีที่แล้ว +1

      @@charlesbcraig totally. When you say "basic web app" what kind of features does that have? The architecture for this series is roughly: one API + one UI server (axum/planetscale + axum/leptos), although we haven't made it to the UI yet

    • @charlesbcraig
      @charlesbcraig ปีที่แล้ว +1

      @@chrisbiscardi oh I’m thinking something simple (maybe fancier than a todo list, but nothing wrong with them either) so your architecture for the series sounds perfect!

  • @chris.dillon
    @chris.dillon ปีที่แล้ว +2

    I disagree with the YES on arewewebyet for the reason you stated in your opening. It doesn't have to be Rails but I think it essentially has to be Rails-like, which probably takes 10 years. If they ever crack this nut, this would be the first time in history a language would "work" from kernel to high-level domain. This would be exciting but I also wonder if it's possible. Go Buffalo is a good example. I like the creator, I appreciate the work but something just didn't pan out for me. I also have a similar take about microframeworks. But specifically about the language either technically enabling productivity or some kind of culture/sapir-whorf thing in the language community ... I'd really, really like to be eventually wrong on my take here like aged milk in the future. Low level language scaling where the machine is happy to high level complex projects where the human is happy. Two optimizations at once, pretty tough. 🤔

    • @chrisbiscardi
      @chrisbiscardi  ปีที่แล้ว +1

      I think overall the Yes on arewewebyet is that there are multiple frameworks that exist and work for production use cases, not that Rust "has a Rails". That said, it *is* only a matter of someone building it I think. I tend to prefer a more piecemeal approach, so looking at the features Buffalo touts I think the only one I don't have a Rust answer for off the top of my head is background jobs.
      I definitely agree that seeing a Rails-level framework for a language used in developing the Kernel would be a huge accomplishment... and a lot of work

  • @johnw.8782
    @johnw.8782 ปีที่แล้ว

    Good video. I prefer Axum as well (compared to Rocket and Actix). It just makes more sense to me.

  • @morgomi
    @morgomi ปีที่แล้ว +3

    what a coincidence. Yesterday, I was going to start a project with my friend, and we were looking for a framework. We discussed a lot about Rocket, Actix, Gotham now we're going to discuss Axum then. 🤣

    • @altairbueno5637
      @altairbueno5637 ปีที่แล้ว +2

      Imho axum is the best. Fast compile times, plain simple architecture and tokio integration (tracing, bytes, metalio, tower, hyper,…)

    • @morgomi
      @morgomi ปีที่แล้ว +1

      ​@@altairbueno5637 I've just started from scratch using Axum. I hope their documentation is good.😄

    • @altairbueno5637
      @altairbueno5637 ปีที่แล้ว +1

      @@morgomi top tier docs.rs. Also, lots of examples. Error handling examples were co-authored by me, so check them out!

    • @dealloc
      @dealloc ปีที่แล้ว

      We went with warp (before Axum was born) and have been happy with it. However, what I like about axum is that it has much simpler types to work with. Both are very composable, unlike a lot of frameworks using proc macros.

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

      Sorryz but, Poem > Tide > all

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

    How about Actix Web?

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

      its fine if it fits your wants/needs. I generally prefer and see more companies choosing Axum at the moment.

  • @NetherFX
    @NetherFX ปีที่แล้ว +10

    Dependency Injection in Rust would be a dream. Imagine a project like Symfony, but completely in Rust :^)

    • @RogerValor
      @RogerValor ปีที่แล้ว +3

      Dependency Injection is already possible in rust, as it is a general programming design pattern, just use e.g. boxed dyn trait as a passable argument in a constructor. I think what all you mean here is some sort of automatic dependency injection management.

  • @johnwilliams7999
    @johnwilliams7999 ปีที่แล้ว +1

    I enjoy warp for apis

  • @0xccd
    @0xccd ปีที่แล้ว

    How do you get that "from json | get data" in the cli?

    • @chrisbiscardi
      @chrisbiscardi  ปีที่แล้ว +2

      I use nushell: www.nushell.sh/

    • @0xccd
      @0xccd ปีที่แล้ว

      @@chrisbiscardi That was fast (I was still reading the comments), thanks bro!

    • @chrisbiscardi
      @chrisbiscardi  ปีที่แล้ว +2

      @@0xccd haha I just happened to be looking at the dashboard when you commented. It was like "37 seconds ago..."

  • @jzmmm
    @jzmmm ปีที่แล้ว

    nightowl.. nice. best theme

  • @Codeaholic1
    @Codeaholic1 ปีที่แล้ว +2

    I generally enjoy your videos, but the single word on screen captions were very distracting.

  • @Kragal0n
    @Kragal0n ปีที่แล้ว

    What about Dioxus?

    • @chrisbiscardi
      @chrisbiscardi  ปีที่แล้ว

      Dioxus is a GUI layer so wouldn't work for the intended purpose here (which is a JSON API). A dioxus app could consume this API though

  • @daniel13021
    @daniel13021 ปีที่แล้ว

    Actix will ever be in my mind as unstable repo :(