A realtime chat app. Messages are stored in Val Town SQLite and delivered to clients via Server-Sent Events over a single long-lived HTTP connection per client. Optimized for mobile + desktop.
Rendering mermaid diagram...
GET /api/stream?sinceId=N.id > lastSent and pushes
each new row as an SSE message event (with the row id as the event id).EventSource
automatically reconnects and resumes from Last-Event-ID. This keeps
individual isolates from piling up while preserving delivery semantics.index.ts ← Hono server + /api routes + SSE stream
database/db.ts ← SQLite schema + queries
shared/types.ts ← Message type shared by client & server
frontend/
index.html ← Shell (full-height, viewport-fit=cover for mobile)
index.tsx ← React entrypoint
components/
App.tsx ← Layout + status dot
MessageList.tsx ← Renders messages (no auto-scroll)
MessageInput.tsx ← Input + Send (no auto-focus)
hooks/
useMessages.ts ← Initial load + SSE subscription + send
100dvh layout, font-size: 16px on input to prevent
iOS zoom-on-focus, overscroll-behavior: none on body.messages_v1 table is append-only.