@pluv/io 0.0.0-experimental-20250527040415

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Shoubhit Dash
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,189 @@
1
+ <div align="center">
2
+ <a href="https://pluv.io/docs/introduction">
3
+ <img src="https://github.com/pluv-io/pluv/blob/master/assets/pluv-icon-192x192.png?raw=true" alt="Pluv.IO" width="156" style="border-radius:16px" />
4
+ </a>
5
+ </div>
6
+
7
+ <h1 align="center">pluv.io</h1>
8
+ <h3 align="center">TypeSafe Primitives for a Realtime Web</h3>
9
+
10
+ <p align="center">
11
+ <a href="https://www.npmjs.com/package/@pluv/io">
12
+ <img src="https://img.shields.io/npm/v/@pluv/io" alt="npm @pluv/io" />
13
+ </a>
14
+ <a href="https://github.com/pluv-io/pluv/blob/master/LICENSE">
15
+ <img alt="GitHub" src="https://img.shields.io/github/license/pluv-io/pluv" alt="License MIT" />
16
+ </a>
17
+ <a href="https://commitizen.github.io/cz-cli/">
18
+ <img src="https://img.shields.io/badge/commitizen-friendly-brightgreen.svg" alt="Commitizen friendly" />
19
+ </a>
20
+ <img src="https://badgen.net/badge/-/TypeScript?icon=typescript&label&labelColor=blue&color=555555" alt="TypeScript" />
21
+ </p>
22
+
23
+ <div align="center">
24
+ <a href="https://www.producthunt.com/posts/pluv-io?embed=true&utm_source=badge-featured&utm_medium=badge&utm_souce=badge-pluv&#0045;io" target="_blank"><img src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=961147&theme=light&t=1746462368894" alt="pluv&#0046;io - Open&#0032;source&#0032;multiplayer&#0032;APIs&#0044;&#0032;powered&#0032;by&#0032;TypeScript | Product Hunt" style="width: 250px; height: 54px;" width="250" height="54" /></a>
25
+ </div>
26
+
27
+ <h4 align="center">💕 Inspired by <a href="https://trpc.io">trpc</a> 💕 <a href="https://docs.yjs.dev/">yjs</a> 💕 <br />and <a href="https://workers.cloudflare.com/">Cloudflare Workers</a> 💕</h4>
28
+
29
+ ## Intro
30
+
31
+ **[pluv.io](https://pluv.io) allows you to more easily build realtime multiplayer experiences with a fully typesafe API and powerful abstractions as primitives, so that you can focus on building for your end users.**
32
+
33
+ Self-host on [Cloudflare Workers](https://pluv.io/docs/quickstart/cloudflare-workers) or [Node.js](https://pluv.io/docs/quickstart/nodejs); or [get started on the pluv.io network](https://pluv.io/signup).
34
+
35
+ ## Preview
36
+
37
+ Create your pluv.io backend
38
+
39
+ ```ts
40
+ // backend
41
+ const io = createIO(platformNode({ crdt: yjs }));
42
+
43
+ export const ioServer = io.server({
44
+ router: io.router({
45
+ sendGreeting: io.procedure
46
+ .input(z.object({ message: z.string() }))
47
+ .broadcast(({ message }) => ({
48
+ receiveGreeting: { message }
49
+ }))
50
+ })
51
+ });
52
+ ```
53
+
54
+ Create your frontend client with your backend types
55
+
56
+ ```ts
57
+ // frontend
58
+ const types = infer((i) => ({ io: i<typeof ioServer> }));
59
+ const io = createClient({
60
+ types,
61
+ initialStorage: yjs.doc((t) => ({
62
+ messages: t.array<string>("messages"),
63
+ })),
64
+ presence: z.object({
65
+ selectionId: z.string().nullable()
66
+ })
67
+ });
68
+
69
+ const {
70
+ event,
71
+ useBroadcast,
72
+ useMyPresence,
73
+ useOthers,
74
+ useStorage
75
+ } = createBundle(io);
76
+ ```
77
+
78
+ Use powerful primitives to build realtime features
79
+
80
+ ```tsx
81
+ // react
82
+ event.receiveGreeting.useEvent(({ data }) => { /* ... */});
83
+ // ^? const data: { message: string }
84
+
85
+ const broadcast = useBroadcast();
86
+
87
+ broadcast.sendGreeting({ message: "hello world" });
88
+ // ^? const sendGreeting: (data: { message: string }) => void
89
+
90
+ const [mySelection, update] = useMyPresence((presence) => {
91
+ // ^? const mySelection: string | null
92
+ return presence.selectionId;
93
+ });
94
+
95
+ const others = useOthers((others) => {
96
+ // ^? const others = string[]
97
+ return others.map((other) => other.presence.selectionId);
98
+ });
99
+
100
+ const [
101
+ messages,
102
+ // ^? const messages: string[] | null
103
+ sharedType
104
+ // ^? YArray<string> | null
105
+ ] = useStorage("messages");
106
+ ```
107
+
108
+ ## Documentation
109
+
110
+ The full documentation is available at [pluv.io](https://pluv.io/docs/introduction).
111
+
112
+ ## Features
113
+
114
+ - ✅ Automatic type-safety
115
+ - ✅ Basic events
116
+ - ✅ Rooms
117
+ - ✅ Authentication
118
+ - ✅ Awareness + Presence
119
+ - ✅ [CRDTs](https://en.wikipedia.org/wiki/Conflict-free_replicated_data_type)
120
+ - ✅ [Yjs](https://docs.yjs.dev/)
121
+ - ✅ [Provider](https://github.com/yjs/yjs?tab=readme-ov-file#providers)
122
+ - ✅ **Shared Types**
123
+ - ✅ [Map](https://docs.yjs.dev/api/shared-types/y.map)
124
+ - ✅ [Array](https://docs.yjs.dev/api/shared-types/y.array)
125
+ - ✅ [Text](https://docs.yjs.dev/api/shared-types/y.text)
126
+ - ✅ [XmlFragment](https://docs.yjs.dev/api/shared-types/y.xmlfragment)
127
+ - ✅ [XmlElement](https://docs.yjs.dev/api/shared-types/y.xmlelement)
128
+ - ✅ [XmlText](https://docs.yjs.dev/api/shared-types/y.xmltext)
129
+ - ✅ [Loro](https://loro.dev/) (preview)
130
+ - ✅ **Containers**
131
+ - ✅ Counter
132
+ - ✅ List
133
+ - ✅ Map
134
+ - ✅ Moveable List
135
+ - ✅ Text
136
+ - ✅ Tree
137
+ - ⬜ Studio (admin & developer panel)
138
+
139
+ ## Runtimes
140
+
141
+ - ✅ [Cloudflare Workers](https://workers.cloudflare.com/)
142
+ - **WebSocket API**
143
+ - ✅ [Hibernation API](https://developers.cloudflare.com/durable-objects/best-practices/websockets/#websocket-hibernation-api) (default, recommended)
144
+ - ✅ [Standard API](https://developers.cloudflare.com/durable-objects/best-practices/websockets/#websocket-standard-api)
145
+ - **State Persistence**
146
+ - ✅ [SQLite-backed Durable Objects](https://developers.cloudflare.com/durable-objects/best-practices/access-durable-objects-storage/#create-sqlite-backed-durable-object-class) (default, recommended)
147
+ - ✅ [Key-value storage-backed Durable Object](https://developers.cloudflare.com/durable-objects/reference/durable-objects-migrations/#create-durable-object-class-with-key-value-storage)
148
+ - ✅ [Node.js](https://nodejs.org/)
149
+ - ✅ **PubSubs**
150
+ - ✅ [Redis](https://redis.io/) (preview)
151
+ - ⬜ [MQTT](https://mqtt.org/)
152
+ - ✅ **State Persistence**
153
+ - ✅ In-memory (default)
154
+ - ✅ [Redis](https://redis.io/) (preview)
155
+
156
+ ## Frontends Frameworks
157
+
158
+ - ✅ [React.js](https://react.dev/)
159
+ - ⬜ [Solid.js](https://www.solidjs.com/)
160
+ - ⬜ [Vue.js](https://vuejs.org/)
161
+ - ⬜ [Svelte](https://svelte.dev/)
162
+
163
+ ## Packages
164
+
165
+ - [@pluv/io](https://www.npmjs.com/package/@pluv/io) - Server
166
+ - [@pluv/client](https://www.npmjs.com/package/@pluv/client) - Framework agnostic client
167
+ - [@pluv/react](https://www.npmjs.com/package/@pluv/react) - Integrate @pluv/client with React.js
168
+ - [@pluv/platform-pluv](https://www.npmjs.com/package/@pluv/platform-node) - Adapter to run on pluv.io
169
+ - [@pluv/platform-cloudflare](https://www.npmjs.com/package/@pluv/platform-cloudflare) - Adapter to run on Cloudflare Workers
170
+ - [@pluv/platform-node](https://www.npmjs.com/package/@pluv/platform-node) - Adapter to run on Node.js
171
+ - [@pluv/crdt-yjs](https://www.npmjs.com/package/@pluv/crdt-yjs) - Yjs CRDT adapter
172
+ - [@pluv/crdt-loro](https://www.npmjs.com/package/@pluv/crdt-loro) - Loro CRDT adapter
173
+ - [@pluv/persistence-redis](https://www.npmjs.com/package/@pluv/persistence-redis) - Persistence for storage on distributed systems (Node.js only)
174
+ - [@pluv/persistence-cloudflare-transactional-storage](https://www.npmjs.com/package/@pluv/persistence-cloudflare-transactional-storage) - Durable Object persistent state for WebSocket hibernation
175
+ - [@pluv/pubsub-redis](https://www.npmjs.com/package/@pluv/pubsub-redis) - PubSub for rooms across distributed systems
176
+
177
+ ## Credits
178
+
179
+ This software uses the following open source tooling and libraries:
180
+
181
+ - [Cloudflare Workers](https://workers.cloudflare.com/)
182
+ - [Node.js](https://nodejs.org/)
183
+ - [React.js](https://reactjs.org/)
184
+ - [Yjs](https://yjs.dev/)
185
+ - [Loro](https://loro.dev/)
186
+
187
+ ## License
188
+
189
+ [MIT](https://github.com/pluv-io/pluv/blob/master/LICENSE)