Skip to content

chrishiguto/ama

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

AMA - Ask Me Anything!

Screen.Recording.2025-01-11.at.7.40.58.PM.mov

As part of my journey to learn Rust, I set out to build a web server that seamlessly integrates both API and WebSocket functionality. The goal was to dive deep into Rust's async ecosystem while creating something practical and interactive.

This project draws inspiration from a Figma design created by (Rocketseat)[https://www.rocketseat.com.br/]. Interestingly, I discovered later that they also had a crash course for implementing this in Golang. However, I wanted to make the journey my own by reimagining it in Rust—building everything from the ground up without external guides.

The result is a lightweight and minimalistic application where the primary focus is on exploring Rust's capabilities while delivering a sleek, user-friendly interface.

Tech Stack

Rust is the star of the show here! This project was created as a way to practice the concepts I’ve been learning throughout my Rust journey—drawing inspiration from The Rust Programming Language book and various live streams I’ve watched over the past few months. While APIs may not be Rust’s most common use case, working in a familiar environment allowed me to solidify my understanding of the language. This approach was intentional, as it made the learning process more engaging and relevant to my background. It also provided the perfect opportunity to explore async Rust, which is a fascinating and unique aspect of the language!

Rust references:

MongoDB was a natural choice for this project due to its flexibility and developer-friendly features. Since this app revolves around handling dynamic "ask me anything" sessions, MongoDB's schema-less nature made it easier to adapt to varying data structures without compromising on speed or scalability. Additionally, its strong support for WebSocket-based real-time interactions ensured smooth integration with the Rust backend.

For the frontend, I chose React, paired with Vite and TailwindCSS to ensure a fast and modern development experience:

Vite provides an ultra-fast build and hot module replacement (HMR), making development swift and seamless. Its minimal configuration perfectly complements the simplicity I wanted for this project. TailwindCSS allowed me to quickly prototype and style the application with utility-first CSS. Its customizable nature ensured that the UI aligned with the design while keeping the codebase clean and maintainable. Combining these tools gave the frontend a polished and professional look while allowing me to focus on learning Rust for the backend.

There are some feature gaps—this project was meant to be a fast and focused experiment rather than a polished, production-ready application. Who knows, I might revisit and expand it in the future!

Running the project

1. Clone the repository

Start by cloning the project to your local machine:

  git clone actix_examples

3. Create an environment file

Create an environment file name .env in the server folder with the following content:

  DATABASE_URL=mongodb://localhost:27017
  DATABASE_NAME=mongo

2. Set up a MongoDB instance

The project requires a MongoDB instance. You can choose any method that works best for you. If you prefer Docker (like I did), it’s as simple as running the following command:

  docker run -d -p 27017:27017 --name mongodb mongo

3. Run the backend

  cargo run

4. Run the frontend

  yarn dev

5. Open the application

Visit http://localhost:5173 in you're browser, and you're good to go! :party:

About

Ask me anything - Built using Rust with Tokio and Actix, React + Vite and TailwindCSS

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published