Welcome to the xor.chat! This repository demonstrates a lightweight, high-performance, privacy-focused live chat using Bun's bun.serve.
- Real-Time WebSocket Connections: Connect, broadcast, and receive real-time data.
- Fast & Lightweight: Only the necessary, see what rooms you joined and how many people are connected, encrypt your messages with a key.
- Server-less: No data is saved anywhere, rooms are created when used and destroyed when empty, messages are broadcasted to connected clients without saving anything on disk. If you want to clear the chat, simply
/clearor refresh the page. - Customizable & Scalable: Start the server, run the UI and you are ready to chat.
git clone https://github.com/asmxes/xorchat
cd xorchatbun/node/deno installEdit the host and port settings in app/server.ts to suit your environment.
bun.serve({
hostname: "0.0.0.0", // Replace with your desired host
port: 3001, // Replace with your desired port
...
});Then:
touch .env.local & nano .env.localFinally make sure you define the NEXT_PUBLIC_WS_URL variable like this:
NEXT_PUBLIC_WS_URL=ws://{yourhostname}:{yourport}
Start the WebSocket server with Bun:
bun/node/deno run ./app/server.tsbun/node/deno run devThat's it!
/username: Change your global username, it will be unique across al rooms./join: Join a room or switch to it if already joined. A new room will be created if it doesn't exist already./key: Set a key to encrypt sent messages and decrypt received messages./clear: Clears the chat for the current room./leave: Leave the current room.
This project is licensed under the MIT License.
Feel free to fork this repository and contribute (there's still alot of QOL features to add), and give it a ⭐️ if you find it useful!
Created with 💖 by asm