@fluxy-chat/create-fluxy-chat 0.5.14 → 0.5.21

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.
Files changed (53) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/dist/index.js +10 -5
  3. package/package.json +1 -1
  4. package/readme.md +2 -1
  5. package/templates/basic/package.json +19 -19
  6. package/templates/comments-board/package.json +2 -2
  7. package/templates/deal-room/package.json +2 -2
  8. package/templates/deal-room/src/App.tsx +17 -1
  9. package/templates/discord/package.json +20 -20
  10. package/templates/draw/package.json +25 -25
  11. package/templates/fleet-panel/package.json +2 -2
  12. package/templates/full/README.md +14 -4
  13. package/templates/full/fluxy.hosted.json +15 -0
  14. package/templates/full/package.json +4 -3
  15. package/templates/full/scripts/fluxy-deploy.mjs +53 -0
  16. package/templates/full/scripts/fluxy-setup.mjs +31 -7
  17. package/templates/full/src/App.tsx +14 -0
  18. package/templates/full/src/index.css +3 -3
  19. package/templates/full/src/session.ts +7 -2
  20. package/templates/full/src/vite-env.d.ts +2 -1
  21. package/templates/game-tick/package.json +2 -2
  22. package/templates/hr-feedback/package.json +1 -1
  23. package/templates/iot-panel/package.json +25 -25
  24. package/templates/javascript-live-cursors/package.json +1 -1
  25. package/templates/live-cursors/.env.example +8 -5
  26. package/templates/live-cursors/package.json +2 -2
  27. package/templates/live-cursors/src/App.tsx +19 -2
  28. package/templates/live-cursors/src/vite-env.d.ts +1 -0
  29. package/templates/live-cursors-chat/package.json +2 -2
  30. package/templates/minimal/package.json +3 -3
  31. package/templates/minimal/src/App.tsx +2 -0
  32. package/templates/polls/.env.example +13 -0
  33. package/templates/polls/README.md +13 -0
  34. package/templates/polls/index.html +12 -0
  35. package/templates/polls/package.json +24 -0
  36. package/templates/polls/src/App.tsx +135 -0
  37. package/templates/polls/src/index.css +85 -0
  38. package/templates/polls/src/main.tsx +10 -0
  39. package/templates/polls/src/session.ts +73 -0
  40. package/templates/polls/src/vite-env.d.ts +13 -0
  41. package/templates/polls/tsconfig.json +21 -0
  42. package/templates/polls/vite.config.ts +7 -0
  43. package/templates/react/.env.example +9 -5
  44. package/templates/react/README.md +7 -32
  45. package/templates/react/package.json +2 -2
  46. package/templates/react/src/App.tsx +31 -23
  47. package/templates/react/src/vite-env.d.ts +1 -0
  48. package/templates/slack/package.json +21 -21
  49. package/templates/telegram/package.json +20 -20
  50. package/templates/tiptap-room/package.json +29 -29
  51. package/templates/voice-stage/package.json +2 -2
  52. package/templates/war-room/package.json +2 -2
  53. package/templates/whiteboard/package.json +2 -2
@@ -1,43 +1,18 @@
1
1
  # FluxyChat React starter
2
2
 
3
- Minimal Vite + React app with `useChat`. First message in about 60 seconds via the public guest room.
4
-
5
- ## Quick start (guest, fastest)
6
-
7
- ```bash
8
- cp .env.example .env
9
- # Set VITE_FLUXYCHAT_WORKER_URL + VITE_FLUXYCHAT_PUBLIC_ROOM_ID (public room from console)
10
- npm install
11
- npm run dev
12
- ```
13
-
14
- Open http://localhost:5173. A guest JWT is minted automatically via `joinPublicRoomAsGuest`.
15
-
16
- ## Quick start (member JWT)
3
+ `FluxyRealtimeProvider` + `publishableKey` + `useChat`. No member JWT mint.
17
4
 
18
5
  ```bash
19
6
  cp .env.example .env
20
- # Set VITE_FLUXYCHAT_WORKER_URL + VITE_FLUXYCHAT_MEMBER_JWT + VITE_FLUXYCHAT_ROOM_ID
7
+ # Set VITE_FLUXYCHAT_WORKER_URL + VITE_FLUXYCHAT_PUBLISHABLE_KEY + room id
21
8
  npm install
22
9
  npm run dev
23
10
  ```
24
11
 
25
- ## Get credentials
26
-
27
- 1. **Guest:** create a **public** room in console, copy room ID, set `VITE_FLUXYCHAT_PUBLIC_ROOM_ID`
28
- 2. **Member:** [fluxychat.com/onboarding](https://fluxychat.com/onboarding) for Worker URL and JWT
29
- 3. **Local monorepo:** `pnpm run first-message` from the FluxyChat repo
30
-
31
- ## Scripts
32
-
33
- | Command | Description |
34
- |---------|-------------|
35
- | `npm run dev` | Vite dev server |
36
- | `npm run build` | Production build |
37
- | `npm run preview` | Preview production build |
12
+ Pin `@fluxy-chat/sdk@0.6.10` and `@fluxy-chat/react@0.1.7`.
38
13
 
39
- ## Next steps
14
+ ## Other paths
40
15
 
41
- - Add `@fluxy-chat/ui` themes (`default`, `dark`, `minimal`, `brand`)
42
- - Use `useInbox` for unified feed
43
- - See [chat-only quickstart](https://docs.fluxychat.com/docs/getting-started/chat-only-quickstart)
16
+ - Member JWT: `VITE_FLUXYCHAT_MEMBER_JWT`
17
+ - Guest session: `VITE_FLUXYCHAT_PUBLIC_ROOM_ID` (`joinPublicRoomAsGuest`)
18
+ - Credentials: [fluxychat.com/onboarding](https://fluxychat.com/onboarding) or `GET /public/demo-credentials` on a Worker that sets `PUBLIC_DEMO_PUBLISHABLE_KEY`
@@ -9,8 +9,8 @@
9
9
  "preview": "vite preview"
10
10
  },
11
11
  "dependencies": {
12
- "@fluxy-chat/react": "^0.1.4",
13
- "@fluxy-chat/sdk": "^0.6.5",
12
+ "@fluxy-chat/react": "^0.1.7",
13
+ "@fluxy-chat/sdk": "^0.6.10",
14
14
  "react": "^19.0.0",
15
15
  "react-dom": "^19.0.0",
16
16
  "zustand": "^5.0.0"
@@ -3,6 +3,7 @@ import { FluxyChatClient } from "@fluxy-chat/sdk";
3
3
  import { FluxyRealtimeProvider, useChat } from "@fluxy-chat/react";
4
4
 
5
5
  const workerUrl = import.meta.env.VITE_FLUXYCHAT_WORKER_URL?.trim();
6
+ const publishableKey = import.meta.env.VITE_FLUXYCHAT_PUBLISHABLE_KEY?.trim();
6
7
  const memberJwt = import.meta.env.VITE_FLUXYCHAT_MEMBER_JWT?.trim();
7
8
  const publicRoomId = import.meta.env.VITE_FLUXYCHAT_PUBLIC_ROOM_ID?.trim();
8
9
  const configuredRoomId = import.meta.env.VITE_FLUXYCHAT_ROOM_ID?.trim() || "demo";
@@ -21,11 +22,11 @@ function useFluxySession(): {
21
22
  error: string | null;
22
23
  } {
23
24
  const [session, setSession] = useState<FluxySession | null>(null);
24
- const [loading, setLoading] = useState(Boolean(workerUrl));
25
+ const [loading, setLoading] = useState(Boolean(workerUrl) && !publishableKey);
25
26
  const [error, setError] = useState<string | null>(null);
26
27
 
27
28
  useEffect(() => {
28
- if (!workerUrl) {
29
+ if (!workerUrl || publishableKey) {
29
30
  setLoading(false);
30
31
  return;
31
32
  }
@@ -126,30 +127,44 @@ function ChatPanel({ roomId }: { roomId: string }) {
126
127
  }
127
128
 
128
129
  export function App() {
129
- const { session, loading, error } = useFluxySession();
130
- const [roomId, setRoomId] = useState(configuredRoomId);
131
-
132
- const activeRoomId = useMemo(() => {
133
- if (session?.mode === "guest") return session.roomId;
134
- return roomId.trim() || configuredRoomId;
135
- }, [session, roomId]);
130
+ const pkRoomId = publicRoomId || configuredRoomId;
136
131
 
137
132
  if (!workerUrl) {
138
133
  return (
139
134
  <main className="shell">
140
- <h1>FluxyChat — chat-only starter</h1>
135
+ <h1>FluxyChat</h1>
141
136
  <p>
142
137
  Copy <code>.env.example</code> to <code>.env</code> and set{" "}
143
- <code>VITE_FLUXYCHAT_WORKER_URL</code>.
144
- </p>
145
- <p>
146
- Then either <code>VITE_FLUXYCHAT_MEMBER_JWT</code> (member) or{" "}
147
- <code>VITE_FLUXYCHAT_PUBLIC_ROOM_ID</code> (guest, ~60s to first message).
138
+ <code>VITE_FLUXYCHAT_WORKER_URL</code> plus <code>VITE_FLUXYCHAT_PUBLISHABLE_KEY</code>.
148
139
  </p>
149
140
  </main>
150
141
  );
151
142
  }
152
143
 
144
+ if (publishableKey) {
145
+ return (
146
+ <main className="shell">
147
+ <h1>FluxyChat</h1>
148
+ <p className="mode-badge">publishableKey · public room {pkRoomId}</p>
149
+ <FluxyRealtimeProvider workerUrl={workerUrl} publishableKey={publishableKey}>
150
+ <ChatPanel roomId={pkRoomId} />
151
+ </FluxyRealtimeProvider>
152
+ </main>
153
+ );
154
+ }
155
+
156
+ return <MemberOrGuestApp />;
157
+ }
158
+
159
+ function MemberOrGuestApp() {
160
+ const { session, loading, error } = useFluxySession();
161
+ const [roomId, setRoomId] = useState(configuredRoomId);
162
+
163
+ const activeRoomId = useMemo(() => {
164
+ if (session?.mode === "guest") return session.roomId;
165
+ return roomId.trim() || configuredRoomId;
166
+ }, [session, roomId]);
167
+
153
168
  if (loading) {
154
169
  return (
155
170
  <main className="shell">
@@ -162,14 +177,7 @@ export function App() {
162
177
  return (
163
178
  <main className="shell">
164
179
  <h1>FluxyChat</h1>
165
- <p className="error">{error ?? "Set JWT or public room ID in .env"}</p>
166
- <p>
167
- Get credentials from{" "}
168
- <a href="https://fluxychat.com/onboarding" target="_blank" rel="noreferrer">
169
- onboarding
170
- </a>{" "}
171
- or use a public room ID for guest mode.
172
- </p>
180
+ <p className="error">{error ?? "Set pk_, JWT, or public room ID in .env"}</p>
173
181
  </main>
174
182
  );
175
183
  }
@@ -2,6 +2,7 @@
2
2
 
3
3
  interface ImportMetaEnv {
4
4
  readonly VITE_FLUXYCHAT_WORKER_URL: string;
5
+ readonly VITE_FLUXYCHAT_PUBLISHABLE_KEY?: string;
5
6
  readonly VITE_FLUXYCHAT_MEMBER_JWT?: string;
6
7
  readonly VITE_FLUXYCHAT_ROOM_ID?: string;
7
8
  readonly VITE_FLUXYCHAT_PUBLIC_ROOM_ID?: string;
@@ -1,21 +1,21 @@
1
- {
2
- "name": "fluxy-bot-slack",
3
- "version": "0.1.0",
4
- "type": "module",
5
- "private": true,
6
- "scripts": {
7
- "dev": "wrangler dev",
8
- "deploy": "wrangler deploy",
9
- "type-check": "tsc --noEmit"
10
- },
11
- "dependencies": {
12
- "@fluxy-chat/sdk": "^0.6.5",
13
- "@slack/bolt": "^4.0.0",
14
- "@slack/web-api": "^7.0.0"
15
- },
16
- "devDependencies": {
17
- "@cloudflare/workers-types": "^4.0.0",
18
- "typescript": "^5.6.0",
19
- "wrangler": "^3.0.0"
20
- }
21
- }
1
+ {
2
+ "name": "fluxy-bot-slack",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "private": true,
6
+ "scripts": {
7
+ "dev": "wrangler dev",
8
+ "deploy": "wrangler deploy",
9
+ "type-check": "tsc --noEmit"
10
+ },
11
+ "dependencies": {
12
+ "@fluxy-chat/sdk": "^0.6.10",
13
+ "@slack/bolt": "^4.0.0",
14
+ "@slack/web-api": "^7.0.0"
15
+ },
16
+ "devDependencies": {
17
+ "@cloudflare/workers-types": "^4.0.0",
18
+ "typescript": "^5.6.0",
19
+ "wrangler": "^3.0.0"
20
+ }
21
+ }
@@ -1,20 +1,20 @@
1
- {
2
- "name": "fluxy-bot-telegram",
3
- "version": "0.1.0",
4
- "type": "module",
5
- "private": true,
6
- "scripts": {
7
- "dev": "wrangler dev",
8
- "deploy": "wrangler deploy",
9
- "type-check": "tsc --noEmit"
10
- },
11
- "dependencies": {
12
- "@fluxy-chat/sdk": "^0.6.5",
13
- "node-telegram-bot-api": "^0.66.0"
14
- },
15
- "devDependencies": {
16
- "@cloudflare/workers-types": "^4.0.0",
17
- "typescript": "^5.6.0",
18
- "wrangler": "^3.0.0"
19
- }
20
- }
1
+ {
2
+ "name": "fluxy-bot-telegram",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "private": true,
6
+ "scripts": {
7
+ "dev": "wrangler dev",
8
+ "deploy": "wrangler deploy",
9
+ "type-check": "tsc --noEmit"
10
+ },
11
+ "dependencies": {
12
+ "@fluxy-chat/sdk": "^0.6.10",
13
+ "node-telegram-bot-api": "^0.66.0"
14
+ },
15
+ "devDependencies": {
16
+ "@cloudflare/workers-types": "^4.0.0",
17
+ "typescript": "^5.6.0",
18
+ "wrangler": "^3.0.0"
19
+ }
20
+ }
@@ -1,29 +1,29 @@
1
- {
2
- "name": "fluxy-tiptap-room",
3
- "private": true,
4
- "version": "0.1.0",
5
- "type": "module",
6
- "scripts": {
7
- "dev": "vite",
8
- "build": "tsc -b && vite build",
9
- "preview": "vite preview"
10
- },
11
- "dependencies": {
12
- "@fluxy-chat/react": "^0.1.4",
13
- "@fluxy-chat/sdk": "^0.6.5",
14
- "@tiptap/extension-collaboration": "^2.11.5",
15
- "@tiptap/pm": "^2.11.5",
16
- "@tiptap/react": "^2.11.5",
17
- "@tiptap/starter-kit": "^2.11.5",
18
- "react": "^19.0.0",
19
- "react-dom": "^19.0.0",
20
- "yjs": "^13.6.31"
21
- },
22
- "devDependencies": {
23
- "@types/react": "^19.0.0",
24
- "@types/react-dom": "^19.0.0",
25
- "@vitejs/plugin-react": "^4.3.0",
26
- "typescript": "^5.6.0",
27
- "vite": "^6.0.0"
28
- }
29
- }
1
+ {
2
+ "name": "fluxy-tiptap-room",
3
+ "private": true,
4
+ "version": "0.1.0",
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "vite",
8
+ "build": "tsc -b && vite build",
9
+ "preview": "vite preview"
10
+ },
11
+ "dependencies": {
12
+ "@fluxy-chat/react": "^0.1.7",
13
+ "@fluxy-chat/sdk": "^0.6.10",
14
+ "@tiptap/extension-collaboration": "^2.11.5",
15
+ "@tiptap/pm": "^2.11.5",
16
+ "@tiptap/react": "^2.11.5",
17
+ "@tiptap/starter-kit": "^2.11.5",
18
+ "react": "^19.0.0",
19
+ "react-dom": "^19.0.0",
20
+ "yjs": "^13.6.31"
21
+ },
22
+ "devDependencies": {
23
+ "@types/react": "^19.0.0",
24
+ "@types/react-dom": "^19.0.0",
25
+ "@vitejs/plugin-react": "^4.3.0",
26
+ "typescript": "^5.6.0",
27
+ "vite": "^6.0.0"
28
+ }
29
+ }
@@ -9,8 +9,8 @@
9
9
  "preview": "vite preview"
10
10
  },
11
11
  "dependencies": {
12
- "@fluxy-chat/react": "^0.1.4",
13
- "@fluxy-chat/sdk": "^0.6.5",
12
+ "@fluxy-chat/react": "^0.1.7",
13
+ "@fluxy-chat/sdk": "^0.6.10",
14
14
  "react": "^19.0.0",
15
15
  "react-dom": "^19.0.0",
16
16
  "zustand": "^5.0.0"
@@ -9,8 +9,8 @@
9
9
  "preview": "vite preview"
10
10
  },
11
11
  "dependencies": {
12
- "@fluxy-chat/react": "^0.1.4",
13
- "@fluxy-chat/sdk": "^0.6.5",
12
+ "@fluxy-chat/react": "^0.1.7",
13
+ "@fluxy-chat/sdk": "^0.6.10",
14
14
  "@fluxy-chat/ui": "^0.1.4",
15
15
  "react": "^19.0.0",
16
16
  "react-dom": "^19.0.0",
@@ -9,8 +9,8 @@
9
9
  "preview": "vite preview"
10
10
  },
11
11
  "dependencies": {
12
- "@fluxy-chat/react": "^0.1.4",
13
- "@fluxy-chat/sdk": "^0.6.5",
12
+ "@fluxy-chat/react": "^0.1.7",
13
+ "@fluxy-chat/sdk": "^0.6.10",
14
14
  "react": "^19.0.0",
15
15
  "react-dom": "^19.0.0",
16
16
  "yjs": "^13.6.31",