create-instant-app 1.0.21 → 1.0.22
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-instant-app",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.22",
|
|
4
4
|
"description": "Scaffold a new web/mobile app with InstantDB",
|
|
5
5
|
"homepage": "https://github.com/instantdb/instant/tree/main/client/packages/create-instant-app",
|
|
6
6
|
"repository": {
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"slugify": "^1.6.6",
|
|
36
36
|
"sort-package-json": "^2.10.0",
|
|
37
37
|
"tiged": "^2.12.7",
|
|
38
|
-
"@instantdb/platform": "1.0.
|
|
39
|
-
"@instantdb/version": "1.0.
|
|
40
|
-
"instant-cli": "1.0.
|
|
38
|
+
"@instantdb/platform": "1.0.22",
|
|
39
|
+
"@instantdb/version": "1.0.22",
|
|
40
|
+
"instant-cli": "1.0.22"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@anthropic-ai/sdk": "^0.60.0",
|
package/template/rules/AGENTS.md
CHANGED
|
@@ -13,6 +13,8 @@ Instant provides client-side JS SDKs and an admin SDK:
|
|
|
13
13
|
- `@instantdb/core` --- vanilla JS
|
|
14
14
|
- `@instantdb/react` --- React
|
|
15
15
|
- `@instantdb/react-native` --- React Native / Expo
|
|
16
|
+
- `@instantdb/solidjs` --- SolidJS
|
|
17
|
+
- `@instantdb/svelte` --- Svelte
|
|
16
18
|
- `@instantdb/admin` --- backend scripts / servers
|
|
17
19
|
|
|
18
20
|
When installing, always check what package manager the project uses (npm, pnpm,
|
|
@@ -256,6 +258,40 @@ const { data } = db.useQuery({ posts: { image: {} } });
|
|
|
256
258
|
<img src={post.image.url} />
|
|
257
259
|
```
|
|
258
260
|
|
|
261
|
+
# CRITICAL Rooms Guidelines
|
|
262
|
+
|
|
263
|
+
CRITICAL: Hooks for presence and topics live on `db.rooms` and take the room as the first arg. The room object itself has no `usePresence` or `publishPresence` methods.
|
|
264
|
+
|
|
265
|
+
Rooms host two ephemeral primitives: presence (cursor positions, who's online) and topics (live reactions). Use them only for data that should NOT persist. Persisted data via `transact` already syncs in real-time to all subscribed clients, so reach for rooms only when the data is intentionally ephemeral.
|
|
266
|
+
|
|
267
|
+
## Presence
|
|
268
|
+
|
|
269
|
+
Each peer publishes a presence object readable by all other peers in the room. Retained for the connection and cleaned up automatically on disconnect.
|
|
270
|
+
|
|
271
|
+
```tsx
|
|
272
|
+
const room = db.room('chat', 'main');
|
|
273
|
+
const { user, peers, publishPresence } = db.rooms.usePresence(room, {
|
|
274
|
+
initialPresence: { x: 0, y: 0 },
|
|
275
|
+
});
|
|
276
|
+
// peers is keyed by peerId, not an array. Use Object.values(peers) to iterate
|
|
277
|
+
publishPresence({ x: 50, y: 50 });
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
## Topics
|
|
281
|
+
|
|
282
|
+
Topic payloads aren't retained. Peers only see events fired while they're listening.
|
|
283
|
+
|
|
284
|
+
```tsx
|
|
285
|
+
const room = db.room('chat', 'main');
|
|
286
|
+
|
|
287
|
+
const publishEmoji = db.rooms.usePublishTopic(room, 'emoji');
|
|
288
|
+
publishEmoji({ name: 'fire' });
|
|
289
|
+
|
|
290
|
+
db.rooms.useTopicEffect(room, 'emoji', (payload) => {
|
|
291
|
+
animateEmoji(payload.name);
|
|
292
|
+
});
|
|
293
|
+
```
|
|
294
|
+
|
|
259
295
|
# Best Practices
|
|
260
296
|
|
|
261
297
|
## Pass `schema` when initializing Instant
|
|
@@ -19,6 +19,8 @@ Instant provides client-side JS SDKs and an admin SDK:
|
|
|
19
19
|
- `@instantdb/core` --- vanilla JS
|
|
20
20
|
- `@instantdb/react` --- React
|
|
21
21
|
- `@instantdb/react-native` --- React Native / Expo
|
|
22
|
+
- `@instantdb/solidjs` --- SolidJS
|
|
23
|
+
- `@instantdb/svelte` --- Svelte
|
|
22
24
|
- `@instantdb/admin` --- backend scripts / servers
|
|
23
25
|
|
|
24
26
|
When installing, always check what package manager the project uses (npm, pnpm,
|
|
@@ -262,6 +264,40 @@ const { data } = db.useQuery({ posts: { image: {} } });
|
|
|
262
264
|
<img src={post.image.url} />
|
|
263
265
|
```
|
|
264
266
|
|
|
267
|
+
# CRITICAL Rooms Guidelines
|
|
268
|
+
|
|
269
|
+
CRITICAL: Hooks for presence and topics live on `db.rooms` and take the room as the first arg. The room object itself has no `usePresence` or `publishPresence` methods.
|
|
270
|
+
|
|
271
|
+
Rooms host two ephemeral primitives: presence (cursor positions, who's online) and topics (live reactions). Use them only for data that should NOT persist. Persisted data via `transact` already syncs in real-time to all subscribed clients, so reach for rooms only when the data is intentionally ephemeral.
|
|
272
|
+
|
|
273
|
+
## Presence
|
|
274
|
+
|
|
275
|
+
Each peer publishes a presence object readable by all other peers in the room. Retained for the connection and cleaned up automatically on disconnect.
|
|
276
|
+
|
|
277
|
+
```tsx
|
|
278
|
+
const room = db.room('chat', 'main');
|
|
279
|
+
const { user, peers, publishPresence } = db.rooms.usePresence(room, {
|
|
280
|
+
initialPresence: { x: 0, y: 0 },
|
|
281
|
+
});
|
|
282
|
+
// peers is keyed by peerId, not an array. Use Object.values(peers) to iterate
|
|
283
|
+
publishPresence({ x: 50, y: 50 });
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
## Topics
|
|
287
|
+
|
|
288
|
+
Topic payloads aren't retained. Peers only see events fired while they're listening.
|
|
289
|
+
|
|
290
|
+
```tsx
|
|
291
|
+
const room = db.room('chat', 'main');
|
|
292
|
+
|
|
293
|
+
const publishEmoji = db.rooms.usePublishTopic(room, 'emoji');
|
|
294
|
+
publishEmoji({ name: 'fire' });
|
|
295
|
+
|
|
296
|
+
db.rooms.useTopicEffect(room, 'emoji', (payload) => {
|
|
297
|
+
animateEmoji(payload.name);
|
|
298
|
+
});
|
|
299
|
+
```
|
|
300
|
+
|
|
265
301
|
# Best Practices
|
|
266
302
|
|
|
267
303
|
## Pass `schema` when initializing Instant
|
|
@@ -19,6 +19,8 @@ Instant provides client-side JS SDKs and an admin SDK:
|
|
|
19
19
|
- `@instantdb/core` --- vanilla JS
|
|
20
20
|
- `@instantdb/react` --- React
|
|
21
21
|
- `@instantdb/react-native` --- React Native / Expo
|
|
22
|
+
- `@instantdb/solidjs` --- SolidJS
|
|
23
|
+
- `@instantdb/svelte` --- Svelte
|
|
22
24
|
- `@instantdb/admin` --- backend scripts / servers
|
|
23
25
|
|
|
24
26
|
When installing, always check what package manager the project uses (npm, pnpm,
|
|
@@ -262,6 +264,40 @@ const { data } = db.useQuery({ posts: { image: {} } });
|
|
|
262
264
|
<img src={post.image.url} />
|
|
263
265
|
```
|
|
264
266
|
|
|
267
|
+
# CRITICAL Rooms Guidelines
|
|
268
|
+
|
|
269
|
+
CRITICAL: Hooks for presence and topics live on `db.rooms` and take the room as the first arg. The room object itself has no `usePresence` or `publishPresence` methods.
|
|
270
|
+
|
|
271
|
+
Rooms host two ephemeral primitives: presence (cursor positions, who's online) and topics (live reactions). Use them only for data that should NOT persist. Persisted data via `transact` already syncs in real-time to all subscribed clients, so reach for rooms only when the data is intentionally ephemeral.
|
|
272
|
+
|
|
273
|
+
## Presence
|
|
274
|
+
|
|
275
|
+
Each peer publishes a presence object readable by all other peers in the room. Retained for the connection and cleaned up automatically on disconnect.
|
|
276
|
+
|
|
277
|
+
```tsx
|
|
278
|
+
const room = db.room('chat', 'main');
|
|
279
|
+
const { user, peers, publishPresence } = db.rooms.usePresence(room, {
|
|
280
|
+
initialPresence: { x: 0, y: 0 },
|
|
281
|
+
});
|
|
282
|
+
// peers is keyed by peerId, not an array. Use Object.values(peers) to iterate
|
|
283
|
+
publishPresence({ x: 50, y: 50 });
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
## Topics
|
|
287
|
+
|
|
288
|
+
Topic payloads aren't retained. Peers only see events fired while they're listening.
|
|
289
|
+
|
|
290
|
+
```tsx
|
|
291
|
+
const room = db.room('chat', 'main');
|
|
292
|
+
|
|
293
|
+
const publishEmoji = db.rooms.usePublishTopic(room, 'emoji');
|
|
294
|
+
publishEmoji({ name: 'fire' });
|
|
295
|
+
|
|
296
|
+
db.rooms.useTopicEffect(room, 'emoji', (payload) => {
|
|
297
|
+
animateEmoji(payload.name);
|
|
298
|
+
});
|
|
299
|
+
```
|
|
300
|
+
|
|
265
301
|
# Best Practices
|
|
266
302
|
|
|
267
303
|
## Pass `schema` when initializing Instant
|