A chat room
in your terminal.

Real-time chat rooms from the command line, no sign-up.

npx @matheussartori/hackerchat-client
Source on GitHub (opens in a new tab)
$

One server in the middle, clients around it.

Each person joins from a terminal or a browser. The server takes every message and passes it to everyone in the room.

Terminal client

Built with Ink, which is React drawn in the terminal. Rooms, who is online, a scrollable history and a fixed colour per person.

WebSocket server

A Node.js hub that opens a room when someone joins and passes messages along. No database, no sign-up, everything in memory.

JavaScript SDK

A client for the browser or Node, with React hooks. Wires any interface to the server in a few lines.

Three terminals, one minute.

The public server has been switched off. Run your own locally and point the client at it.

# Needs Node.js 24 or newer.

  1. Start the server

    Clone the repository and run it in development mode. It listens on port 9898; set PORT to change that.

    terminal 1
    git clone https://github.com/matheussartori/hackerchat-server.git
    cd hackerchat-server
    npm install
    npm run dev
    # listening on ws://0.0.0.0:9898
  2. Connect a client

    In another terminal, run the client with npx, nothing to install. --username and --room are required; --hostUri points at your server.

    terminal 2
    npx @matheussartori/hackerchat-client \
      --username alice \
      --room general \
      --hostUri ws://localhost:9898
  3. Talk

    Open one more terminal with a different name, or join from the playground at the end of the page, and watch the messages land.

    terminal 3
    npx @matheussartori/hackerchat-client \
      --username bob \
      --room general \
      --hostUri ws://localhost:9898

Join a room from this page.

The room next to this is live right now, over public Nostr relays. Type a name and join. For your own server, the form runs on the SDK below.

with your own server
import { useHackerchat } from '@matheussartori/hackerchat-js-sdk/react'

const { status, users, messages, sendMessage } = useHackerchat({
  url: 'ws://localhost:9898',
  userName: 'alice',
  roomId: 'general',
})
hackerchat nostr#general|● waiting|@guest|--:--:--
online (0)
(empty)
activity
(no activity)
messages0/0
Nothing here yet. Messages are not stored: you see what arrives while you are in the room.
guest›
0/24
enter join|name only, no sign-up

Public room: messages travel through Nostr relays and anyone can read them.

Flags, shortcuts and variables.

Everything the client and the server accept.

Client flags
Client flags
FlagDescriptionUsage
--usernameDisplay name shown in the room.required
--roomRoom to join. Created if it does not exist yet.required
--hostUriWebSocket URL of the server, with ws:// or wss://. Without it the client tries the old public address, which is switched off.recommended
Interface shortcuts
Interface shortcuts
KeyAction
EnterSend the message.
PgUp / PgDnScroll the history one page at a time.
Ctrl+U / Ctrl+DScroll the history one line at a time.
Home / EndJump to the oldest message or back to the newest.
Esc / Ctrl+CExit the client.
Server variables
Server variables
VariableDefaultDescription
PORT9898TCP port the server listens on.
LOG_LEVELerrorMinimum log level: debug, info, warning or error.
Four events cover everything.

Join a room, send a message, get the list of who is there and hear when someone comes or goes. Every frame is an event with a payload.

client sends
{ "event": "joinRoom",
  "message": { "userName": "alice",
               "roomId": "general" } }

{ "event": "message",
  "message": "hello, world" }
server replies
{ "event": "updateUsers",
  "message": [{ "id": "…", "userName": "alice" }] }

{ "event": "newUserConnected",
  "message": { "id": "…", "userName": "alice" } }

{ "event": "message",
  "message": { "userName": "alice",
               "message": "hello, world" } }

{ "event": "disconnectUser",
  "message": { "id": "…", "userName": "alice" } }
Want a shorter command?

Install the client globally and call hackerchat directly.

global install
npm install -g @matheussartori/hackerchat-client
hackerchat --username alice --room general --hostUri ws://localhost:9898