githubnext/chopinPublic

Let's compose rich plans together

Set up the workspace and the room connection

A Bun workspace with three packages and two apps, and enough of the wire to
prove the shape works: a WebSocket carrying one room, identity asserted at the
upgrade, and presence relayed to everyone already there.

Identity is a claimed GitHub handle, stored per tab rather than per origin so
two tabs are two people. The socket URL is derived from `location` and never
configured, so localhost, a LAN address and a tunnel all work from one build;
Vite proxies `/ws` in development so the browser sees a single origin in either
mode.

A browser cannot read the status of a refused upgrade, so a connection that
never opened asks the same endpoint over HTTP to find out why. Otherwise a
rejected access key is indistinguishable from an unreachable server, and the
client would back off against a door that will not open.

Lexical, Yjs and React are deduped in Vite up front: two copies of Lexical
throw `incompatible editors` and every node operation fails quietly afterwards.
KCKrzysztof Cieslak authored
f6b9e56Patch
28 files changed+2014-0
StackedSplit
.editorconfig+13 −0
.gitignore+25 −0
.oxlintrc.json+29 −0
apps/server/package.json+17 −0
apps/server/src/config.ts+66 −0
apps/server/src/ids.ts+10 −0
apps/server/src/main.test.ts+168 −0
apps/server/src/main.ts+126 −0
apps/server/src/rooms.ts+73 −0
apps/server/src/wire.ts+70 −0
apps/server/tsconfig.json+18 −0
apps/web/index.html+12 −0
apps/web/package.json+26 −0
apps/web/src/app.tsx+167 −0
apps/web/src/identity.ts+65 −0
apps/web/src/main.tsx+20 −0
apps/web/src/theme.css+76 −0
apps/web/src/wire.ts+204 −0
apps/web/tsconfig.json+20 −0
apps/web/vite.config.ts+27 −0
bun.lock+498 −0
dprint.json+31 −0
package.json+68 −0
packages/protocol/index.d.ts+79 −0
packages/protocol/package.json+14 −0
packages/protocol/tsconfig.json+12 −0
patches/@mdxeditor%2Feditor@4.1.0.patch+49 −0
tsconfig.json+31 −0