A lightweight local area network chat application that enables real-time communication between WiFi-connected devices.
Sending a quick message from your phone to your laptop or to a colleague’s device is surprisingly frustrating. Most solutions require WhatsApp, Telegram, or cloud apps, which is overkill for a single text. LanText solves this by providing direct, local, real-time messaging with minimal setup.
- Beautiful Terminal UI: Claude Code-inspired interface with rich colors, animated spinners, and an interactive select menu.
- Auto-discovery: Automatically finds the chat server on the network
- Multiple clients: Support for multiple simultaneous connections
- Hotspot mode: WiFi hotspot devices can both host and participate in chat
- Real-time messaging: Instant message delivery across the network
- Global CLI: Install once, run anywhere with
lantextcommand
npm install -g lantext
lantextFor a local installation, install the package without the global flag and run
it with npx:
npm install lantext
npx lantextgit clone https://github.com/Victozee26/LanText.git
cd LanText
npm install
npm run build
npm startSimply run lantext and choose your mode:
lantextThe CLI will ask you whether you want to be a WiFi client (connect to existing network) or hotspot (create server).
You can also specify the mode directly:
# Connect as WiFi client
lantext client
# or
lantext wifi
# Start as hotspot server
lantext hotspot
# or
lantext serverWhen running from a source checkout, use npm start -- <mode> after building:
npm start -- client
npm start -- hotspotLanText supports sending multiple lines of text as a single message. To send a multi-line message:
- Type your first line and press Enter
- Continue typing additional lines, pressing Enter after each line
- When done, press Enter again on an empty line to send the entire message
Example:
❯ Line 1 of my message
❯ Line 2 of my message
❯ Line 3 of my message
✓ Sent 12:34:56
│ Line 1 of my message
│ Line 2 of my message
│ Line 3 of my message
❯
DEBUG=true lantext clientSERVER=192.168.1.5 lantext clientLanText uses UDP discovery to find servers on the local network and TCP for
reliable messaging. The default ports are UDP 41237 for discovery and TCP
41236 for chat connections.
The TypeScript source is compiled from src/ to dist/ before the CLI runs.
- Main (
src/main.ts): CLI entry point, argument parsing, and interactive mode selection. - Client mode (
src/client-mode.ts): Coordinates client networking, input, and terminal updates. - Server mode (
src/server-mode.ts): Coordinates hotspot networking, input, and terminal updates. - Client transport (
src/client.ts): Discovers servers, manages TCP connections, parses incoming messages, and reconnects. - Hotspot transport (
src/hotspot.ts): Runs the TCP server, answers UDP discovery, and broadcasts messages. - Input (
src/input.ts): Handles terminal, pasted, multi-line, and piped input. - UI (
src/ui.ts): Provides terminal styling, banners, status lines, and message formatting. - Utilities (
src/utils.ts): Defines ports, discovery messages, network helpers, and message envelopes.
Messages use newline-delimited JSON envelopes with sender, timestamp, and
text fields.
# Compile TypeScript to dist/
npm run build
# Type-check without emitting files
npm run typecheck
# Build and start with debug logging enabled
npm run devThere is currently no automated test script in package.json. Network changes
should be verified with a client and hotspot on the appropriate local devices.
Environment variables:
DEBUG=true- Enable debug loggingSERVER=<ip>- Specify server IP address (skips discovery)
MIT
