tchatche.rs
๐
A blazing fast chat application built with Axum and yew.rs
TL;DR
๐ฌ tchatche.rs is a realtime chat application built with yew.rs (frontend) and axum (backend) frameworks.โ๏ธ Easy to use, only requires authentication informations to be used.๐ Blazing fast, completely built on Rust.๐ Supports browser's dark mode.โจ Simple yet elegant UI.
How to access the application
The application is deployed on https://tchatche.rs and should be compatible with any modern navigator.
About
tchatche.rs is an application used to help clients to communicate between each others. It is built with yew.rs and axum servers in order to provide blazing fast responses and strong API. It is also using Postgres and Redis services in order to store the user data and retrieve the room messages.
Project structure
.
โโโ Cargo.lock
โโโ Cargo.toml
โโโ CODE_OF_CONDUCT.md
โโโ docker-compose_dev.yml => in order to launch redis and pg services in
development
โโโ docker-compose.yml => deployment docker-compose file
โโโ Dockerfile_back => deployment backend dockerfile
โโโ Dockerfile_front => deployment frontend dockerfile
โโโ Dockerfile_migrations => deployment migrations dockerfile
โโโ LICENSE.md
โโโ migrations => PG migration projet, has to be ran with sqlx
โโโ nginx.conf => the nginx configuration
โโโ README.md
โโโ tchatchers_back => the backend project
โโโ tchatchers_core => the core project, gathers the APi shared both by the
front and backend
โโโ tchatchers_front => the frontend project
Technologies used
Technology/Framework | Utility | Version |
---|---|---|
Rust | Programming language | 1.64 |
Tailwind | Stylesheets | 3.X |
yew.rs | WASM Frontend framework | 0.19 |
axum | rust server | 0.5.4 |
trunk-s | Rust development WASM server | 0.16 |
nginx | Reverse proxy server | latest |
Postgres | SQL engine | latest |
Redis | Key value NoSQL engine | latest |
Production project architecture
The production architecture consists of several layers :
- The client, who uses the application and interacts with the different ressources.
- The proxy layer, that defines some security constraints such as BruteForce mitigation, the HTTPS connection, the read time out and HTTP headers. This layer is the sole entry point for the client to the application, as others aren't publicly reachable since they are on another network.
- The applicative layer : One part being the frontend built in WASM, so static assets in production, another part being the backend, built in axum, so running as a task. It is important to note that in production, only the backend part exists, since the frontend and proxy are on the same image. Besides, only the backend can access to the data layer within the network.
- The data layer : Mainly used for persistence. While Postgres will contain the data about the users, redis will store the messages that have been sent in the chatrooms. Postgres schema can be found right below, redis one is as simple as
ROOM_NAME[KEY]=MESSAGES[LIST]
.
Postgres schema
Made with one of my other tools, doteur.
Personnal objectives behind this project, feedback
My goal with this project was to learn more about both WASM and Websocket technologies besides of perfecting my Rust knowledge. It was really nice to build such a project and I hope it can inspire or help other peoples to built similar tools. I think the code is pretty good (even though it should be perfectible) on the back and core projects, but quite perfectible on the front one. It is to note that there are still some bugs remaining.
My feeling is that both Rust and WASM have a pretty good future when it comes to frontend apps. The backend side of Rust already has several frameworks that are making it a reliable language when it comes to handling data logic, and the development of yew.rs or similar technologies in the future could be a game changer for the interest users and firms have toward the language.
Special thanks
Thanks to the Rust community for all their advices and their time reviewing my project, it's always a pleasure to be part of such a community.