create-fluxstack 1.15.0 → 1.17.0

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 (142) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/LLMD/INDEX.md +4 -3
  3. package/LLMD/resources/live-binary-delta.md +507 -0
  4. package/LLMD/resources/live-components.md +1 -0
  5. package/LLMD/resources/live-rooms.md +731 -333
  6. package/app/client/src/App.tsx +23 -14
  7. package/app/client/src/components/AppLayout.tsx +4 -4
  8. package/app/client/src/live/AuthDemo.tsx +4 -4
  9. package/app/client/src/live/PingPongDemo.tsx +199 -0
  10. package/app/client/src/live/RoomChatDemo.tsx +187 -22
  11. package/app/client/src/live/SharedCounterDemo.tsx +142 -0
  12. package/app/server/live/LivePingPong.ts +61 -0
  13. package/app/server/live/LiveRoomChat.ts +106 -38
  14. package/app/server/live/LiveSharedCounter.ts +73 -0
  15. package/app/server/live/rooms/ChatRoom.ts +68 -0
  16. package/app/server/live/rooms/CounterRoom.ts +51 -0
  17. package/app/server/live/rooms/DirectoryRoom.ts +42 -0
  18. package/app/server/live/rooms/PingRoom.ts +40 -0
  19. package/core/build/bundler.ts +40 -26
  20. package/core/build/flux-plugins-generator.ts +325 -325
  21. package/core/build/index.ts +92 -21
  22. package/core/cli/command-registry.ts +44 -46
  23. package/core/cli/commands/build.ts +11 -6
  24. package/core/cli/commands/create.ts +7 -5
  25. package/core/cli/commands/dev.ts +6 -5
  26. package/core/cli/commands/help.ts +3 -2
  27. package/core/cli/commands/make-plugin.ts +8 -7
  28. package/core/cli/commands/plugin-add.ts +60 -43
  29. package/core/cli/commands/plugin-deps.ts +73 -57
  30. package/core/cli/commands/plugin-list.ts +44 -41
  31. package/core/cli/commands/plugin-remove.ts +33 -22
  32. package/core/cli/generators/component.ts +770 -769
  33. package/core/cli/generators/controller.ts +9 -8
  34. package/core/cli/generators/index.ts +148 -146
  35. package/core/cli/generators/interactive.ts +228 -227
  36. package/core/cli/generators/plugin.ts +11 -10
  37. package/core/cli/generators/prompts.ts +83 -82
  38. package/core/cli/generators/route.ts +7 -6
  39. package/core/cli/generators/service.ts +10 -9
  40. package/core/cli/generators/template-engine.ts +2 -1
  41. package/core/cli/generators/types.ts +7 -7
  42. package/core/cli/generators/utils.ts +191 -191
  43. package/core/cli/index.ts +9 -8
  44. package/core/cli/plugin-discovery.ts +2 -2
  45. package/core/client/hooks/useAuth.ts +48 -48
  46. package/core/client/index.ts +0 -16
  47. package/core/client/standalone.ts +18 -17
  48. package/core/client/state/createStore.ts +192 -192
  49. package/core/client/state/index.ts +14 -14
  50. package/core/config/index.ts +1 -0
  51. package/core/framework/client.ts +131 -131
  52. package/core/framework/index.ts +7 -7
  53. package/core/framework/server.ts +72 -112
  54. package/core/framework/types.ts +2 -2
  55. package/core/plugins/built-in/live-components/commands/create-live-component.ts +6 -3
  56. package/core/plugins/built-in/monitoring/index.ts +110 -68
  57. package/core/plugins/built-in/static/index.ts +2 -2
  58. package/core/plugins/built-in/swagger/index.ts +9 -9
  59. package/core/plugins/built-in/vite/index.ts +3 -3
  60. package/core/plugins/built-in/vite/vite-dev.ts +3 -3
  61. package/core/plugins/config.ts +50 -47
  62. package/core/plugins/discovery.ts +10 -4
  63. package/core/plugins/executor.ts +2 -2
  64. package/core/plugins/index.ts +206 -203
  65. package/core/plugins/manager.ts +21 -20
  66. package/core/plugins/registry.ts +76 -12
  67. package/core/plugins/types.ts +14 -14
  68. package/core/server/framework.ts +3 -189
  69. package/core/server/live/auto-generated-components.ts +11 -35
  70. package/core/server/live/index.ts +41 -36
  71. package/core/server/live/websocket-plugin.ts +48 -3
  72. package/core/server/middleware/elysia-helpers.ts +16 -15
  73. package/core/server/middleware/errorHandling.ts +14 -14
  74. package/core/server/middleware/index.ts +31 -31
  75. package/core/server/plugins/database.ts +181 -180
  76. package/core/server/plugins/static-files-plugin.ts +4 -3
  77. package/core/server/plugins/swagger.ts +11 -8
  78. package/core/server/rooms/RoomBroadcaster.ts +11 -10
  79. package/core/server/rooms/RoomSystem.ts +14 -11
  80. package/core/server/services/BaseService.ts +7 -7
  81. package/core/server/services/ServiceContainer.ts +5 -5
  82. package/core/server/services/index.ts +8 -8
  83. package/core/templates/create-project.ts +28 -27
  84. package/core/testing/index.ts +9 -9
  85. package/core/testing/setup.ts +73 -73
  86. package/core/types/api.ts +168 -168
  87. package/core/types/config.ts +5 -5
  88. package/core/types/index.ts +1 -1
  89. package/core/types/plugin.ts +2 -2
  90. package/core/types/types.ts +3 -3
  91. package/core/utils/build-logger.ts +324 -324
  92. package/core/utils/config-schema.ts +480 -480
  93. package/core/utils/env.ts +10 -8
  94. package/core/utils/errors/codes.ts +114 -114
  95. package/core/utils/errors/handlers.ts +30 -20
  96. package/core/utils/errors/index.ts +54 -46
  97. package/core/utils/errors/middleware.ts +113 -113
  98. package/core/utils/helpers.ts +19 -16
  99. package/core/utils/logger/colors.ts +114 -114
  100. package/core/utils/logger/config.ts +2 -2
  101. package/core/utils/logger/formatter.ts +82 -82
  102. package/core/utils/logger/group-logger.ts +101 -101
  103. package/core/utils/logger/index.ts +13 -3
  104. package/core/utils/logger/startup-banner.ts +2 -2
  105. package/core/utils/logger/winston-logger.ts +152 -152
  106. package/core/utils/monitoring/index.ts +211 -211
  107. package/core/utils/sync-version.ts +67 -66
  108. package/core/utils/version.ts +1 -1
  109. package/package.json +11 -6
  110. package/playwright-report/index.html +85 -0
  111. package/playwright.config.ts +31 -0
  112. package/plugins/crypto-auth/client/CryptoAuthClient.ts +302 -302
  113. package/plugins/crypto-auth/client/components/index.ts +11 -11
  114. package/plugins/crypto-auth/client/index.ts +11 -11
  115. package/plugins/crypto-auth/package.json +65 -65
  116. package/plugins/crypto-auth/server/CryptoAuthService.ts +185 -185
  117. package/plugins/crypto-auth/server/middlewares/cryptoAuthAdmin.ts +6 -5
  118. package/plugins/crypto-auth/server/middlewares/cryptoAuthPermissions.ts +6 -5
  119. package/plugins/crypto-auth/server/middlewares/cryptoAuthRequired.ts +3 -3
  120. package/plugins/crypto-auth/server/middlewares/index.ts +22 -22
  121. package/plugins/crypto-auth/server/middlewares.ts +19 -19
  122. package/tsconfig.json +4 -1
  123. package/vite.config.ts +13 -0
  124. package/app/client/.live-stubs/LiveAdminPanel.js +0 -5
  125. package/app/client/.live-stubs/LiveChat.js +0 -7
  126. package/app/client/.live-stubs/LiveCounter.js +0 -9
  127. package/app/client/.live-stubs/LiveForm.js +0 -11
  128. package/app/client/.live-stubs/LiveLocalCounter.js +0 -8
  129. package/app/client/.live-stubs/LiveRoomChat.js +0 -10
  130. package/app/client/.live-stubs/LiveTodoList.js +0 -9
  131. package/app/client/.live-stubs/LiveUpload.js +0 -15
  132. package/app/client/src/live/ChatDemo.tsx +0 -107
  133. package/app/client/src/live/LiveDebuggerPanel.tsx +0 -779
  134. package/app/client/src/live/TodoListDemo.tsx +0 -158
  135. package/app/server/live/LiveChat.ts +0 -78
  136. package/app/server/live/LiveTodoList.ts +0 -110
  137. package/app/server/live/register-components.ts +0 -19
  138. package/core/build/live-components-generator.ts +0 -312
  139. package/core/client/components/LiveDebugger.tsx +0 -1324
  140. package/core/live/ComponentRegistry.ts +0 -403
  141. package/core/live/types.ts +0 -241
  142. package/workspace.json +0 -6
package/tsconfig.json CHANGED
@@ -28,7 +28,10 @@
28
28
  "@config/*": ["./config/*"],
29
29
  "@app/*": ["./app/*"],
30
30
  "@shared/*": ["./app/shared/*"],
31
- "@plugins/*": ["./plugins/*"]
31
+ "@plugins/*": ["./plugins/*"],
32
+ "@fluxstack/live": ["../fluxstack-live/packages/core/src/index.ts"],
33
+ "@fluxstack/live-client": ["../fluxstack-live/packages/client/src/index.ts"],
34
+ "@fluxstack/live-react": ["../fluxstack-live/packages/react/src/index.ts"]
32
35
  },
33
36
 
34
37
  // Best practices
package/vite.config.ts CHANGED
@@ -69,6 +69,19 @@ export default defineConfig({
69
69
  host: clientConfig.vite.host,
70
70
  port: clientConfig.vite.port,
71
71
  clientPort: clientConfig.vite.port
72
+ },
73
+
74
+ proxy: {
75
+ '/api/': {
76
+ target: 'http://localhost:3000',
77
+ changeOrigin: true,
78
+ // WebSocket goes directly to port 3000 (configured in App.tsx)
79
+ // to avoid Vite proxy overhead and HMR contention
80
+ },
81
+ '/swagger': {
82
+ target: 'http://localhost:3000',
83
+ changeOrigin: true,
84
+ },
72
85
  }
73
86
  },
74
87
 
@@ -1,5 +0,0 @@
1
- export class LiveAdminPanel {
2
- static componentName = 'LiveAdminPanel'
3
- static defaultState = {}
4
- static publicActions = ['getAuthInfo', 'init', 'listUsers', 'addUser', 'deleteUser', 'clearAudit']
5
- }
@@ -1,7 +0,0 @@
1
- export class LiveChat {
2
- static componentName = 'LiveChat'
3
- static defaultState = {
4
- messages: []
5
- }
6
- static publicActions = ['sendMessage']
7
- }
@@ -1,9 +0,0 @@
1
- export class LiveCounter {
2
- static componentName = 'LiveCounter'
3
- static defaultState = {
4
- count: 0,
5
- lastUpdatedBy: null,
6
- connectedUsers: 0
7
- }
8
- static publicActions = ['increment', 'decrement', 'reset']
9
- }
@@ -1,11 +0,0 @@
1
- export class LiveForm {
2
- static componentName = 'LiveForm'
3
- static defaultState = {
4
- name: '',
5
- email: '',
6
- message: '',
7
- submitted: false,
8
- submittedAt: null
9
- }
10
- static publicActions = ['submit', 'reset', 'validate', 'setValue']
11
- }
@@ -1,8 +0,0 @@
1
- export class LiveLocalCounter {
2
- static componentName = 'LiveLocalCounter'
3
- static defaultState = {
4
- count: 0,
5
- clicks: 0
6
- }
7
- static publicActions = ['increment', 'decrement', 'reset']
8
- }
@@ -1,10 +0,0 @@
1
- export class LiveRoomChat {
2
- static componentName = 'LiveRoomChat'
3
- static defaultState = {
4
- username: '',
5
- activeRoom: null,
6
- rooms: [],
7
- messages: {}
8
- }
9
- static publicActions = ['joinRoom', 'leaveRoom', 'switchRoom', 'sendMessage', 'setUsername']
10
- }
@@ -1,9 +0,0 @@
1
- export class LiveTodoList {
2
- static componentName = 'LiveTodoList'
3
- static defaultState = {
4
- todos: [],
5
- totalCreated: 0,
6
- connectedUsers: 0
7
- }
8
- static publicActions = ['addTodo', 'toggleTodo', 'removeTodo', 'clearCompleted']
9
- }
@@ -1,15 +0,0 @@
1
- export class LiveUpload {
2
- static componentName = 'LiveUpload'
3
- static defaultState = {
4
- status: 'idle',
5
- progress: 0,
6
- fileName: '',
7
- fileSize: 0,
8
- fileType: '',
9
- fileUrl: '',
10
- bytesUploaded: 0,
11
- totalBytes: 0,
12
- error: null
13
- }
14
- static publicActions = ['startUpload', 'updateProgress', 'completeUpload', 'failUpload', 'reset']
15
- }
@@ -1,107 +0,0 @@
1
- import { useEffect, useMemo, useRef, useState } from 'react'
2
- import { Live } from '@/core/client'
3
- import { LiveChat } from '@server/live/LiveChat'
4
-
5
- export function ChatDemo() {
6
- const [text, setText] = useState('')
7
- const [user, setUser] = useState('')
8
- const containerRef = useRef<HTMLDivElement | null>(null)
9
- const wasNearBottomRef = useRef(true)
10
- const defaultUser = useMemo(() => {
11
- if (typeof crypto !== 'undefined' && 'randomUUID' in crypto) {
12
- return `user-${crypto.randomUUID().slice(0, 6)}`
13
- }
14
- return `user-${Math.random().toString(36).slice(2, 8)}`
15
- }, [])
16
-
17
- const chat = Live.use(LiveChat, {
18
- room: 'global-chat',
19
- initialState: LiveChat.defaultState,
20
- persistState: false
21
- })
22
-
23
- const handleSend = async () => {
24
- if (!text.trim()) return
25
- const finalUser = user.trim() || defaultUser
26
- await chat.sendMessage({ user: finalUser, text })
27
- setText('')
28
- }
29
-
30
- useEffect(() => {
31
- const el = containerRef.current
32
- if (!el) return
33
-
34
- if (wasNearBottomRef.current) {
35
- el.scrollTop = el.scrollHeight
36
- }
37
- }, [chat.$state.messages.length])
38
-
39
- const handleScroll = () => {
40
- const el = containerRef.current
41
- if (!el) return
42
- const distance = el.scrollHeight - (el.scrollTop + el.clientHeight)
43
- wasNearBottomRef.current = distance < 80
44
- }
45
-
46
- return (
47
- <div className="bg-white/5 backdrop-blur-sm border border-white/10 rounded-2xl p-4 sm:p-6 md:p-8 w-full max-w-2xl mx-auto">
48
- <h2 className="text-2xl font-bold text-white mb-2 text-center">Chat Compartilhado</h2>
49
- <p className="text-gray-400 text-sm text-center mb-4">
50
- Sala global em tempo real. Abra em várias abas para testar.
51
- </p>
52
-
53
- <div className="flex flex-wrap items-center gap-2 mb-4 text-xs">
54
- <span className={`px-3 py-1 rounded-full ${chat.$connected ? 'bg-emerald-500/20 text-emerald-300' : 'bg-red-500/20 text-red-300'}`}>
55
- {chat.$connected ? 'Conectado' : 'Desconectado'}
56
- </span>
57
- <span className="text-gray-400">Você: {user.trim() || defaultUser}</span>
58
- </div>
59
-
60
- <div className="mb-4">
61
- <label className="block text-xs text-gray-400 mb-2">Seu nome</label>
62
- <input
63
- value={user}
64
- onChange={(e) => setUser(e.target.value)}
65
- placeholder={`Ex: ${defaultUser}`}
66
- className="w-full px-4 py-2 rounded-lg bg-white/10 border border-white/20 text-white placeholder-gray-500 focus:outline-none focus:ring-2 focus:ring-purple-500/50"
67
- />
68
- </div>
69
-
70
- <div
71
- ref={containerRef}
72
- onScroll={handleScroll}
73
- className="bg-black/40 border border-white/10 rounded-xl p-3 sm:p-5 h-72 sm:h-96 md:h-[28rem] overflow-auto space-y-3"
74
- >
75
- {chat.$state.messages.length === 0 && (
76
- <div className="text-gray-500 text-sm text-center">Nenhuma mensagem ainda</div>
77
- )}
78
- {chat.$state.messages.map((m) => (
79
- <div key={m.id} className="text-sm">
80
- <span className="text-purple-300 font-semibold">{m.user}</span>
81
- <span className="text-gray-500 text-xs ml-2">{new Date(m.timestamp).toLocaleTimeString()}</span>
82
- <div className="text-gray-200">{m.text}</div>
83
- </div>
84
- ))}
85
- </div>
86
-
87
- <div className="mt-4 flex gap-2">
88
- <input
89
- value={text}
90
- onChange={(e) => setText(e.target.value)}
91
- onKeyDown={(e) => {
92
- if (e.key === 'Enter') void handleSend()
93
- }}
94
- placeholder="Digite uma mensagem..."
95
- className="flex-1 px-4 py-2 rounded-lg bg-white/10 border border-white/20 text-white placeholder-gray-500 focus:outline-none focus:ring-2 focus:ring-purple-500/50"
96
- />
97
- <button
98
- onClick={handleSend}
99
- disabled={!chat.$connected}
100
- className="px-4 py-2 rounded-lg bg-purple-500/20 border border-purple-500/30 text-purple-200 hover:bg-purple-500/30 transition-all disabled:opacity-50"
101
- >
102
- Enviar
103
- </button>
104
- </div>
105
- </div>
106
- )
107
- }