built with rust, shuttle, actix web, neon, diesel.
rust: for programming language. shuttle: to deploy our backend to the cloud. actix web: for web framework. neon: for database. saving the data, and etc. it's postgresql. diesel: for ORM. we should use postgresql.
-
create a new rust project.
-
setup diesel with postgresql.
-
setup shuttle. also integrated actix web.
-
setup neon. setup postgresql.
-
we created sample api endpoint hello world.
-
we created tables, and did migration, and also did alteration.
-
we wrote functions; operations.
-
we wrote models for our tables.
-
mod.rs everytime we did reimport the modules.
-
we define the routes; for url shortening and redirection.
-
we wrote helper functions; crypto.rs for encryption and decryption. also, we wrote a functions to get the stuff from .env file or in our case Secrets.toml. and also random code generator with ... length. (combination of letters and numbers).
-
we updated the main.rs file to use the routes. to get connected with the database. and start the server.
-
we deployed our backend to the cloud. with shuttle. in case issues with libpq.so.5 we wrote custom bash script to install the libpq-dev. we did another deployment with the custom bash script. and it worked. now we have our backend running on the cloud.
-
we tested our backend with curl. and it worked.
-
we did other bunch of stuffs. please kindly check out the video tutorial for more details.
that's it!!
Watch the full video tutorial on YouTube How I Built Open Source Fastest URL Shortener Ever With Rust. (put like and subscribe if you found it useful).
Github repo for this tutorial with all the details, secrets, env files available here github.com/abdibrokhim/notlink-tutorial. (dont forget to put a star ⭐️ on this official repo).
find me here: yaps.gg. (im not yapping, but i do yap sometimes).
