create-fluxstack 1.5.4 → 1.7.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 (61) hide show
  1. package/README.md +172 -215
  2. package/app/client/src/App.tsx +45 -19
  3. package/app/client/src/components/FluxStackConfig.tsx +1 -1
  4. package/app/client/src/components/HybridLiveCounter.tsx +1 -1
  5. package/app/client/src/components/LiveClock.tsx +1 -1
  6. package/app/client/src/components/MainLayout.tsx +0 -2
  7. package/app/client/src/components/SidebarNavigation.tsx +1 -1
  8. package/app/client/src/components/SystemMonitor.tsx +16 -10
  9. package/app/client/src/components/UserProfile.tsx +1 -1
  10. package/app/server/live/FluxStackConfig.ts +2 -1
  11. package/app/server/live/LiveClockComponent.ts +8 -7
  12. package/app/server/live/SidebarNavigation.ts +2 -1
  13. package/app/server/live/SystemMonitor.ts +1 -0
  14. package/app/server/live/UserProfileComponent.ts +36 -30
  15. package/config/server.config.ts +1 -0
  16. package/core/cli/command-registry.ts +10 -10
  17. package/core/cli/commands/plugin-deps.ts +13 -5
  18. package/core/cli/plugin-discovery.ts +1 -1
  19. package/core/client/LiveComponentsProvider.tsx +414 -0
  20. package/core/client/hooks/useHybridLiveComponent.ts +194 -530
  21. package/core/client/index.ts +16 -0
  22. package/core/framework/server.ts +144 -63
  23. package/core/index.ts +4 -1
  24. package/core/plugins/built-in/monitoring/index.ts +1 -1
  25. package/core/plugins/built-in/static/index.ts +1 -1
  26. package/core/plugins/built-in/swagger/index.ts +1 -1
  27. package/core/plugins/built-in/vite/index.ts +1 -1
  28. package/core/plugins/config.ts +1 -1
  29. package/core/plugins/discovery.ts +1 -1
  30. package/core/plugins/executor.ts +1 -1
  31. package/core/plugins/index.ts +1 -0
  32. package/core/server/live/ComponentRegistry.ts +3 -1
  33. package/core/server/live/WebSocketConnectionManager.ts +14 -4
  34. package/core/server/live/websocket-plugin.ts +453 -434
  35. package/core/server/middleware/elysia-helpers.ts +3 -5
  36. package/core/server/plugins/database.ts +1 -1
  37. package/core/server/plugins/static-files-plugin.ts +1 -1
  38. package/core/types/index.ts +1 -1
  39. package/core/types/plugin.ts +1 -1
  40. package/core/types/types.ts +6 -2
  41. package/core/utils/logger/colors.ts +4 -4
  42. package/core/utils/logger/index.ts +37 -4
  43. package/core/utils/logger/winston-logger.ts +1 -1
  44. package/core/utils/sync-version.ts +61 -0
  45. package/core/utils/version.ts +6 -5
  46. package/create-fluxstack.ts +1 -1
  47. package/package.json +5 -3
  48. package/plugins/crypto-auth/server/middlewares/cryptoAuthAdmin.ts +1 -1
  49. package/plugins/crypto-auth/server/middlewares/cryptoAuthOptional.ts +1 -1
  50. package/plugins/crypto-auth/server/middlewares/cryptoAuthPermissions.ts +1 -1
  51. package/plugins/crypto-auth/server/middlewares/cryptoAuthRequired.ts +1 -1
  52. package/vite.config.ts +8 -0
  53. package/.dockerignore +0 -50
  54. package/CRYPTO-AUTH-MIDDLEWARE-GUIDE.md +0 -475
  55. package/CRYPTO-AUTH-MIDDLEWARES.md +0 -473
  56. package/CRYPTO-AUTH-USAGE.md +0 -491
  57. package/EXEMPLO-ROTA-PROTEGIDA.md +0 -347
  58. package/QUICK-START-CRYPTO-AUTH.md +0 -221
  59. package/app/client/src/components/Teste.tsx +0 -104
  60. package/app/server/live/TesteComponent.ts +0 -87
  61. package/test-crypto-auth.ts +0 -101
package/README.md CHANGED
@@ -1,96 +1,126 @@
1
- # create-fluxstack
1
+ # create-fluxstack
2
2
 
3
- > Create modern full-stack TypeScript applications with zero configuration
3
+ Create modern full-stack TypeScript applications with zero configuration.
4
4
 
5
5
  [![npm version](https://badge.fury.io/js/create-fluxstack.svg)](https://www.npmjs.com/package/create-fluxstack)
6
6
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
7
 
8
- ## 🚀 Quick Start
8
+ ---
9
+
10
+ ## Quick Start
9
11
 
10
12
  ```bash
11
- # Create a new FluxStack app
13
+ # scaffold a new FluxStack app
12
14
  bunx create-fluxstack my-awesome-app
13
15
 
14
- # Navigate and start developing
16
+ # enter the project and start developing
15
17
  cd my-awesome-app
16
18
  bun run dev
17
19
  ```
18
20
 
19
- **That's it!** Your full-stack TypeScript app is ready at:
20
- - 🚀 **Backend**: http://localhost:3000
21
- - ⚛️ **Frontend**: http://localhost:5173
22
- - 📋 **API Docs**: http://localhost:3000/swagger
21
+ Your development environment will be available at:
23
22
 
24
- ## What You Get
23
+ - **Backend**: http://localhost:3000
24
+ - **Frontend (proxied)**: http://localhost:3000/
25
+ - **API Docs**: http://localhost:3000/swagger
25
26
 
26
- ### 🔥 Modern Tech Stack
27
- - **⚡ Bun Runtime** - 3x faster than Node.js
28
- - **🚀 Elysia.js** - Ultra-fast backend framework
29
- - **⚛️ React 19** - Latest React with modern features
30
- - **🎨 Tailwind CSS v4** - Latest styling framework
31
- - **📦 Vite 7** - Lightning-fast dev server
32
- - **🔒 TypeScript 5** - Full type safety end-to-end
27
+ ---
33
28
 
34
- ### 🛠️ Zero Configuration Features
35
- - **✅ Type Safety** - Eden Treaty for API communication with automatic type inference
36
- - **✅ Hot Reload** - Backend + Frontend coordinated development
37
- - **✅ Auto Documentation** - Swagger UI generated from your API
38
- - **✅ Git Ready** - Repository initialized with proper .gitignore
39
- - **✅ Production Ready** - Optimized build scripts included
40
- - **✅ AI Context** - Complete documentation for AI assistants
29
+ ## What You Get
41
30
 
42
- ## 📁 Project Structure
31
+ ### Modern Tech Stack
32
+ - Bun runtime (3x faster than Node.js)
33
+ - Elysia.js backend
34
+ - React 19 + Vite 7 frontend
35
+ - Tailwind CSS v4 styling
36
+ - TypeScript 5 end-to-end typing
37
+
38
+ ### Zero-Config Features
39
+ - Automatic Eden Treaty type inference
40
+ - Coordinated hot reload (backend + frontend)
41
+ - Swagger documentation out of the box
42
+ - Production-ready build scripts and Docker templates
43
+ - AI-focused documentation (`ai-context/`)
44
+
45
+ ---
46
+
47
+ ## Architecture Overview
43
48
 
44
49
  ```
45
- my-awesome-app/
46
- ├── core/ # FluxStack framework (don't modify)
47
- │ ├── server/ # Framework server components
48
- ├── config/ # Configuration system
49
- ├── plugins/ # Built-in plugins (logger, swagger, etc)
50
- └── cli/ # Development CLI tools
51
- ├── app/ # Your application code
52
- │ ├── server/ # Backend API routes
53
- │ ├── controllers/ # Business logic
54
- │ └── routes/ # API endpoints
55
- ├── client/ # Frontend React app
56
- │ ├── src/ # React components
57
- │ │ └── public/ # Static assets
58
- └── shared/ # Shared types and utilities
59
- ├── ai-context/ # AI assistant documentation
60
- ├── package.json # Dependencies and scripts
61
- ├── CLAUDE.md # AI instructions
62
- └── README.md # Project documentation
50
+ ┌─────────────────────────────────────────────────────────────┐
51
+ FluxStack Monorepo │
52
+ ├─────────────────────────────────────────────────────────────┤
53
+ app/
54
+ ├─ Frontend (React + Vite)
55
+ ├─ Backend (Elysia + Bun) │
56
+ │ └─ Shared Types / Utils │
57
+ ├─────────────────────────────────────────────────────────────┤
58
+ core/
59
+ ├─ Server Framework │
60
+ ├─ Plugin System │
61
+ └─ Build System │
62
+ ├─────────────────────────────────────────────────────────────┤
63
+ Communication Layer (Eden Treaty, WebSockets) │
64
+ ├─────────────────────────────────────────────────────────────┤
65
+ Configuration Management │
66
+ └─────────────────────────────────────────────────────────────┘
63
67
  ```
64
68
 
65
- ## 🎯 Available Scripts
69
+ ```
70
+ FluxStack/
71
+ ├─ core/ # framework internals (read-only)
72
+ │ ├─ framework/ # FluxStackFramework (Elysia orchestrator)
73
+ │ ├─ plugins/ # built-in plugins (swagger, vite, static, monitoring)
74
+ │ ├─ build/ # bundler, optimizer, Docker scaffolding
75
+ │ ├─ cli/ # flux CLI commands and generators
76
+ │ ├─ config/ # declarative schema helpers
77
+ │ └─ utils/ # logging, environment helpers, etc.
78
+ ├─ app/ # your editable application code
79
+ │ ├─ server/ # API routes, controllers, services, live components
80
+ │ │ ├─ controllers/ # business logic
81
+ │ │ ├─ routes/ # endpoints + schemas
82
+ │ │ ├─ types/ # shared types and App export for Eden Treaty
83
+ │ │ └─ live/ # WebSocket live components
84
+ │ ├─ client/ # React SPA (components, pages, hooks, store)
85
+ │ └─ shared/ # cross-layer types/utilities
86
+ ├─ config/ # project-specific config built on the schema
87
+ ├─ plugins/ # optional external plugins (e.g. crypto-auth)
88
+ ├─ ai-context/ # documentation tailored for assistants
89
+ └─ package.json / README.md # project metadata
90
+ ```
91
+
92
+ ---
93
+
94
+ ## Available Scripts
66
95
 
67
96
  ```bash
68
- # Development
69
- bun run dev # Start full-stack development
70
- bun run dev:clean # Clean output (no Elysia HEAD logs)
71
- bun run dev:frontend # Frontend only (port 5173)
72
- bun run dev:backend # Backend only (port 3001)
73
-
74
- # Production
75
- bun run build # Build for production
76
- bun run start # Start production server
77
-
78
- # Utilities
79
- bun run typecheck # Check TypeScript
80
- bun run test # Run test suite
97
+ # development
98
+ bun run dev # full stack with proxy + vite
99
+ bun run dev # logs are automatically filtered in development
100
+ bun run dev:frontend # only the frontend (port 5173, no proxy)
101
+ bun run dev:backend # only the backend (port 3001)
102
+
103
+ # production
104
+ bun run build # build backend + frontend + manifest
105
+ bun run start # start production bundle
106
+
107
+ # utilities
108
+ bun run typecheck # run TypeScript type checking
109
+ bun run test # execute Vitest suite
81
110
  ```
82
111
 
83
- ## 🔧 Type-Safe API Development
112
+ ---
113
+
114
+ ## Type-Safe API Development
84
115
 
85
- FluxStack provides automatic type inference between your backend and frontend using Eden Treaty:
116
+ FluxStack uses Eden Treaty to eliminate manual DTOs.
86
117
 
87
- ### Backend API (Elysia.js)
88
- ```typescript
89
- // app/server/routes/users.ts
118
+ ### Backend Route (Elysia)
119
+ ```ts
90
120
  import { Elysia, t } from 'elysia'
91
121
 
92
122
  export const userRoutes = new Elysia({ prefix: '/users' })
93
- .get('/', () => ({ users: getAllUsers() }))
123
+ .get('/', () => ({ users: listUsers() }))
94
124
  .post('/', ({ body }) => createUser(body), {
95
125
  body: t.Object({
96
126
  name: t.String(),
@@ -108,105 +138,27 @@ export const userRoutes = new Elysia({ prefix: '/users' })
108
138
  })
109
139
  ```
110
140
 
111
- ### Frontend with Type Safety
112
- ```typescript
113
- // app/client/src/components/Users.tsx
114
- import { api } from '../lib/eden-api'
115
-
116
- export function UsersList() {
117
- const [users, setUsers] = useState<User[]>([])
118
-
119
- const createUser = async (userData: CreateUserData) => {
120
- // ✨ Fully typed - no manual type definitions needed!
121
- const { data, error } = await api.users.post(userData)
122
-
123
- if (!error) {
124
- setUsers(prev => [...prev, data.user]) // ✅ TypeScript knows the shape
125
- }
126
- }
127
-
128
- return (
129
- <div>
130
- {users.map(user => (
131
- <UserCard key={user.id} user={user} />
132
- ))}
133
- </div>
134
- )
135
- }
136
- ```
137
-
138
- ## 🌍 Environment & Configuration
141
+ ### Frontend Usage (React)
142
+ ```tsx
143
+ import { api } from '@/app/client/src/lib/eden-api'
139
144
 
140
- ### Environment Variables
141
- ```bash
142
- # .env (auto-generated from .env.example)
143
- NODE_ENV=development
144
- PORT=3000
145
- HOST=localhost
146
- VITE_PORT=5173
147
- VITE_API_URL=http://localhost:3000
148
-
149
- # Add your own variables
150
- DATABASE_URL=postgresql://localhost:5432/myapp
151
- JWT_SECRET=your-secret-key
152
- ```
153
-
154
- ### Frontend Environment
155
- ```typescript
156
- // Only VITE_* variables are exposed to frontend
157
- const apiUrl = import.meta.env.VITE_API_URL
158
- const appName = import.meta.env.VITE_APP_NAME
159
- ```
160
-
161
- ## 🚀 Deployment
162
-
163
- ### Single Server (Recommended)
164
- ```bash
165
- # Build everything
166
- bun run build
167
-
168
- # Start production server
169
- bun run start
170
- ```
171
-
172
- ### Separate Deploy
173
- ```bash
174
- # Backend
175
- bun run build:backend
176
- bun dist/index.js
177
-
178
- # Frontend
179
- bun run build:frontend
180
- # Deploy dist/ folder to CDN
181
- ```
182
-
183
- ### Docker
184
- ```bash
185
- # Use included Dockerfile
186
- docker build -t my-app .
187
- docker run -p 3000:3000 my-app
188
- ```
145
+ const { data: response, error } = await api.users.post({
146
+ name: 'Ada Lovelace',
147
+ email: 'ada@example.com'
148
+ })
189
149
 
190
- ## 🔧 Requirements
191
-
192
- - **Bun** >= 1.2.0 (required)
193
-
194
- ### Install Bun
195
- ```bash
196
- # macOS/Linux
197
- curl -fsSL https://bun.sh/install | bash
198
-
199
- # Windows
200
- powershell -c "irm bun.sh/install.ps1|iex"
150
+ if (!error && response?.user) {
151
+ console.log(response.user.name)
152
+ }
201
153
  ```
202
154
 
203
- > **Note**: FluxStack is built specifically for Bun runtime. Node.js is not supported.
155
+ ---
204
156
 
205
- ## 🎨 Customization
157
+ ## Customisation Highlights
206
158
 
207
- ### Adding API Routes
208
- ```typescript
209
- // app/server/routes/posts.ts
159
+ ### Add a Route
160
+ ```ts
161
+ // app/server/routes/posts.ts
210
162
  import { Elysia, t } from 'elysia'
211
163
 
212
164
  export const postRoutes = new Elysia({ prefix: '/posts' })
@@ -220,96 +172,101 @@ export const postRoutes = new Elysia({ prefix: '/posts' })
220
172
 
221
173
  // app/server/index.ts
222
174
  import { postRoutes } from './routes/posts'
223
-
224
175
  app.use(postRoutes)
225
176
  ```
226
177
 
227
- ### Custom Plugins
228
- ```typescript
229
- // app/server/plugins/auth.ts
178
+ ### Create a Plugin
179
+ ```ts
180
+ // app/server/plugins/audit.ts
230
181
  import { Elysia } from 'elysia'
231
182
 
232
- export const authPlugin = new Elysia({ name: 'auth' })
233
- .derive(({ headers }) => ({
234
- user: getUserFromToken(headers.authorization)
235
- }))
236
- .guard({
237
- beforeHandle({ user, set }) {
238
- if (!user) {
239
- set.status = 401
240
- return { error: 'Unauthorized' }
241
- }
242
- }
183
+ export const auditPlugin = new Elysia({ name: 'audit' })
184
+ .onRequest(({ request }) => {
185
+ console.log(`[AUDIT] ${request.method} ${request.url}`)
243
186
  })
244
187
  ```
245
188
 
246
- ## 📚 Documentation & AI Support
189
+ ---
190
+
191
+ ## Documentation & Support
247
192
 
248
- FluxStack includes comprehensive documentation for both developers and AI assistants:
193
+ - Full documentation lives in `ai-context/`.
194
+ - Assistant guidelines: `CLAUDE.md`.
195
+ - Quick start for AI agents: `ai-context/00-QUICK-START.md`.
196
+ - Example apps and guides included in `examples/` and `ai-context/`.
249
197
 
250
- - **📖 Full Documentation**: Check the `ai-context/` folder
251
- - **🤖 AI Instructions**: See `CLAUDE.md` for AI assistant guidance
252
- - **⚡ Quick Start**: `ai-context/00-QUICK-START.md`
253
- - **🎯 Examples**: Complete CRUD examples included
198
+ ---
199
+
200
+ ## Community
254
201
 
255
- ## 🛟 Support & Community
202
+ - **Issues**: [GitHub Issues](https://github.com/MarcosBrendonDePaula/FluxStack/issues)
203
+ - **Docs**: [Repository Docs](https://github.com/MarcosBrendonDePaula/FluxStack)
204
+ - **Discussions**: [GitHub Discussions](https://github.com/MarcosBrendonDePaula/FluxStack/discussions)
256
205
 
257
- - **🐛 Issues**: [Report bugs](https://github.com/MarcosBrendonDePaula/FluxStack/issues)
258
- - **📖 Documentation**: [Full docs](https://github.com/MarcosBrendonDePaula/FluxStack)
259
- - **💬 Discussions**: [GitHub Discussions](https://github.com/MarcosBrendonDePaula/FluxStack/discussions)
206
+ ---
260
207
 
261
- ## 🔄 Upgrading
208
+ ## Upgrading
262
209
 
263
210
  ```bash
264
- # Get the latest version
211
+ # pull the latest scaffold
265
212
  bunx create-fluxstack@latest my-new-app
266
213
 
267
- # Check current version
214
+ # check current global version
268
215
  npm list -g create-fluxstack
269
216
  ```
270
217
 
271
- ## 🌟 Why FluxStack?
218
+ ---
219
+
220
+ ## Why FluxStack?
221
+
222
+ ### Developer Experience
223
+ - Zero configuration – start coding immediately.
224
+ - Type-safe from controllers to components.
225
+ - Hot reload with backend/frontend coordination.
226
+ - Swagger documentation generated automatically.
272
227
 
273
- ### ✅ **Developer Experience**
274
- - **Zero Config**: Just create and start coding
275
- - **Type Safety**: End-to-end without manual work
276
- - **Hot Reload**: Backend and frontend in sync
277
- - **Auto Docs**: Swagger generated from your code
228
+ ### Performance
229
+ - Bun runtime for fast startup and low memory.
230
+ - Elysia for high-performance API routing.
231
+ - Vite for instant dev server and optimized builds.
232
+ - React 19 for modern UI primitives.
278
233
 
279
- ### **Performance**
280
- - **Bun Runtime**: 3x faster than Node.js
281
- - **Elysia**: One of the fastest TypeScript frameworks
282
- - **Vite**: Instant HMR and optimized builds
283
- - **React 19**: Latest performance improvements
234
+ ### Production Ready
235
+ - Docker multi-stage builds out of the box.
236
+ - Declarative configuration with environment overrides.
237
+ - Unified error handling and logging support.
238
+ - Optional monitoring plugin for metrics/exporters.
284
239
 
285
- ### **Production Ready**
286
- - **Docker**: Optimized containers included
287
- - **Environment**: Robust configuration system
288
- - **Error Handling**: Consistent error responses
289
- - **Monitoring**: Built-in observability features
240
+ ### Modern Stack
241
+ - TypeScript 5, React 19, Tailwind v4, Eden Treaty.
242
+ - Shared types everywhere.
243
+ - WebSocket live components built in.
244
+
245
+ ---
290
246
 
291
- ### ✅ **Modern Stack**
292
- - **TypeScript 5**: Latest language features
293
- - **React 19**: Concurrent features, Server Components ready
294
- - **Tailwind v4**: Latest CSS framework
295
- - **Eden Treaty**: Revolutionary type-safe API client
247
+ ## Requirements
296
248
 
297
- ## 🎊 Get Started Now!
249
+ - **Bun** 1.2.0
298
250
 
251
+ ### Install Bun
299
252
  ```bash
300
- bunx create-fluxstack my-dream-app
301
- cd my-dream-app
302
- bun run dev
253
+ # macOS / Linux
254
+ curl -fsSL https://bun.sh/install | bash
255
+
256
+ # Windows
257
+ powershell -c "irm bun.sh/install.ps1 | iex"
303
258
  ```
304
259
 
305
- **Welcome to the future of full-stack development!** ⚡🚀
260
+ > FluxStack targets the Bun runtime. Node.js is not supported.
306
261
 
307
262
  ---
308
263
 
309
- <div align="center">
310
-
311
- **Built with ❤️ by the FluxStack Team**
264
+ ## Ready to Build?
312
265
 
313
- [⭐ Star on GitHub](https://github.com/MarcosBrendonDePaula/FluxStack) • [📦 NPM Package](https://www.npmjs.com/package/create-fluxstack)
266
+ ```bash
267
+ bunx create-fluxstack my-dream-app
268
+ cd my-dream-app
269
+ bun run dev
270
+ ```
314
271
 
315
- </div>
272
+ Welcome to the future of full-stack development.
@@ -1,14 +1,14 @@
1
1
  import { useState, useEffect } from 'react'
2
2
  import { api, getErrorMessage } from './lib/eden-api'
3
- import {
4
- FaRocket, FaReact, FaLink, FaDocker, FaFlask, FaPalette,
5
- FaCheckCircle, FaTimesCircle, FaSpinner, FaSync,
6
- FaUsers, FaTrash, FaPlus, FaBook, FaCode, FaCog,
7
- FaServer, FaDatabase, FaShieldAlt, FaBolt, FaLock,
8
- FaBullseye, FaGlobe, FaFileAlt,
9
- FaClipboardList, FaFire, FaFlask as FaTest,
3
+ import {
4
+ FaRocket,
5
+ FaCheckCircle, FaTimesCircle, FaBook, FaShieldAlt, FaBolt,
6
+ FaClipboardList, FaFire, FaFlask as FaTest,
10
7
  } from 'react-icons/fa'
11
- import { BrowserRouter, Routes, Route, Link } from 'react-router-dom'
8
+ import { Routes, Route, Link } from 'react-router-dom'
9
+
10
+ // Live Components Provider - Singleton WebSocket Connection for All Live Components
11
+ import { LiveComponentsProvider } from '@/core/client'
12
12
 
13
13
  // Import page components
14
14
  import { OverviewPage } from './pages/Overview'
@@ -17,7 +17,6 @@ import { HybridLivePage } from './pages/HybridLive'
17
17
  import { ApiDocsPage } from './pages/ApiDocs'
18
18
  import { CryptoAuthPage } from './pages/CryptoAuthPage'
19
19
  import { MainLayout } from './components/MainLayout'
20
- import { LiveClock } from './components/LiveClock'
21
20
 
22
21
  // State management is now handled by Zustand stores directly
23
22
 
@@ -25,7 +24,22 @@ interface User {
25
24
  id: number
26
25
  name: string
27
26
  email: string
28
- createdAt: string
27
+ createdAt: string | Date
28
+ }
29
+
30
+ interface UsersResponse {
31
+ users: User[]
32
+ }
33
+
34
+ interface UserCreateResponse {
35
+ success: boolean
36
+ user?: User
37
+ message?: string
38
+ }
39
+
40
+ interface UserDeleteResponse {
41
+ success: boolean
42
+ message?: string
29
43
  }
30
44
 
31
45
  function AppContent() {
@@ -44,7 +58,7 @@ function AppContent() {
44
58
 
45
59
  const checkApiStatus = async () => {
46
60
  try {
47
- const { data, error } = await api.health.get()
61
+ const { error } = await api.health.get()
48
62
  if (error) {
49
63
  setApiStatus('offline')
50
64
  } else {
@@ -65,7 +79,7 @@ function AppContent() {
65
79
  return
66
80
  }
67
81
 
68
- setUsers(data.users || [])
82
+ setUsers((data as UsersResponse).users || [])
69
83
  } catch (error) {
70
84
  showMessage('error', getErrorMessage(error))
71
85
  } finally {
@@ -89,13 +103,14 @@ function AppContent() {
89
103
  return
90
104
  }
91
105
 
92
- if (result.success && result.user) {
93
- setUsers(prev => [...prev, result.user])
106
+ const createResult = result as UserCreateResponse
107
+ if (createResult.success && createResult.user) {
108
+ setUsers(prev => [...prev, createResult.user!])
94
109
  setName('')
95
110
  setEmail('')
96
111
  showMessage('success', `Usuário ${name} adicionado com sucesso!`)
97
112
  } else {
98
- showMessage('error', result.message || 'Erro ao criar usuário')
113
+ showMessage('error', createResult.message || 'Erro ao criar usuário')
99
114
  }
100
115
  } catch (error) {
101
116
  showMessage('error', getErrorMessage(error))
@@ -115,11 +130,12 @@ function AppContent() {
115
130
  return
116
131
  }
117
132
 
118
- if (result.success) {
133
+ const deleteResult = result as UserDeleteResponse
134
+ if (deleteResult.success) {
119
135
  setUsers(prev => prev.filter(user => user.id !== userId))
120
136
  showMessage('success', `Usuário ${userName} removido com sucesso!`)
121
137
  } else {
122
- showMessage('error', result.message || 'Erro ao deletar usuário')
138
+ showMessage('error', deleteResult.message || 'Erro ao deletar usuário')
123
139
  }
124
140
  } catch (error) {
125
141
  showMessage('error', getErrorMessage(error))
@@ -297,9 +313,19 @@ function AppContent() {
297
313
  )
298
314
  }
299
315
 
300
- // Main App component - Zustand stores are available globally
316
+ // Main App component - Wrapped with LiveComponentsProvider for single WebSocket connection
301
317
  function App() {
302
- return <AppContent />
318
+ return (
319
+ <LiveComponentsProvider
320
+ autoConnect={true}
321
+ reconnectInterval={1000}
322
+ maxReconnectAttempts={5}
323
+ heartbeatInterval={30000}
324
+ debug={false}
325
+ >
326
+ <AppContent />
327
+ </LiveComponentsProvider>
328
+ )
303
329
  }
304
330
 
305
331
  export default App
@@ -1,7 +1,7 @@
1
1
  // 🔥 FluxStack Configuration Viewer Component
2
2
 
3
3
  import { useState } from 'react'
4
- import { useHybridLiveComponent } from 'fluxstack'
4
+ import { useHybridLiveComponent } from '@/core/client'
5
5
  import {
6
6
  FaCog,
7
7
  FaServer,
@@ -1,6 +1,6 @@
1
1
  // 🔥 Simple Hybrid Live Counter - Server-Driven with Zustand
2
2
 
3
- import { useHybridLiveComponent } from 'fluxstack'
3
+ import { useHybridLiveComponent } from '@/core/client'
4
4
 
5
5
  interface CounterState {
6
6
  count: number
@@ -1,6 +1,6 @@
1
1
  // 🔥 LiveClock - Real-time Clock Client Component
2
2
  import React, { useState } from 'react';
3
- import { useHybridLiveComponent } from 'fluxstack';
3
+ import { useHybridLiveComponent } from '@/core/client';
4
4
  import {
5
5
  FaClock,
6
6
  FaCog,
@@ -6,7 +6,6 @@ import { UserProfile } from './UserProfile'
6
6
  import { SystemMonitor } from './SystemMonitor'
7
7
  import { FluxStackConfig } from './FluxStackConfig'
8
8
  import { FaHome, FaCog, FaFolder, FaChartBar, FaRocket, FaServer } from 'react-icons/fa'
9
- import { Teste } from './Teste'
10
9
 
11
10
  // Temporary placeholder components for other pages
12
11
  function Dashboard() {
@@ -128,7 +127,6 @@ function Dashboard() {
128
127
  </ul>
129
128
  </div>
130
129
  </div>
131
- <Teste></Teste>
132
130
  </div>
133
131
  )
134
132
  }
@@ -1,6 +1,6 @@
1
1
  // 🔥 Sidebar Navigation Component
2
2
 
3
- import { useHybridLiveComponent } from 'fluxstack'
3
+ import { useHybridLiveComponent } from '@/core/client'
4
4
  import {
5
5
  FaHome,
6
6
  FaUser,