A real time chat platform
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Aelthorim 9518add5f9
All checks were successful
Lint / Format (push) Successful in 58s
Lint / Clippy (push) Successful in 1m25s
Merge pull request 'feat: add message queuing (new branch as old feat/message-queue had problems)' (#29) from feat/message-queue into main
Reviewed-on: #29
2026-07-31 00:13:34 +02:00
.forgejo/workflows ci: ignore .forgejo dir on push so workflows dont trigger unecessarily 2026-07-28 17:53:38 +02:00
client chore: bump version of client to 0.4.1 and server to 0.5.0 2026-07-30 22:08:47 +00:00
common deps: Update tokio to 1.53.1 in common, server and client 2026-07-27 00:49:40 +00:00
docs docs: update README.md to be up to date with ci requirements, and add Architecture.md which helps new contributors get started 2026-07-28 11:31:44 +00:00
server chore: bump version of client to 0.4.1 and server to 0.5.0 2026-07-30 22:08:47 +00:00
.gitignore feat(server): add TLS support for TCP and WebSocket connections 2026-07-21 21:20:35 +00:00
Cargo.lock chore: bump version of client to 0.4.1 and server to 0.5.0 2026-07-30 22:08:47 +00:00
Cargo.toml docs: add README and PROTOCOL.md, split common into modules 2026-07-19 14:09:56 +00:00
LICENSE-APACHE docs: add README and PROTOCOL.md, split common into modules 2026-07-19 14:09:56 +00:00
LICENSE-MIT docs: add README and PROTOCOL.md, split common into modules 2026-07-19 14:09:56 +00:00
README.md docs: update README.md to be up to date with ci requirements, and add Architecture.md which helps new contributors get started 2026-07-28 11:31:44 +00:00
renovate.json ci: disable dashboard for renovate since its creating useless issues 2026-07-28 11:20:27 +00:00

chat-project

A chat server and client written in Rust. Started as a "let me learn async Rust" project, kept growing.

Not production ready, see the bottom for what's missing.

Layout

  • common/ shared types, the wire protocol, and the traits both client and server build on
  • server/ the actual server: auth, message routing, SQLite storage
  • client/ terminal client, mostly for testing the server

Why this might be interesting

Client and server don't talk to TCP or WebSocket directly, they're written against two small traits:

pub trait ConnectionReader<T>: Send {
    async fn read_message(&mut self) -> Result<Option<T>, BoxError>;
}

pub trait ConnectionWriter<T>: Send {
    async fn write_message(&mut self, msg: &T) -> Result<(), BoxError>;
}

Each transport just implements these once (tcp.rs, ws.rs on both sides). All the actual logic, auth, routing, the client's input loop, is written once and doesn't care which transport it's running over. Wanted WebSocket support alongside the original raw TCP without duplicating the whole connection handler, and this is how that ended up working.

Protocol details (message shapes etc) are in PROTOCOL.md. For new contributors check out Architecture.md too.

What it does right now

  • Register / login, passwords hashed with argon2
  • Accounts persisted in SQLite, survive a restart
  • Session tokens, log in once, client saves a token and auto-logs-in next launch
  • Works over raw TCP or WebSocket, same protocol either way
  • Send a message to another user by username, if they're online

Running it

cargo run --bin server

then in another terminal:

cargo run --bin client

It'll ask tcp or ws, then drop you at a > prompt:

/register <username> <password>
/login <username> <password>
/msg <username> <message>

What's missing / RoadMap

  • No END to End encryption at all right now, server sees everything in plain text. This is the big one before it's actually private.
  • Offline users just don't get the message, nothing's queued
  • No web client yet (WebSocket support exists server-side for exactly this reason, just haven't built one)
  • Tokens don't expire

Contributing

Open to it. CI runs cargo fmt --check + clippy and trivy, only clippy and trivy need to pass. For anything bigger than a small fix, open an issue first so we don't duplicate work.

License

MIT or Apache-2.0, your choice, see LICENSE-MIT / LICENSE-APACHE.