Day 01: Building OpenSchoolTrack's Backend with Actix-Web and Rust

·

2 min read

Hii there,

Today, on May 6th, 2023, I initiated the Github repository "backend" for OpenSchoolTrack. This repository would hold the backend APIs for OpenSchoolTrack that would allow student registrations, data updating, and all other necessary backend functionalities.

Actix-Web and Rust Programming Language

To start the journey, I headed straight to Actix-Web documentation and followed the getting started guide. After completing the setup, I was finally able to run my server with the most basic API endpoints, which was a moment of satisfaction for me.

Now, Rust was a language that I had recently learned from the book "The Rust Programming Language" and a Youtube playlist. I was familiar with the syntax and some concepts, but I wouldn't consider myself an expert. Let's say I was a beginner close to the moderate level.

Tools for Learning

To learn more, I utilized ChatGPT's free version (80%), official documentation (15%), and 5% Google. I asked numerous questions to ChatGPT, and it provided me with 4/5 satisfactory answers. One great feature of ChatGPT is that I can ask it to explain complex concepts as if I were a JavaScript developer or to compare a concept in one language to another language.

Best Practices in Backend Structure

One of the most significant challenges I faced was setting up the folder structure for the project. To create a big project, we need to divide the workload, which required a separate folder for the best practices in my 'backend' directory. I browsed through several Github repositories for ideas and inspiration.

Importing and Exporting Modules

The next challenge that I encountered was exporting and importing modules from one file to another. I created two Rust files inside a folder and wanted to use a function from one file in another. Although I asked ChatGPT for help, it provided me with the wrong answers initially. After several attempts, I finally got the correct solution that met my requirements.

Testing API Endpoints with Curl

After importing and exporting modules, I tested the API endpoints with curl, which ChatGPT had written for me.

Pushing the Code

After testing the API endpoints, I created a repository inside OpenSchoolTrack's organization and pushed the code.

Repo at the moment