A minimal, production-ready real-time chat demo built with Bun, Socket.io, and a Vite + React + shadcn/ui frontend.
No database. No external services. Just connect and chat.
Make sure Bun is installed (curl -fsSL https://bun.sh/install | bash).
git clone https://github.com/nodiry/chat-demo.git
cd chat-demo
chmod +x run.sh
./run.shrun.sh installs dependencies for both server/ and client/, then starts them in parallel.
| Service | URL |
|---|---|
| Frontend | http://localhost:5173 |
| Backend | http://localhost:3005 |
- Open http://localhost:5173 in two browser tabs (or two browsers).
- Tab A: enter name
alice, chatting withbob→ Start Chatting. - Tab B: enter name
bob, chatting withalice→ Start Chatting. - Messages sync in real time. The sidebar shows live ping and render time.
- When both users close the chat, all messages are wiped from memory automatically.
| Layer | Technology |
|---|---|
| Runtime | Bun |
| Backend | Bun native HTTP + Socket.io |
| Storage | In-memory (Maps) — no database required |
| Frontend | React 19 + Vite |
| UI | shadcn/ui + Tailwind CSS v4 |
| Language | TypeScript |
chat-demo/
├── server/ # Bun HTTP + Socket.io backend
│ ├── main.ts # Single entry point
│ ├── package.json
│ └── README.md # Socket.io integration guide
│
├── client/ # React SPA
│ ├── src/
│ │ ├── App.tsx # Login + Chat views
│ │ ├── context/socket.tsx # Socket context + speed metrics
│ │ └── components/ui/ # shadcn components incl. sidebar
│ ├── package.json
│ └── README.md # UI & component docs
│
└── run.sh # One-command launcher
| Action | Command |
|---|---|
| Start everything | ./run.sh |
| Backend only | cd server && bun run dev |
| Frontend only | cd client && bun run dev |
| Stop | Ctrl+C |
- Zero external dependencies — no MongoDB, Redis, or Memcached needed
- Auto-cleanup — conversation messages are deleted when both users disconnect
- Live speed metrics — socket ping RTT and React render time shown in sidebar
- Dark / light theme — persisted to localStorage
- Peer presence — real-time online/offline indicator
"Fast servers, clean UI, zero nonsense — just chat."