Yellow tram (urban rail transit train) moving fast from right to left

Catenary: A Chat Web App Written in Rust with Leptos

A while back, I spent a couple of hours on a train and pondered how cool it would be to have a chatroom for the entire train.


Being on a train is not as enjoyable as it could be. On longer journeys, you have two options: Keep to yourself and be bored, or attempt to strike up a conversation with someone nearby. The latter is high risk, high reward: You might have a fun talk with a complete stranger, or you could end up with someone less interesting or more annoying.


After many months since that train trip, I’m finally bringing this idea to life. Here’s how it works:

  • User enters the site.
  • The site tracks the user’s location for a few seconds.
  • The site finds other users traveling with roughly the same speed, direction, and current location.
  • The site displays messages from matching other users.
  • The site allows users to send and up- or downvote messages.

Now, you can talk to people who share your (un)fortunate fate of being on the same vehicle.

Nasty Details

With this small set of rules, people traveling in the same train, bus, etc., should see each other’s messages. Tuning the parameters for matching users is the challenging part. Buses are short and change direction often, while trains are long, fast, and less likely to change direction drastically. I guess this part is learning by dogfooding.

The obvious drawback is that you can’t really use the app if you are not moving. However, this is part of the appeal.


It not only requires a few real users, but they also need to be moving in the same direction with the same speed at the same time. I have (almost) zero hopes that more than a few dozen people will ever see, let alone try it. So, building it for the sake of it being used is not enough to start building it.

I’m encouraging myself to do it by choosing a somewhat new tech stack: Leptos. Leptos is a frontend framework for Rust with hydration, SSR, and the usual promises of being (blazingly) fast. And so far, I like it.

Chats and their messages are ephemeral; nothing is stored long-term, no database, no login, everyone stays anonymous. I’m imagining active users having a digital fishnet, capturing only nearby messages if they are in the right spot at the right time. Messages are deleted from the server a few minutes after they are sent. This is not only a privacy feature but also a way to keep the server load low. Win-win.


In case you want to try a demo, here you go:

Remember to nag me by opening issues on GitHub if you even whiff a bug or have a feature request:

More Posts

Menu Icon