Sunday, September 14, 2025

Project Development Experience with Rust - API development

 Good evening buddies,

    Welcome back to another project development experience with Rust. This time I gone for developing web API's for Library crud operation. In this blog we will see how I started and ended the project.

Lazy Start

Why I scrolled Instagram, I don't know. May be I thought that this is the last thing is what should I done with. Alongside I searched for the API development frameworks in Rust and picked actix. Again doom scrolling again and again. And I started seeing AOT in between.

Project as a mountain - seems un-hikeable

When I see the code in chatgpt, it seems very heavy to bear and thought of jumping around. It feels literally a mountain(ton of codes) to hike. But I moved forward and continued copying code from chatgpt and little bit learning how the syntax formed and tried to run it.

Project structuring

This time instead of writing the whole code in the main file, I asked the chatgpt to form a folder structure and wrote down the code(organized one).

Why mistakes are coming while you are productive and that makes us procrastinate

I wonder why this is happening to me only or am I imagining like that. If I am wrong, share your story too. The scenario is I somehow understand the syntax and how does actix work web but when I tried to apply this type of code or approach in another route, it shows a hell of errors. This really made me think twice to quit and jump around. Instead of facing the hard way I chose to scroll. 

Friend of mine asked not to chatgpt

One evening my close friend called me to talk about my current works and what I am doing, and I too ask him about everything. So I shared my current situation and suddenly he said not to use chatgpt and use chrome or whatever to find solution or something I want(for everything). Yes I gave a shot to it and somehow tried not using it.

Made a post method without help of chatgpt

Yes, I wonder how. I searched in the documentation page and stack overflow and blogs and everything but not chatgpt. And I finished the my first POST method. But again I can't finish the PUt and DELETE without chatgpt.

Finished the member handler fast and without chatgpt

Since I had written the whole /books router, now I am very confident that I can write another router(which looks like the already built one). Yes I wrote the /members route fully without the help and without error too.

Reusing the developed API's(reqwest) 

I found that post and put methods of /loans handler needs to be checked in the books table like either the book is issued or available to complete a loan transaction. Which means that I can use my own API to be called and fetch the result. I searched in the internet and found a rust http client tool - reqwest. Again I copied the code from the chatgpt to work with reqwest.

Pushing myself to code

But there are some errors in POST /loans. The time is night and my body is saying let's go to sleep and scroll instagram. But I pushed myself to finish the POST method of /loans handler and finished the method and then I slept peacefully.


That's it buddies I finished all the code and tested it with curl and pushed all my code in github. And I finished AOT too.

What's next

I have so much to try buddies, I watch One Piece so I take screen shots in middle of episodes, why not host a website(backend) that provides pictures of One Piece and other animes too. Or try video editing. My recent friend asked me to design UI for his application(fork his GitHub repo) I wanna use Rust(Yew I think!) here. I don't know what to try. But I will do something and update you all buddies.

Thanks for the read buddies. Do what you love. Tatakae



No comments:

Post a Comment