Skip to content
CoprimalPublic

About

Chat with everyone on your Wi-Fi: one command hosts a chat server, everyone else joins from a browser.

Topics

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

LocalChat logo

LocalChat

Chat with everyone on your Wi-Fi: one command hosts a chat server, everyone else joins from a browser.

License: MIT Node 22.18+ npm

Features

  • Groups and direct messages, in the browser, nothing to install for those who join.
  • Markdown, with a Copy button on each message.
  • Replies, @mentions, reactions, pins, edit and delete.
  • Files and images: pick, paste or drop.
  • Emoji picker and typing indicators.
  • Full-text search that tolerates typos, including Vietnamese typed without accents.
  • Everything stays on the host machine.

Quick start

On the host machine (Node 22.18 or later):

npx -y @coprimal/localchat@latest

@latest runs the newest version each time, and -y skips npx's install prompt.

Then, on any device on the same network, open http://chat.local, or the IP URL it prints, or scan the QR code. Pick a name and chat.

The terminal prints every address:

Who Open
The host machine http://localhost (or http://chat.local)
Other devices http://chat.local, or http://<host IP>
Admin (host only) http://localhost/admin

Port 80 is used when it is free; otherwise LocalChat takes 8080 (or any free port) and every address gets it, such as http://chat.local:8080. If another LocalChat already answers to chat.local, this one becomes chat-2.local.

Options

--port <n>          Port (default: 80, else 8080, else any free port)
--name <name>       mDNS name, served as http://<name>.local (default: chat)
--data <dir>        Data folder (default: ~/.localchat)
--max-upload <MB>   Largest upload in MB (default: 50)

localchat reset-user <handle> clears the password and devices of a handle, so it can be claimed again.

Admin page

On the host machine, open http://localhost/admin (add the port if the server printed one). It opens only there, at localhost, 127.0.0.1 or the machine's own IP address: other devices, and the host itself through a *.local name such as http://chat.local, are refused. The chat's menu links to it.

  • Overview: counts, disk use, network URLs.
  • Users: rename, remove a photo, sign out everywhere (names with a password), reset a name.
  • Channels: create, rename and delete channels (everyone is in every channel). #general stays.
  • Messages: read and delete messages in channels and groups. Direct messages are not shown.
  • Storage: move the data to another folder, such as one that iCloud Drive, Google Drive, Dropbox or OneDrive syncs. LocalChat copies the data there, restarts on the same port, and remembers the folder in location.json inside --data.

Data

Messages, users and uploads live in ~/.localchat (or the --data folder), or in the folder picked on the admin page. Delete it to start over.

In a synced folder, run only one LocalChat on it at a time, and keep the folder downloaded on the host. If the folder is missing at start (drive not mounted), LocalChat stops instead of starting empty.

Notes

  • For a local network only: no accounts in the cloud, no internet needed.
  • Logging out keeps your name in this browser: pick it on the welcome screen to come back. Without a password, a name opens only in the browser it was made in; with one, from any browser, and always asks for it.
  • Plain HTTP: anyone on the network can read the traffic. A password is optional; don't reuse a real one.
  • .local names may not resolve on some Windows or Android devices: use the IP URL instead.

Development

Requires Node 22.18+ and pnpm.

pnpm install
pnpm dev           # open http://localhost:5173: web/ hot-reloads, server/ restarts on save
pnpm test          # tests
pnpm build && pnpm start   # run the production build

In pnpm dev, everyone opens Vite's port 5173 (Vite passes the API and sockets to the server on port 3000; don't open 3000 itself):

Who Open
The dev machine http://localhost:5173
Other devices http://chat-dev.local:5173, or http://<host IP>:5173
Admin (dev machine only) http://localhost:5173/admin

The terminal prints these addresses. Dev data lives in .localchat-dev/, apart from ~/.localchat. Release steps are in CONTRIBUTING.md.

Cargo build cache

The desktop tray app in desktop/ (Rust) builds into /Volumes/Thi2TB/cargo-target/LocalChat through a gitignored .cargo/config.toml (copy .cargo/config.toml.example). Setup, the unplug behaviour and troubleshooting are in CONTRIBUTING.md.

License

MIT © Coprimal

About

Chat with everyone on your Wi-Fi: one command hosts a chat server, everyone else joins from a browser.

Topics

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Contributors

Languages