How to Build A Rust Backend with Actix Web and SurrealDB (Full Tutorial)

Поделиться
HTML-код
  • Опубликовано: 2 дек 2024

Комментарии • 66

  • @WhiteSponge
    @WhiteSponge  Год назад +6

    The FREE source code is now available on GitHub here at github.com/WhiteSponge/rust_backend ! Have fun with it!
    Also some useful links here:
    Actix Web: actix.rs/
    SurrealDB: surrealdb.com/

  • @LZ002
    @LZ002 Месяц назад

    still working youre a legend

  • @mybdretaemch3409
    @mybdretaemch3409 10 месяцев назад +3

    great tutorial! really enjoying it so far!

    • @WhiteSponge
      @WhiteSponge  10 месяцев назад

      Haha thanks for your kind words! Hope it was helpful and I'm working on the next tutorial too!

  • @santoshmore2953
    @santoshmore2953 Год назад +3

    Need more and more tutorials like this

    • @WhiteSponge
      @WhiteSponge  Год назад

      Hahah we will have more for sure!

  • @lardosian
    @lardosian 11 месяцев назад +1

    Subbed, will be sure to watch more in my journey into learning Rust, thanks.

    • @WhiteSponge
      @WhiteSponge  11 месяцев назад

      Thank you! Hope it was helpful 😀

  • @JR-wu3rx
    @JR-wu3rx Год назад +2

    This was amazing, sir! A Leptos + Axum + SurrealDB tutorial would be really helpful, too.
    Questions:
    1) Connecting to SurrealDB, why did you not use any of the boilerplate code provided by SurrealDB on their Rust SDK page? Where did the database connection code you use come from?
    2) I'm still foggy concerning the context in which I should use SurrealQL, because you did not use any SurrealQL to interact with the database. Maybe only when using a custom advanced query?
    Also, I think it would be helpful for the learners if you took 30 seconds every now and then to explain more uncommon lines of code and why you chose to write it in such a way as opposed to.... "this is how you do it....and it works!" , and then move on to the next task.

    • @WhiteSponge
      @WhiteSponge  Год назад +1

      Hey there! Thanks for your kind words!
      Leptos does indeed sound like an awesome idea!
      Regarding your questions:
      1) It was some time back but there were some bugs caused by the boilerplate code lol. The latest versions of SurrealDB might have already fixed it but I haven't gone back to test that out yet
      2) Personally I feel that it depends on your use case. SurrealQL can be useful if you're using something more complex (like what you have mentioned)
      Ahahaha thanks for the feedback! I always thought that I was blabbering for too long so I only tried to explain some lines of code but not everything :X
      Good to know that some people do appreciate it ahahahaha
      Thanks you're awesome :D

  • @lukasbelck4514
    @lukasbelck4514 6 месяцев назад

    Great video, would be nice to have a part about deploying such application

  • @SurrealDB
    @SurrealDB Год назад +2

    Thanks for great video! 🚀

    • @WhiteSponge
      @WhiteSponge  Год назад +1

      Haha thanks for being awesome!

  • @wleeey
    @wleeey Год назад

    this is cool, please continue

  • @prashlovessamosa
    @prashlovessamosa Год назад +1

    This is not enough please make more stuff like this.

  • @jojo00733
    @jojo00733 4 месяца назад

    Thank you!

    • @WhiteSponge
      @WhiteSponge  4 месяца назад

      Hope it was helpful 😀

  • @konstantinrebrov675
    @konstantinrebrov675 Год назад +1

    Please make a video about how method chaining is implemented in Rust, as in the example of the HttpServer.

    • @thegrabbler622
      @thegrabbler622 9 месяцев назад

      Google rust builder pattern. theres alot of resources explaining how to do it

  • @iquick9858
    @iquick9858 11 месяцев назад

    Very helpful tutorial. Thank you. Can please do tutorial on WebTransport using rust backend, and frontend with Tokio auxm please? Need one in-depth tutorial like this one for me like beginners to learn rust. Cheers

    • @WhiteSponge
      @WhiteSponge  11 месяцев назад

      Thanks for your kind words! Ohhh that sounds like an interesting topic for a video 🤔

  • @cyano5758
    @cyano5758 Год назад

    Really instructive video thx so much. What extensions do you use in vim?

    • @WhiteSponge
      @WhiteSponge  Год назад

      Hey thanks too! Haha I'm using Helix here not vim lol

  • @theintjengineer
    @theintjengineer Год назад +1

    What would be the best Front-End Framework to mix with Rust in the Backend?
    Do you have any videos on that, e.g. a React or Next.js App, Web Assembly, whatever, being served by a Rust Backend?
    Thanks.

    • @WhiteSponge
      @WhiteSponge  Год назад +1

      I would say go with the front-end framework that you are most familiar with (i.e you can build faster with it).
      For myself personally usually (at least for now) I would just go with SolidJS :D

    • @theintjengineer
      @theintjengineer Год назад

      @@bluewave3050, yeah, I found that in my research as well🤔
      I also ended up looking at Axum as well for the API-ish thingy.
      But bro, when it comes to the frontend stuff, it's so.. I don't know😂
      Sometimes the integration doesn't work well, sometimes the framework is too hard to get started with, sometimes the deployment wouldn't work as I'd like it to, and so on.
      Coming from C, C++ and lower, UI stuff is just so complicated haha. I always saw people talking about Web Dev in the /r/learnprogramming and thought it was because it was easy haha.
      It seems like it's because of Jobs. Idk.
      I even picked up some React in the past few days, just by looking into this😂.
      I'm now deciding a scope, and will make it as tiny as possible, just so I can get something done. If HTMX suffices, then amazing. I'm yet to look into SolidJS - it sorta displays a different approach compared to ReactJS, as far as I could see.

    • @WhiteSponge
      @WhiteSponge  Год назад

      @@bluewave3050 haha for sure!

  • @kaustubhthakur5178
    @kaustubhthakur5178 4 месяца назад

    can u make a full backend course in rustlang please mate,thanks for tutorial

    • @WhiteSponge
      @WhiteSponge  4 месяца назад

      haha hope it was helpful! A full course huh? That might be a good idea let me consider it first :D

    • @kaustubhthakur5178
      @kaustubhthakur5178 4 месяца назад

      @@WhiteSponge a full course will be great ,as very few ppl have made it in yt,please ,take your time and for fullstack rustlanf webdev,it will be helpful liek this video,thanks

  • @elinaonchul3226
    @elinaonchul3226 10 месяцев назад

    Right? Right. Right!

  • @rumonintokyo
    @rumonintokyo 10 месяцев назад

    Does this have CORS enabled for fetching data from a react front end for example?

    • @WhiteSponge
      @WhiteSponge  10 месяцев назад

      Yes it does! Check out the actix-cors crate!

  • @Redyf
    @Redyf Год назад

    What are your thoughts about helix? Is it ready for web development?

    • @WhiteSponge
      @WhiteSponge  Год назад

      Yes only if you are ok with it having no plugins at the moment lol

  • @VikramBhaskaran
    @VikramBhaskaran 3 месяца назад

    Have difficulties with Client connecting to DB. I do get Error: Os { code:48, kind: AddrInUse, message: “Address already in use” } error. I am on a Mac. Running surrealdb server on port 8000 and server is on 8080 when I try to connect SurrealDB for the first time. When I restart my machine it’s all good. What could be issue

    • @WhiteSponge
      @WhiteSponge  3 месяца назад

      @@VikramBhaskaran hello! Usually that happens when already have something running and occupying the same port number. And when you restart your machine, they are no longer using that port, hence why the error goes away.
      Try changing either Actix Web or SurrealDB to run on something like port 5000 instead and the other on port 8000

  • @blafikus
    @blafikus 11 месяцев назад

    I am finding it difficult to understand how I should model relations, can you make a follow up tutorial with a more advanced schema?

    • @WhiteSponge
      @WhiteSponge  11 месяцев назад +2

      Sure that sounds like a good idea for a new video too!

  • @thomasgohringer5538
    @thomasgohringer5538 10 месяцев назад

    I'm trying to use the automatically created record ID from SurrealDB, but can't find a way to also reuse my model (in your case Pizza) for create_model and get_models. Was this the reason for why you initialize Pizza with your own uuid? Do you know a solution for my problem?

    • @WhiteSponge
      @WhiteSponge  10 месяцев назад

      hello! for re-using models are you referring to getting/searching the result from the surrealdb? If so yea that's 1 of the reason(s) why I did it with my own uuid lol

  • @funnynews341
    @funnynews341 Год назад

    actix or axum? what should i choice?

    • @WhiteSponge
      @WhiteSponge  Год назад +1

      I haven't tried Axum but Actix Web does have better documentation though.
      Both run on top of Tokio too so they are more or less similar.
      For now I would say Actix Web lol

    • @funnynews341
      @funnynews341 Год назад

      hey @@WhiteSponge, it me again, i want to ask you about is it faster to use sveltekit (frontend) with actix+surealdb (backend) or just use sveltekit + surealdb? Because i showed that surealdb have sdk for js? if just crud database?

    • @WhiteSponge
      @WhiteSponge  Год назад +1

      @@funnynews341 hey! How have you been doing?
      I would say go with the method you are most familiar for speed of development.
      If you're more familiar with SvelteKit, definitely go with that.
      And yes SurrealDB does have a JS version 😂

    • @funnynews341
      @funnynews341 Год назад

      yes@@WhiteSponge , speed of development, and how about performance? are sveltekit + surrealdb have same speed of performance like actix+surrealdb?

    • @WhiteSponge
      @WhiteSponge  Год назад +1

      @@funnynews341 actix web would on average perform better from my experience lol

  • @eugenemark836
    @eugenemark836 Год назад

    addon - you can run surreal as a docker instance

  • @wiscaksono
    @wiscaksono 8 месяцев назад

    ya

  • @kimhyungchae
    @kimhyungchae 9 месяцев назад

    Hello how are you?

  • @farhanhelmycode
    @farhanhelmycode Год назад

    Are you Malaysian?

    • @WhiteSponge
      @WhiteSponge  Год назад

      hey hello! Haha i'm not but I'm your neighbour! :D

  • @santoshmore2953
    @santoshmore2953 Год назад

    why SurrealDB ?

    • @WhiteSponge
      @WhiteSponge  Год назад

      I'm a fan of trying out new things lol

  • @DIU3R
    @DIU3R 11 месяцев назад

    why r u pronouncing pizza like that