Anonymous chat anywhere with localhost web interface - Web Package
npm install barechat-webAnonymous chat anywhere with localhost web interface
|project |version |
|--------|--------|
| terminal | !NPM Version |
| web (this) | !NPM Version |
- Instant chat with localhost web UI
- Fully p2p as barechat, no server required
- Modern web interface with real-time messaging
- Compatible with barechat CLI clients
Need bare runtime installed through npm. Could install globally using:
npm i -g bare
Could install with command npm i -g barechat-web or run directly with npx barechat-web.
To test this chat app, in one terminal run:
``sh`
> npx barechat-web soccer
==================
BareChat Web server started on port 54321
Open your browser and navigate to http://localhost:54321
==================
[info] Attempting to join room with topic: 8f27f432fcbaa4b5180a1cc7a8fa166a93cda3c1bce6f19922dd519d02f4bb39
[info] Successfully joined room: 8f27f432fcbaa4b5180a1cc7a8fa166a93cda3c1bce6f19922dd519d02f4bb39
You can send soccer, p2p or any string you like to discover the room.
In another terminal use the same command, or the hashcode received from the first terminal's output:
`sh`
> npx barechat-web 8f27f432fcbaa4b5180a1cc7a8fa166a93cda3c1bce6f19922dd519d02f4bb39
==================
BareChat Web server started on port 54322
Open your browser and navigate to http://localhost:54322
==================
[info] Attempting to join room with topic: 8f27f432fcbaa4b5180a1cc7a8fa166a93cda3c1bce6f19922dd519d02f4bb39
[info] Successfully joined room: 8f27f432fcbaa4b5180a1cc7a8fa166a93cda3c1bce6f19922dd519d02f4bb39
> And it's fully compatible to chat with barechat CLI clients
Or you can simply call:
> npx barechat-web
Which will randomly generate a room with hashcode. By announcing the hashcode somewhere you can chat anonymously through the web interface.
- Real-time Messaging: Messages appear instantly without page refresh
- Peer Status: See when peers join or leave the chat
- Room Information: Display current room topic and connected peers count
- Command Support: Use commands like join and info
- Responsive Design: Works on desktop and mobile browsers
This package is part of the BareChat monorepo. See the root README for development setup instructions.
`bashFrom the packages/web directory
npm run dev
The web server will start on a random available port and you can open your browser to access it.
$3
You can also import and use the web server functionality in your project:
`js
import { createChatServer } from 'barechat-web/lib/server'
import { createWebSocketServer } from 'barechat-web/lib/ws'
import { getBackend } from 'barechat-core'// Create your own web chat interface
const backend = getBackend()
const server = createChatServer(htmlContent)
const wsServer = createWebSocketServer({
webServer: server,
// ... your configuration
})
``- Built on barechat-core - the reusable P2P networking logic
- Uses RPGUI for UI components
- WebSocket implementation for real-time communication
MIT
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.