DEV Community

Cover image for Rust Fullstack - Ollama: RepStar
kuhiepmr
kuhiepmr

Posted on

Rust Fullstack - Ollama: RepStar

This is a submission for the Open Source AI Challenge with pgai and Ollama

Rust Rep Star

A Rust project for demonstrating full stack Rust Web.

Table of Contents

Introduction

This project is designed to showcase how to build full stack Rust Web.

Installation

To install the project, clone the repository and build it using Cargo:

git clone https://github.com/yourusername/rust-rep-star.git
cd rust-rep-star
cargo build
Enter fullscreen mode Exit fullscreen mode

Backend

Run the project using Cargo:

cargo run --bin api-actix
Enter fullscreen mode Exit fullscreen mode

... or in watch mode:

cargo watch -x "run --bin api-actix"
Enter fullscreen mode Exit fullscreen mode

Run the project using Shuttle:

shuttle run --working-directory=api/shuttle
Enter fullscreen mode Exit fullscreen mode

Frontend

Run the project using Dioxus-cli:

cd front/
dx serve
Enter fullscreen mode Exit fullscreen mode

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.




This project was inspired by timescaledb-toolkit repo, which was mostly written in Rust, hence let's build the first Rust fullstack app.

What I Built

RepStar is a comprehensive web application designed to manage and embed testimonials with ease.

  • This was my first time diving into the world of Rust for the backend, and I must admit, I was a bit late to the Ollama hype train.
  • Nevertheless, the project leverages the power of Rust and Dioxus for the frontend.

Let's explore my code repo for an up-to-date Rust Fullstack app.

Demo

Live demo: https://rep-star-qivi.shuttle.app. The demo showcases the main features of the application, including managing testimonials, RAG summary, Semantic search,...

Home Page

Testimonials Manage Page

Semantic Search

Embed PAge

Tools Used

Backend

  • Rust: The core language used for the backend, providing safety and performance.
  • Actix-Web: A powerful, pragmatic, and extremely fast web framework for Rust.
  • SQLx: An async, pure Rust SQL crate featuring compile-time checked queries without a DSL.
  • Tokio: An asynchronous runtime for the Rust programming language, providing the building blocks needed for writing network applications.

Frontend

  • Dioxus: A modern, fast, and ergonomic framework for building user interfaces in Rust.
  • Tailwind CSS: A utility-first CSS framework for rapidly building custom user interfaces.
  • WASM: WebAssembly is used to run Rust code on the web, providing near-native performance.

AI Integration

  • Ollama: Used for natural language processing tasks, enhancing the testimonial management experience with features like sentiment analysis and keyword extraction.
  • TimescaleDB: Leverages all three of the PostgreSQL extensions for AI: pgvector, pgvectorscale, and pgai provided by Timescale.

Development Tools

  • Visual Studio Code: The primary IDE used for development, with configurations for debugging and running the application.
  • Shuttle: A deployment platform for Rust applications, used to deploy the backend services.
  • Makefile: Used to define tasks for building and running the application, ensuring a smooth development workflow.

Final Thoughts

  • Building RepStar has been an exciting journey, combining the power of Rust and the flexibility of Dioxus to create a robust and performant web application.
  • Starting with TimescaleDB was incredibly easy thanks to the wizard steps. The available ai and vectorize functions have opened a whole new world for me in PostgreSQL.

Categories: All the Extensions!

  • Open-source Models from Ollama: Awarded to a project that utilizes open-source LLMs via Ollama for embedding and/or generation models.
  • Vectorizer Vibe: Awarded to a project that leverages the pgai Vectorizer tool for embedding creation in their RAG application.

Top comments (0)