A PWA with offline-first support and CRDT-based sync over a shared WebSocket connection.
Prerequisite: Node.js 18+
- Clone this repository
- Install dependencies:
npm i - Start the development server:
node server.js - Open
http://localhost:8000in your browser
- Installable app: a native App-like UX
- Real-time notifications using Websockets
- Offline support (works without an internet or server)
- Background sync and caching with service worker and CRDT
- Broad device/browser support, Linux, MacOS, Win, iOS, Android
- Single WebSocket connection shared across tabs
- Automatic reconnection, retrieving lost messages
- HTTPS headers and CORS support
- Reactions: like, dislike, etc. with counters
- Changes to
./Application/static/domain.js- Move Logger to
logger.jsand export it as a singleton - Decompose
ChatApplication: extractui.jsanddomain.js - Domain logic should live in
domain.js - Visualization and UI logic should live in
ui.js
- Move Logger to
- Unify CRDT implementations and reuse across the app, service worker, and server
- Extract
lwwandcounterintocrdt.js; apply the Strategy pattern - Import
crdt.jsfrom the service worker and server to reuse code
- Extract
- Changes to
pwa.js- Extract utility helpers (e.g., ID generation) into
utils.js - Move
EventEmitterintoevents.js
- Extract utility helpers (e.g., ID generation) into
Copyright (c) 2025 How.Programming.Works contributors