RustGPT is a ChatGPT UI built with Rust + HTMX: the power of Rust coupled with the simplicity of HTMX πŸ’š

Related tags

Command-line rustgpt
Overview

RustGPT πŸ¦€βœ¨

RustGPT.Blog.Post.mp4

Welcome to the RustGPT repository! Here, you'll find a web ChatGPT clone entirely crafted using Rust and HTMX, where technology meets simplicity and performance. πŸš€

Introduction

RustGPT is my latest experiment in cloning the abilities of OpenAI's ChatGPT. It represents the fourth iteration in a series of clones, each built with different tech stacks to evaluate their functionality in creating a ChatGPT-like application.

In this repository, you will find a Rust-based server leveraging the Axum framework combined with HTMX, providing a Rusty web development experience. From database operations to streaming responses, this project covers a broad spectrum of backend functionalities and real-time web interactions.

So, for Rust enthusiasts and web developers alike, dive in to explore a world where web development is redefined with the power of Rust!

Features 🌟

  • Rust with Axum Framework: A fast and reliable server that's all about performance and simplicity.
  • SQLite: A lightweight yet powerful database for all your data persistence needs.
  • Server Sent Events (SSE): Real-time streaming made easy to bring life to the ChatGPT interactions.
  • HTMX: No hefty JavaScript frameworks neededβ€”HTMX keeps interactions snappy with simple HTML attributes.

Tech Stack πŸ› οΈ

  • sqlx: Direct and type-safe SQL queries and migrations.
  • tera: A templating engine inspired by Jinja2, for rendering the HTML views.
  • axum: A web application framework that's easy to use and incredibly fast.

For those eyeing some client-side WASM magic, you might also want to check out Yew or Leptos for more complex applications.

Quickstart 🏁

Jump right into it by following these steps:

  1. Clone the repository.
  2. Create a .env
MIGRATIONS_PATH=db/migrations
TEMPLATES_PATH=templates
DATABASE_URL=sqlite:db/db.db
DATABASE_PATH=db/db.db
OPENAI_API_KEY=<api-key> (only necessary for tests, users will add their own keys)
  1. Install TailwindCSS Standalone in this repository: https://tailwindcss.com/blog/standalone-cli.
  2. cargo install just: install Just
  3. just init: install additional tools and migrate the db
  4. just dev: concurrently run tailwind and cargo run in watch mode
  5. Open your browser and enjoy chatting with your Rust-powered ChatGPT clone (port 3000 by default)

Contributing 🀝

Contributions are what make the open-source community an incredible place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make RustGPT better, please fork the repo and create a pull request. You can also simply open an issue. Don't forget to give the project a star! Thank you again!

Acknowledgments πŸŽ“

Hats off to the wonderful crates and libraries that made RustGPT possible!


Created with πŸ’š by a Rustacean who believes in the power of Rust for the web! Follow the journey on Bitswired.

You might also like...
Move multiple files, with the power of your editor

NOTE FOR USERS THAT WANT TO TRY THIS OUT! The current code on the master branch doesn’t work as documented, as a newer more powerful interface is bein

Maccha is an extremely extensible and themable power menu for Windows, macOS, and Linux.

Maccha I hate coffee. Maccha is an extremely extensible and themable power menu for Windows, macOS, and Linux. Plugins Plugins are written in Rust (ot

Make beautiful colored code listings in LaTeX with the power of TreeSitter.
Make beautiful colored code listings in LaTeX with the power of TreeSitter.

What is this? This is a CLI tool that consumes TreeSitter's output and transforms it into LaTeX code that will produce syntax-colored code listing. If

Rust-based CLI library for OpenAI ChatGPT API
Rust-based CLI library for OpenAI ChatGPT API

This is a Rust library that provides a CLI (command-line interface) for easy and convenient access to the OpenAI ChatGPT API. The library offers a simple and straightforward way to integrate the ChatGPT API into your Rust-based applications.

A tool for chatting using the ChatGPT API, written in Rust CLI.
A tool for chatting using the ChatGPT API, written in Rust CLI.

ChatGPT CLI A tool for chatting using the ChatGPT API, written in Rust CLI. You can use this tool to chat, just by setting your API Key. You can modif

ChatGPT powered Rust proc macro that generates code at compile-time.

gpt-macro ChatGPT powered Rust proc macro that generates code at compile-time. Implemented Macros auto_impl!{} #[auto_test(...)] Usage Get ChatGPT API

ChatGPT-Code-Review is a Rust application that uses the OpenAI GPT-3.5 language model to review code

ChatGPT-Code-Review is a Rust application that uses the OpenAI GPT-3.5 language model to review code. It accepts a local path to a folder containing code, and generates a review for each file in the folder and its subdirectories.

Rust-powered CLI tool designed to simplify and streamline the release process with help of ChatGPT
Rust-powered CLI tool designed to simplify and streamline the release process with help of ChatGPT

$ releasecraftsman πŸ‘·πŸ»β€β™‚οΈπŸ›  Automate Your Release Process with Precision and Ease. 🎁 Features Generate well-crafted release notes using GPT-3.5 and

ChatGPT CLI - A minimal assistant in the terminal
ChatGPT CLI - A minimal assistant in the terminal

ChatGPT CLI A lightweight ChatGPT CLI - Chat completion. Interact with ChatGPT from your terminal and save the conversation in a text file. Get starte

Comments
  • Trouble installing via MacOS and Ubuntu 22.0.4

    Trouble installing via MacOS and Ubuntu 22.0.4

    What OS are you using to install rustgpt on? I am having trouble on both Ubuntu and MacOS getting this up and running.

    For example on Ubuntu 22.0.4:

    :~/rustgpt$ just dev ./tailwindcss -i input.css -o assets/output.css --watch=always cargo watch -w src -w templates -w tailwind.config.js -w input.css -x run [Running 'cargo run'] warning: unreachable pattern --> src/ai/stream.rs:161:13 | 161 | _ => (), | ^ | = note: #[warn(unreachable_patterns)] on by default

    warning: unused import: Row --> src/data/repository.rs:4:12 | 4 | use sqlx::{Row, Sqlite, Transaction}; | ^^^ | = note: #[warn(unused_imports)] on by default

    warning: function internal_error is never used --> src/main.rs:126:4 | 126 | fn internal_error(err: E) -> (StatusCode, String) | ^^^^^^^^^^^^^^ | = note: #[warn(dead_code)] on by default

    warning: variant DatabaseError is never constructed --> src/router/app/auth.rs:31:5 | 29 | pub enum LogInError { | ---------- variant in this enum 30 | InvalidCredentials, 31 | DatabaseError(String), | ^^^^^^^^^^^^^ | = note: LogInError has a derived impl for the trait Debug, but this is intentionally ignored during dead code analysis

    warning: rustgpt (bin "rustgpt") generated 4 warnings Finished dev [unoptimized + debuginfo] target(s) in 0.06s Running target/debug/rustgpt thread 'main' panicked at src/main.rs:42:48: called Result::unwrap() on an Err value: EnvVar(NotPresent) note: run with RUST_BACKTRACE=1 environment variable to display a backtrace [Finished running. Exit status: 101]

    Sorry for asking a n00b question. My strengths are more with golang where we don't seem to have these kind of issues.

    opened by sullrich 5
  • Data usage of SSE stream

    Data usage of SSE stream

    An issue I noticed was that the SSE were sending the entire text for each update. Is this a limitation imposed by HTMX? In that case some Javascript code receiving them directly and aggregating them into a response and updating the page would be a better approach.

    opened by danielfaust 2
  • Missing LICENSE

    Missing LICENSE

    I see you have no LICENSE for this project. The default is copyright.

    I would suggest releasing the code under the AGPL-3.0-or-later or GPL-3.0-or-later license so that others are encouraged to contribute changes back to your project.

    opened by TechnologyClassroom 1
Koi is a simple tool built to let you use ChatGPT through the command line

Koi is a simple tool built to let you use ChatGPT through the command line. It adds the ability to let ChatGPT run commands on your computer in order to help you out, or to help you out with complicated tasks.

Shivam Sharma 9 Mar 28, 2023
Rust API Server: A versatile template for building RESTful interfaces, designed for simplicity in setup and configuration using the Rust programming language.

RUST API SERVER Introduction Welcome to the Rust API Server! This server provides a simple REST interface for your applications. This README will guid

Harry Nguyen 3 Feb 25, 2024
Ember is a minimalistic Rust library for creating 2D graphics, games, and interactive visualizations with ease and simplicity.

Ember Ember is a simple and fun 2D rendering library for Rust, allowing you to quickly create graphics and interactive applications with ease. It uses

null 8 May 4, 2023
YAML(ish) - Terminal UI framework based on templates focused on simplicity

A YAML(ish) based terminal GUI framework for- and by Rust, focussed on making it quick and easy to create a functional UI for an app or game. Based on Crossterm and inspired by Kivy.

null 27 Dec 18, 2022
A high level DSL for Simplicity. This is a work in progress and is not yet ready for production use

A high level DSL for Simplicity. This is a work in progress and is not yet ready for production use. The language is designed to be simple and easy to use. It is inspired by rust syntax and is statically typed. The syntax will be extended in the future to support more features.

null 13 Oct 28, 2023
A web-based streaming service with improved privacy, performance, and simplicity.

Majiix Majiix is a web-based open-source streaming service. The backend that handles the core streaming logic is written in Rust and makes use of cutt

Majgix 3 Nov 21, 2023
Shaping, Processing, and Transforming Data with the Power of Sulfur with Rust

Sulfur WIP https://www.youtube.com/watch?v=PAAvNmoqDq0 "Shaping, Processing, and Transforming Data with the Power of Sulfur" Welcome to the Sulfur pro

Emre 6 Aug 22, 2023
πŸš€ JavaScript driver for ScyllaDB, harnessing Rust's power through napi-rs for top performance. Pre-release stage. πŸ§ͺπŸ”§

?? JavaScript driver for ScyllaDB. Pre-release stage. ???? ⚠️ Disclaimer ⚠️ This repository and the associated npm package are currently in a ?? pre-r

Daniel Boll 16 Oct 21, 2023
Sample and plot power consumption, average frequency and cpu die temperatures over time.

sense Sense is a small tool to gather data on cpu temperature, power usage and clock frequency and plot graphs during some load. Dependencies Sense is

Luuk van der Duim 6 Oct 31, 2022
A command line tool to control the power state of Valve Base Stations 2.0.

lighthousectl A command line tool to control the power state of Valve Base Stations 2.0. Usage Scan All Base Stations It scans endlessly. You can stop

KOBA789 11 Aug 9, 2022