Public
Remixed
Starter template with client-side React & Hono server
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.

💬 Real-Time Chat

A real-time chat room built with React + Hono on Val Town. Users enter a username and start chatting instantly — messages appear in real-time via polling.

Features

  • Username-based join — enter a name to start chatting
  • Real-time updates — messages poll every 1.5 seconds for new content
  • Persistent history — last 50 messages loaded on join
  • Color-coded usernames — each user gets a unique color
  • Dark theme — modern chat UI with bubble-style messages

Architecture

Rendering mermaid diagram...

File structure

index.ts                         ← Hono backend + API routes
frontend/
  index.html                     ← HTML shell
  index.tsx                      ← React entrypoint
  favicon.svg                    ← Chat icon
  components/
    App.tsx                      ← Root component (routing)
    JoinScreen.tsx               ← Username entry screen
    ChatRoom.tsx                 ← Chat interface with polling