MiniChat: Simple web chat in Rust

MiniChat: Simple web chat in Rust

19 devlogs
23h 42m
•  Ship certified
Created by logabe

MiniChat is a chat server that is both lightweight to host and easy to use. There are no accounts, so it can be spun up as an easy way to chat with friends whom you might not be able to message otherwise. Perfect for messaging your friends during class! (use wisely)
Features:
- Chat history and persistance: The last 100 messages are saved in memory
- Autolinking: Links and Images are automatically converted to their HTML representation
The chat uses WebSockets for transport and has a Rust backend.

Timeline

Ship 2

1 payout of shell 84.0 shells

logabe

27 days ago

logabe Covers 4 devlogs and 5h 18m

Fixed some small issues with the autolinking implementation

Update attachment

I replaced the markdown support with a simpler autolinking implementation that's lighter, doesn't have the same vulns, is easier to use, and just generally works better.

Update attachment

I added Markdown support! I used the comrak parser because it had most of the features I wanted. It took a couple of attempts to get the rendering working in a way that wouldn't look super ugly. The solution I have rn is a bit jank, but it works.
(i just realised that due to the way I've been coding it, not having the markdown feature enabled actually opens up a big attack vector. I should probably fix that...)

Update attachment

A few small changes! Added some stuff to communicate to the user when the client is disconnected. Also reverted some stuff with the layout that was causing a bug.

Update attachment

Ship 1

1 payout of shell 417.0 shells

logabe

about 2 months ago

logabe Covers 15 devlogs and 18h 24m

I added support for push notifications, as well as made some changes to make it work a little better on mobile (there's still some jank though). I feel comfortable shipping the program as most of the core features are here. Go check out the demo!

Update attachment

I added a Dockerfile and deployed it to Nest! I'll add notifications next :D

Update attachment

I added a settings menu! I was also going to add notifications but it turns out you need to be in a secure context (meaning HTTPS) so I'll wait until I have a public instance I can test with before I work on that.

Update attachment

I added chat history! MiniChat now saves the last n (by default 100) chat messages and system events in a VecDeque that gets sent to the client when they first join. This could also be useful to implement behaviours for if the client's connection gets dropped.

Update attachment

Added a bunch of small features! A lobby that's always available, chat scrolling, a new home page, and remembering the last username you used.

Update attachment

I made the chat page look a lot nicer based on the Figma designs and some client feedback. It should be usable on mobile as well!

Update attachment

Used Figma to make some layout designs! I can only upload one, but there's another potential layout

Update attachment

I ended up going with the second option - using one WS endpoint with the query params. I think this was probably the most elegant design overall.
I've now added a room list that shows all the current rooms. The room names automatically encode special characters, so you can use non-latin characters. It's kinda ugly but that will be the next thing I work on.

Update attachment

Was busy for a week, but I'm back! Implemented the room system as a JSON message that gets sent to the server internally. I'm not sure which of these systems I prefer most... I'll probably mull it over for a little bit.

Update attachment

Changed the system from the last devlog to use one WS endpoint, and get the room code from query parameters. I think I prefer having just one endpoint...
(ignore my bad code)

Update attachment

Added the basics of a multi-room system where each room has it's own WS endpoint /room/roomname/ws. I'm not sure if I want to go with this or using some parameters, either in the http query params or sent other as JSON when you first connect (that's how I'm currently sending username info)

Update attachment

Various small changes. Added some comments to the code and changed some layout stuff.

Update attachment

Added a list that keeps track of the people in a room. To do this in a memory-safe way, I used a Mutex, which only allows one thread/task to access memory at a time, and prevents poisoning. The way Rust does this took me a bit to get used to; the Mutex drops access to the data at the end of the current block, so I found I had to { enclose some of my code in it's own block } to get things to work right. I might be doing something wrong here, though.

Update attachment

Switched to using JSON for structured data :)
The Event enum implements Into so it's even more ergonomic than using Strings!

Update attachment

I've got a basic example working! I'm using Axum as a web framework and have pilfered most of the code from the 'chat' example. I understand how most of it works, but I think I should leave some notes for myself.

Update attachment