packages/
Backend common
Server-only collaboration and access operations shared by HTTP, WebSocket, and worker apps.
There is exactly one write path for room data, and all three backend services use it: the commit is checked against the caller's role, replayed mutations are dropped, the batch is validated and reconciled, and the result lands in the live store, falling back to the database when Redis is unavailable.
What it owns
- Applying room commits: roles, dedupe, validation, reconcile, persist
- Attaching image files to scenes within size and count caps
- Reading the sync head for snapshots, warming the live store
- Shared WebSocket transport helpers: heartbeat, origins, limits, close codes
Files
File list and purposes from the folder README.
| File | Purpose |
|---|---|
src/collaboration.ts | Commit, file-attach, and sync-read operations. |
src/presenceTransport.ts | Helpers shared by the HTTP ticket issuer and the presence server. |
src/index.ts | Package entry. |
Dependencies
| Library | Version range | Why it is used here |
|---|---|---|
| dotenvDeclared but not used in source | ^17.4.2 | Loads local environment files in development. |
Development and tooling (2)
| Library | Version range | Why it is used here |
|---|---|---|
| TypeScript type definitions@types/node | 26.4.1 | Type declarations for the packages used here. |
| Vitest | ^5.0.1 | Runs the unit and regression test suites. |
Dependencies as of commit b0026d9.
Internal packages used
Laying out backend-common package…
BrowserAPIRealtimeCacheDatabaseShareddurableephemeral
Talks to
Sources: packages/backend-common/README.md, packages/backend-common/src/README.md, packages/backend-common/src/collaboration.ts, packages/backend-common/src/presenceTransport.ts (documented at commit b0026d9)