3 ms·
RustGPT: ChatGPT UI Built with Rust, Htmx, SQLite
- deleted 3y ago[deleted]
- mrits 3y agoAs a long time fan of rust I’m very disappointed this name was used do a ui app. It’s close to the stack I use but don’t see any reason why I’d want to try it out.
- jadbox 3y agoI was just browsing through this code all night. In principle, Htmx is really showing how React or any frontend framework is just not needed for most applications. Htmx simplifies everything.. even component endpoint caching is as simple as just adding a good ol' header. No more "partial rendering" or related complexity needed. I'm still unconvinced that Rust is a good idea for general web servers due to (overly) aggressive compiler checks and chaotic documentation related to web server concerns (many Rust web related libs cannot work together or not easily). Today I'm mostly just using Hono+htmx+view transitions. Astro is a similar stack, but with more batteries included (and some additional complexity).
- bomewish 3y agoIsn’t the benefit of rust for backend simply the massive resource efficiency/speed?
- ametrau 3y agoSpeed of what?
- streetcat1 3y agoNot sure what do you mean by aggressive compiler checks. Do you prefer bugs?
- Alifatisk 3y agoNaming it RustGPT because parts of the ui was written in Rust feels weird, you could name it HtmxGPT aswell. In reality, it contributes nothing to gpt.
- J_Shelby_J 3y agoNice work! Can you run it locally? Also, it’d be nice if one could try the demo without creating an account. Otherwise I’m just judging by your screenshots.
- exxos 3y agoWhen there's a programming language in the project name and it's not a library, it's not a good sign. It means that there was nothing interesting worth mentioning.
- deleted 3y ago[deleted]
- paulgb 3y agoIn general you are right, but as the readme says, this project was an experiment to try out the stack. The intended consumer of the repo is probably not someone who wants to run yet-another-chatgpt-clone, but someone who wants to poke at the code, in which case the stack is the most relevant information!
- spiderice 3y agoI do have to say.. I find it ironic that 2 days ago you commented > Why not Bun? On a perfectly fine project that was using Deno instead of Bun. You can't really have it both ways.
- willsmith72 3y agoeverytime i check out some htmx source, it feels like it would be a complete nightmare to maintain at scale. e.g. hx-delete="/chat/{{ chat.id }}" hx-target="#chat-{{ chat.id }}" hx-swap="outerHTML"
- nop_slide 3y agoI barely know htmx but this example seems quite easy to parse. This snippet deletes a chat from the backend and removes the corresponding element in the UI. - send a DELETE request to /chat/chat.id - the response is going to swap the content of the #chat-chat.id element
- hu3 3y agoHi! Thanks for parsing it. How could I implement an error flash message in case the delete fails in this case?
- wild_egg 3y agoI've found the simplest option is to have the server respond with the markup for the flash message. The server can include a couple response headers to override the placement of the message to not affect the existing page state https://htmx.org/docs/#response-headers https://htmx.org/docs/#response-headers This allows the error to either be added inline in the UI somewhere or (my preference) displayed as a toast by appending to the end of the <body>
- hu3 3y agoPerfect thanks!
- TheUndead96 3y agoI think that snippet is perfectly reasonable if you are an individual or a small team in charge of the whole stack. This line of code is unlikely ever to change. Contrast this with React+Redux, where the code must constantly change to accommodate schema changes from the backend. The React project thus changes more often, but this is a false sense of maintainability. Further, imagine the 200+ dependencies a starter React app requires and how all of these must be kept up to date.
- TechSquidTV 3y agoMan you guys will upvotes anything with Rust in the title hmm?
- nop_slide 3y agoPersonally I upvoted because of HTMx
- papichulo2023 3y agoAnd htmx and sqlite, this tool was made to farm HN karma.
- ban-lan-gen 3y agoI don't understand all those rust hypes here. What indeed does rust bring to the table?
- unshavedyak 3y agoHype as in, why announce that it was made in Rust? Well to me, because i like to see the languages things are made in, and i especially like to see projects i would be interested in contributing to (read: also using my preferred language at the time). It was the same for Go when i was using Go. Why is this always debated?
- ban-lan-gen 3y agoWhen I browsed GitHub repos. I came across some repos that implied "Because my thing is written in Rust, it automatically comes with a good performance, good scalability, etc". Jumping into a new language because people said it has good performance without actually understanding suited applications and the reason it gives a good performance seems to be a hype to me. It can be just my own bias. Maybe people out there already have a very solid understanding of Rust.
- qwertox 3y agoThe times I've searched for Rust stuff on GitHub I've mostly found junk, like projects people wrote while they were learning Rust, also leaving them abandoned. Maybe you should search around for solid projects and look into them in order to gain appreciation the language. Or watch a couple of videos from Jon Gjengset, like his recent "Implementing (part of) a BitTorrent client in Rust" [0] while keeping in mind that the code he's writing is memory safe, which would probably not be the case with C at the same expertise level and speed of development. And considering that it is a BitTorrent client, one would definitely want it to be memory safe. [0] https://www.youtube.com/watch?v=jf_ddGnum_4 https://www.youtube.com/watch?v=jf_ddGnum_4
- qwertox 3y agoFor me: compared to C/C++ enforced memory safety and a sensible approach to async/await in a fast language.
- LouisvilleGeek 3y agoUnfortunately it's not building per the github instructions. warning: `rustgpt` (bin "rustgpt") generated 15 warnings error: could not compile `rustgpt` (bin "rustgpt") due to 19 previous errors; 15 warnings emitted
- neilyio 3y agoThis is such a great project, thank you for sharing! It seems like you're getting the usual dump of negativity around HTMX... but as usual, not much coming from anyone who's actually tried to build something small/medium-sized. I keep hearing that this stack "would" fall apart in a bigger project, but I never hear any concrete, empirical descriptions of issues that actually do arise. I'll offer one here... using HTMX usually means you're going to be writing HTML templates, and HTML templating languages don't have much IDE support. I really miss goto-definition etc. when I'm writing Jinja templates. That being said, I've personally found Rust/HTMX to be a magnificent combo. I personally find writing backend endpoints in Rust to be no more cumbersome than any other language (after becoming comfortable with Rust)... and there's massive gains from the incredible tooling and type system. I wonder if you've considered using Askama for your templates? It has a Axum integration that cleans up some of the boilerplate around template rendering. There's also an open PR for block fragments [1], which will make componentization of HTML fragments much easier, as discussed in this essay on the HTMX site [2]. We need more projects like this to demonstrate how useful, highly-interactive apps are made with HTMX. I'd encourage skeptics to try the same before writing it off. [1] https://github.com/djc/askama/pull/824 https://github.com/djc/askama/pull/824 [2] https://htmx.org/essays/template-fragments/ https://htmx.org/essays/template-fragments/
- jadbox 3y ago> HTML templating languages don't have much IDE support However JSX has amazing IDE support, but you need to use JS/TS with it. This is where I think the ergonomics of JSX defined Htmx endpoint rendering has been a very natural DX transition moving away from SPAs. Now with CSS View Transitions and htmx element replacements, the user experience is largely just as seamless as developing a spa app.
- neilyio 3y agoI think a lot of us reach for Jinja-style templates so it feels a little more like we're writing bare HTML. But they're of course still just templates, and they need a build step before they become valid HTML. So it's true, if you're willing to use a DSL embedded in your server language (like JSX), then you'll have the full language tooling available to you. And this probably isn't giving up much over language-specific templates. A JSX-equivalent for the Rust server-side rendering world would probably be maud [1] or leptos [2]. [1] https://github.com/lambda-fairy/maud https://github.com/lambda-fairy/maud [2] https://github.com/leptos-rs/leptos https://github.com/leptos-rs/leptos