create-fluxstack 1.0.13 → 1.0.15

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 (214) hide show
  1. package/.env.example +29 -29
  2. package/app/client/README.md +69 -69
  3. package/app/client/index.html +14 -13
  4. package/app/client/src/App.tsx +157 -524
  5. package/app/client/src/components/ErrorBoundary.tsx +107 -0
  6. package/app/client/src/components/ErrorDisplay.css +365 -0
  7. package/app/client/src/components/ErrorDisplay.tsx +258 -0
  8. package/app/client/src/components/FluxStackConfig.tsx +1321 -0
  9. package/app/client/src/components/HybridLiveCounter.tsx +140 -0
  10. package/app/client/src/components/LiveClock.tsx +286 -0
  11. package/app/client/src/components/MainLayout.tsx +390 -0
  12. package/app/client/src/components/SidebarNavigation.tsx +391 -0
  13. package/app/client/src/components/StateDemo.tsx +178 -0
  14. package/app/client/src/components/SystemMonitor.tsx +1038 -0
  15. package/app/client/src/components/Teste.tsx +104 -0
  16. package/app/client/src/components/UserProfile.tsx +809 -0
  17. package/app/client/src/hooks/useAuth.ts +39 -0
  18. package/app/client/src/hooks/useNotifications.ts +56 -0
  19. package/app/client/src/lib/eden-api.ts +189 -53
  20. package/app/client/src/lib/errors.ts +340 -0
  21. package/app/client/src/lib/hooks/useErrorHandler.ts +258 -0
  22. package/app/client/src/lib/index.ts +45 -0
  23. package/app/client/src/main.tsx +3 -2
  24. package/app/client/src/pages/ApiDocs.tsx +182 -0
  25. package/app/client/src/pages/Demo.tsx +174 -0
  26. package/app/client/src/pages/HybridLive.tsx +263 -0
  27. package/app/client/src/pages/Overview.tsx +155 -0
  28. package/app/client/src/store/README.md +43 -0
  29. package/app/client/src/store/index.ts +16 -0
  30. package/app/client/src/store/slices/uiSlice.ts +151 -0
  31. package/app/client/src/store/slices/userSlice.ts +161 -0
  32. package/app/client/src/test/README.md +257 -0
  33. package/app/client/src/test/setup.ts +70 -0
  34. package/app/client/src/test/types.ts +12 -0
  35. package/app/client/src/vite-env.d.ts +1 -1
  36. package/app/client/tsconfig.app.json +44 -43
  37. package/app/client/tsconfig.json +7 -7
  38. package/app/client/tsconfig.node.json +25 -25
  39. package/app/client/zustand-setup.md +65 -0
  40. package/app/server/controllers/users.controller.ts +68 -68
  41. package/app/server/index.ts +9 -1
  42. package/app/server/live/CounterComponent.ts +191 -0
  43. package/app/server/live/FluxStackConfig.ts +529 -0
  44. package/app/server/live/LiveClockComponent.ts +214 -0
  45. package/app/server/live/SidebarNavigation.ts +156 -0
  46. package/app/server/live/SystemMonitor.ts +594 -0
  47. package/app/server/live/SystemMonitorIntegration.ts +151 -0
  48. package/app/server/live/TesteComponent.ts +87 -0
  49. package/app/server/live/UserProfileComponent.ts +135 -0
  50. package/app/server/live/register-components.ts +28 -0
  51. package/app/server/middleware/auth.ts +136 -0
  52. package/app/server/middleware/errorHandling.ts +250 -0
  53. package/app/server/middleware/index.ts +10 -0
  54. package/app/server/middleware/rateLimit.ts +193 -0
  55. package/app/server/middleware/requestLogging.ts +215 -0
  56. package/app/server/middleware/validation.ts +270 -0
  57. package/app/server/routes/index.ts +14 -2
  58. package/app/server/routes/upload.ts +92 -0
  59. package/app/server/routes/users.routes.ts +2 -9
  60. package/app/server/services/NotificationService.ts +302 -0
  61. package/app/server/services/UserService.ts +222 -0
  62. package/app/server/services/index.ts +46 -0
  63. package/core/cli/commands/plugin-deps.ts +263 -0
  64. package/core/cli/generators/README.md +339 -0
  65. package/core/cli/generators/component.ts +770 -0
  66. package/core/cli/generators/controller.ts +299 -0
  67. package/core/cli/generators/index.ts +144 -0
  68. package/core/cli/generators/interactive.ts +228 -0
  69. package/core/cli/generators/prompts.ts +83 -0
  70. package/core/cli/generators/route.ts +513 -0
  71. package/core/cli/generators/service.ts +465 -0
  72. package/core/cli/generators/template-engine.ts +154 -0
  73. package/core/cli/generators/types.ts +71 -0
  74. package/core/cli/generators/utils.ts +192 -0
  75. package/core/cli/index.ts +69 -0
  76. package/core/cli/plugin-discovery.ts +16 -85
  77. package/core/client/fluxstack.ts +17 -0
  78. package/core/client/hooks/index.ts +7 -0
  79. package/core/client/hooks/state-validator.ts +130 -0
  80. package/core/client/hooks/useAuth.ts +49 -0
  81. package/core/client/hooks/useChunkedUpload.ts +258 -0
  82. package/core/client/hooks/useHybridLiveComponent.ts +967 -0
  83. package/core/client/hooks/useWebSocket.ts +373 -0
  84. package/core/client/index.ts +47 -0
  85. package/core/client/state/createStore.ts +193 -0
  86. package/core/client/state/index.ts +15 -0
  87. package/core/config/env-dynamic.ts +1 -1
  88. package/core/config/env.ts +2 -1
  89. package/core/config/runtime-config.ts +3 -3
  90. package/core/config/schema.ts +84 -49
  91. package/core/framework/server.ts +30 -0
  92. package/core/index.ts +25 -0
  93. package/core/live/ComponentRegistry.ts +399 -0
  94. package/core/live/types.ts +164 -0
  95. package/core/plugins/built-in/live-components/commands/create-live-component.ts +1201 -0
  96. package/core/plugins/built-in/live-components/index.ts +27 -0
  97. package/core/plugins/built-in/logger/index.ts +1 -1
  98. package/core/plugins/built-in/monitoring/index.ts +1 -1
  99. package/core/plugins/built-in/static/index.ts +1 -1
  100. package/core/plugins/built-in/swagger/index.ts +1 -1
  101. package/core/plugins/built-in/vite/index.ts +1 -1
  102. package/core/plugins/dependency-manager.ts +384 -0
  103. package/core/plugins/index.ts +5 -1
  104. package/core/plugins/manager.ts +7 -3
  105. package/core/plugins/registry.ts +88 -10
  106. package/core/plugins/types.ts +11 -11
  107. package/core/server/framework.ts +43 -0
  108. package/core/server/index.ts +11 -1
  109. package/core/server/live/ComponentRegistry.ts +1017 -0
  110. package/core/server/live/FileUploadManager.ts +272 -0
  111. package/core/server/live/LiveComponentPerformanceMonitor.ts +930 -0
  112. package/core/server/live/SingleConnectionManager.ts +0 -0
  113. package/core/server/live/StateSignature.ts +644 -0
  114. package/core/server/live/WebSocketConnectionManager.ts +688 -0
  115. package/core/server/live/websocket-plugin.ts +435 -0
  116. package/core/server/middleware/errorHandling.ts +141 -0
  117. package/core/server/middleware/index.ts +16 -0
  118. package/core/server/plugins/static-files-plugin.ts +232 -0
  119. package/core/server/services/BaseService.ts +95 -0
  120. package/core/server/services/ServiceContainer.ts +144 -0
  121. package/core/server/services/index.ts +9 -0
  122. package/core/templates/create-project.ts +196 -33
  123. package/core/testing/index.ts +10 -0
  124. package/core/testing/setup.ts +74 -0
  125. package/core/types/build.ts +38 -14
  126. package/core/types/types.ts +319 -0
  127. package/core/utils/env-runtime.ts +7 -0
  128. package/core/utils/errors/handlers.ts +264 -39
  129. package/core/utils/errors/index.ts +528 -18
  130. package/core/utils/errors/middleware.ts +114 -0
  131. package/core/utils/logger/formatters.ts +222 -0
  132. package/core/utils/logger/index.ts +167 -48
  133. package/core/utils/logger/middleware.ts +253 -0
  134. package/core/utils/logger/performance.ts +384 -0
  135. package/core/utils/logger/transports.ts +365 -0
  136. package/create-fluxstack.ts +296 -296
  137. package/fluxstack.config.ts +17 -1
  138. package/package-template.json +66 -66
  139. package/package.json +31 -6
  140. package/public/README.md +16 -0
  141. package/vite.config.ts +29 -14
  142. package/.claude/settings.local.json +0 -74
  143. package/.github/workflows/ci-build-tests.yml +0 -480
  144. package/.github/workflows/dependency-management.yml +0 -324
  145. package/.github/workflows/release-validation.yml +0 -355
  146. package/.kiro/specs/fluxstack-architecture-optimization/design.md +0 -700
  147. package/.kiro/specs/fluxstack-architecture-optimization/requirements.md +0 -127
  148. package/.kiro/specs/fluxstack-architecture-optimization/tasks.md +0 -330
  149. package/CLAUDE.md +0 -200
  150. package/Dockerfile +0 -58
  151. package/Dockerfile.backend +0 -52
  152. package/Dockerfile.frontend +0 -54
  153. package/README-Docker.md +0 -85
  154. package/ai-context/00-QUICK-START.md +0 -86
  155. package/ai-context/README.md +0 -88
  156. package/ai-context/development/eden-treaty-guide.md +0 -362
  157. package/ai-context/development/patterns.md +0 -382
  158. package/ai-context/development/plugins-guide.md +0 -572
  159. package/ai-context/examples/crud-complete.md +0 -626
  160. package/ai-context/project/architecture.md +0 -399
  161. package/ai-context/project/overview.md +0 -213
  162. package/ai-context/recent-changes/eden-treaty-refactor.md +0 -281
  163. package/ai-context/recent-changes/type-inference-fix.md +0 -223
  164. package/ai-context/reference/environment-vars.md +0 -384
  165. package/ai-context/reference/troubleshooting.md +0 -407
  166. package/app/client/src/components/TestPage.tsx +0 -453
  167. package/bun.lock +0 -1063
  168. package/bunfig.toml +0 -16
  169. package/core/__tests__/integration.test.ts +0 -227
  170. package/core/build/index.ts +0 -186
  171. package/core/config/__tests__/config-loader.test.ts +0 -554
  172. package/core/config/__tests__/config-merger.test.ts +0 -657
  173. package/core/config/__tests__/env-converter.test.ts +0 -372
  174. package/core/config/__tests__/env-processor.test.ts +0 -431
  175. package/core/config/__tests__/env.test.ts +0 -452
  176. package/core/config/__tests__/integration.test.ts +0 -418
  177. package/core/config/__tests__/loader.test.ts +0 -331
  178. package/core/config/__tests__/schema.test.ts +0 -129
  179. package/core/config/__tests__/validator.test.ts +0 -318
  180. package/core/framework/__tests__/server.test.ts +0 -233
  181. package/core/plugins/__tests__/built-in.test.ts.disabled +0 -366
  182. package/core/plugins/__tests__/manager.test.ts +0 -398
  183. package/core/plugins/__tests__/monitoring.test.ts +0 -401
  184. package/core/plugins/__tests__/registry.test.ts +0 -335
  185. package/core/utils/__tests__/errors.test.ts +0 -139
  186. package/core/utils/__tests__/helpers.test.ts +0 -297
  187. package/core/utils/__tests__/logger.test.ts +0 -141
  188. package/create-test-app.ts +0 -156
  189. package/docker-compose.microservices.yml +0 -75
  190. package/docker-compose.simple.yml +0 -57
  191. package/docker-compose.yml +0 -71
  192. package/eslint.config.js +0 -23
  193. package/flux-cli.ts +0 -214
  194. package/nginx-lb.conf +0 -37
  195. package/publish.sh +0 -63
  196. package/run-clean.ts +0 -26
  197. package/run-env-tests.ts +0 -313
  198. package/tailwind.config.js +0 -34
  199. package/tests/__mocks__/api.ts +0 -56
  200. package/tests/fixtures/users.ts +0 -69
  201. package/tests/integration/api/users.routes.test.ts +0 -221
  202. package/tests/setup.ts +0 -29
  203. package/tests/unit/app/client/App-simple.test.tsx +0 -56
  204. package/tests/unit/app/client/App.test.tsx.skip +0 -237
  205. package/tests/unit/app/client/eden-api.test.ts +0 -186
  206. package/tests/unit/app/client/simple.test.tsx +0 -23
  207. package/tests/unit/app/controllers/users.controller.test.ts +0 -150
  208. package/tests/unit/core/create-project.test.ts.skip +0 -95
  209. package/tests/unit/core/framework.test.ts +0 -144
  210. package/tests/unit/core/plugins/logger.test.ts.skip +0 -268
  211. package/tests/unit/core/plugins/vite.test.ts.disabled +0 -188
  212. package/tests/utils/test-helpers.ts +0 -61
  213. package/vitest.config.ts +0 -50
  214. package/workspace.json +0 -6
@@ -1,399 +0,0 @@
1
- # 🏗️ FluxStack - Arquitetura Detalhada
2
-
3
- > **Arquitetura completa**: Como o framework funciona internamente
4
-
5
- ## 📊 **Visão Geral da Arquitetura**
6
-
7
- FluxStack implementa uma arquitetura **monorepo modular** com separação clara entre framework core e código da aplicação, garantindo escalabilidade e manutenibilidade.
8
-
9
- ```
10
- ┌─────────────────────────────────────────────────────────────┐
11
- │ FluxStack │
12
- ├─────────────────────────────────────────────────────────────┤
13
- │ 🎨 Frontend (React + Vite) │
14
- │ ├─ Components & Pages │
15
- │ ├─ Eden Treaty Client ←─────────────────────┐ │
16
- │ └─ Hooks & Utils │ │
17
- ├─────────────────────────────────────────────┼──────────────┤
18
- │ 🔌 Communication Layer │ │
19
- │ └─ Eden Treaty (Type-safe HTTP) ────────────┘ │
20
- ├─────────────────────────────────────────────────────────────┤
21
- │ 🚀 Backend (Elysia + Bun) │
22
- │ ├─ Controllers (Business Logic) │
23
- │ ├─ Routes (API Endpoints) │
24
- │ ├─ Types (Shared with Frontend) │
25
- │ └─ App Export (for Eden Treaty) │
26
- ├─────────────────────────────────────────────────────────────┤
27
- │ ⚙️ Framework Core (Read-Only) │
28
- │ ├─ Server Framework │
29
- │ ├─ Plugin System │
30
- │ ├─ Build System │
31
- │ └─ Configuration Management │
32
- └─────────────────────────────────────────────────────────────┘
33
- ```
34
-
35
- ## 🎯 **Core Principles**
36
-
37
- ### **1. 🔒 Separation of Concerns**
38
- - **`core/`**: Framework code (read-only, versioned)
39
- - **`app/`**: Application code (user-editable)
40
- - **Clear boundaries**: Framework vs Application
41
-
42
- ### **2. ⚡ Type Safety First**
43
- - **End-to-end types**: Client ↔ Server automaticamente sincronizados
44
- - **Zero duplicação**: Types definidos uma vez, usados em todo lugar
45
- - **Compile-time validation**: Erros detectados antes do runtime
46
-
47
- ### **3. 🔄 Hot Development**
48
- - **Independent reloading**: Backend e Frontend recarregam separadamente
49
- - **Fast iterations**: Mudanças refletem instantaneamente
50
- - **Zero downtime**: Desenvolvimento sem interrupções
51
-
52
- ## 🏗️ **Arquitetura Detalhada**
53
-
54
- ### **📁 Estrutura de Diretórios**
55
- ```
56
- FluxStack/
57
- ├── core/ # 🔒 FRAMEWORK CORE
58
- │ ├── server/
59
- │ │ ├── framework.ts # Classe principal FluxStackFramework
60
- │ │ └── plugins/ # Sistema de plugins built-in
61
- │ │ ├── logger.ts # Logging avançado
62
- │ │ ├── swagger.ts # Documentação automática
63
- │ │ ├── vite.ts # Integração Vite
64
- │ │ └── static.ts # Arquivos estáticos
65
- │ ├── config/
66
- │ │ ├── env-dynamic.ts # Environment variables dinâmicas
67
- │ │ └── runtime-config.ts # Configuração runtime
68
- │ ├── types/
69
- │ │ └── index.ts # Types do framework
70
- │ └── build/
71
- │ └── index.ts # Sistema de build
72
- ├── app/ # 👨‍💻 APPLICATION CODE
73
- │ ├── server/
74
- │ │ ├── controllers/ # Business logic
75
- │ │ ├── routes/ # API endpoints
76
- │ │ └── app.ts # App type export
77
- │ ├── client/
78
- │ │ ├── src/
79
- │ │ │ ├── components/ # React components
80
- │ │ │ ├── lib/ # Eden Treaty client
81
- │ │ │ └── App.tsx # Main interface
82
- │ │ └── public/ # Static assets
83
- │ └── shared/
84
- │ └── types/ # Shared types
85
- └── ai-context/ # 📖 LLM Documentation
86
- ```
87
-
88
- ### **⚙️ Framework Core Architecture**
89
-
90
- #### **🎮 FluxStackFramework Class**
91
- ```typescript
92
- export class FluxStackFramework {
93
- private app: Elysia
94
- private plugins: Plugin[] = []
95
-
96
- constructor(options: FluxStackOptions) {
97
- this.app = new Elysia()
98
- this.loadCorePlugins()
99
- this.setupRoutes()
100
- }
101
-
102
- // Plugin system
103
- use(plugin: Plugin): this
104
-
105
- // Development server
106
- startDev(): Promise<void>
107
-
108
- // Production server
109
- start(): Promise<void>
110
-
111
- // Build system
112
- build(): Promise<void>
113
- }
114
- ```
115
-
116
- #### **🔌 Plugin System**
117
- ```typescript
118
- export interface Plugin {
119
- name: string
120
- version?: string
121
- dependencies?: string[]
122
- setup(context: FluxStackContext, app: Elysia): void
123
- }
124
-
125
- // Built-in plugins
126
- const corePlugins = [
127
- loggerPlugin, // Request/response logging
128
- swaggerPlugin, // API documentation
129
- vitePlugin, // Frontend integration
130
- staticPlugin // Static file serving
131
- ]
132
- ```
133
-
134
- ### **🔄 Communication Architecture**
135
-
136
- #### **📡 Eden Treaty Integration**
137
- ```typescript
138
- // Server: Export app type
139
- export type App = typeof appInstance
140
-
141
- // Client: Import and use
142
- import { treaty } from '@elysiajs/eden'
143
- import type { App } from '../../../server/app'
144
-
145
- const client = treaty<App>(baseUrl)
146
- export const api = client.api // ✨ Full type inference
147
- ```
148
-
149
- #### **🔒 Type Flow**
150
- ```
151
- 1. Server defines routes with TypeBox schemas
152
- 2. Elysia generates TypeScript types
153
- 3. App.ts exports combined app type
154
- 4. Eden Treaty imports app type
155
- 5. Client gets automatic type inference
156
- 6. Changes server → automatic client updates
157
- ```
158
-
159
- ## 🚀 **Runtime Architecture**
160
-
161
- ### **🔄 Development Mode**
162
- ```
163
- ┌─────────────────┐ ┌─────────────────┐
164
- │ Bun Process │ │ Vite Process │
165
- │ │ │ │
166
- │ ┌─────────────┐ │ │ ┌─────────────┐ │
167
- │ │FluxStack │ │ │ │React HMR │ │
168
- │ │Framework │ │ │ │Server │ │
169
- │ │:3000 │ │ │ │:5173 │ │
170
- │ └─────────────┘ │ │ └─────────────┘ │
171
- └─────────────────┘ └─────────────────┘
172
- │ │
173
- └─────── CORS ──────────┘
174
- (Different ports)
175
- ```
176
-
177
- ### **🏭 Production Mode**
178
- ```
179
- ┌─────────────────────────────────┐
180
- │ Bun Process │
181
- │ │
182
- │ ┌─────────────┐ ┌─────────────┐ │
183
- │ │FluxStack │ │Static Files │ │
184
- │ │API Server │ │Server │ │
185
- │ │:3000/api │ │:3000/ │ │
186
- │ └─────────────┘ └─────────────┘ │
187
- └─────────────────────────────────┘
188
- Single process
189
- ```
190
-
191
- ## 🛠️ **Build Architecture**
192
-
193
- ### **📦 Build Stages**
194
- ```typescript
195
- // 1. Frontend Build (Vite)
196
- const frontendBuild = {
197
- input: 'app/client/src/main.tsx',
198
- output: 'dist/client/',
199
- mode: 'production',
200
- env: process.env
201
- }
202
-
203
- // 2. Backend Build (Bun)
204
- const backendBuild = {
205
- input: 'app/server/index.ts',
206
- output: 'dist/server/',
207
- target: 'bun',
208
- minify: true
209
- }
210
-
211
- // 3. Framework Core (No build - TypeScript)
212
- // Core remains as TypeScript for performance
213
- ```
214
-
215
- ### **🐳 Docker Architecture**
216
- ```dockerfile
217
- # Multi-stage build
218
- FROM oven/bun:1 as builder
219
- WORKDIR /app
220
- COPY package.json bun.lock ./
221
- RUN bun install --frozen-lockfile
222
-
223
- # Build stage
224
- COPY . .
225
- RUN bun run build
226
-
227
- # Runtime stage
228
- FROM oven/bun:1 as runtime
229
- WORKDIR /app
230
- COPY --from=builder /app/dist ./dist
231
- COPY --from=builder /app/package.json ./
232
- EXPOSE 3000
233
- CMD ["bun", "dist/index.js"]
234
- ```
235
-
236
- ## ⚡ **Performance Architecture**
237
-
238
- ### **🚀 Bun Runtime Benefits**
239
- - **3x faster startup** vs Node.js
240
- - **Built-in bundler** (faster than webpack)
241
- - **Native fetch** & Web APIs
242
- - **Low memory footprint**
243
-
244
- ### **📈 Elysia Performance**
245
- - **Zero-cost abstractions**
246
- - **Compile-time optimizations**
247
- - **Minimal runtime overhead**
248
- - **Built-in validation** with TypeBox
249
-
250
- ### **🔄 Hot Reload Strategy**
251
- ```typescript
252
- // Backend: File watching with Bun
253
- Bun.watch("app/server/**/*.ts", {
254
- onUpdate: () => {
255
- // Restart server preserving connections
256
- server.reload()
257
- }
258
- })
259
-
260
- // Frontend: Vite HMR
261
- // Independent hot module replacement
262
- // No server restart required
263
- ```
264
-
265
- ## 🧪 **Testing Architecture**
266
-
267
- ### **🔬 Test Strategy**
268
- ```
269
- ┌─────────────────────────────────────────┐
270
- │ Test Pyramid │
271
- ├─────────────────────────────────────────┤
272
- │ E2E Tests (Playwright) │ ← Full app tests
273
- ├─────────────────────────────────────────┤
274
- │ Integration Tests (Vitest) │ ← API + UI tests
275
- ├─────────────────────────────────────────┤
276
- │ Unit Tests (Vitest + React Testing) │ ← Component tests
277
- └─────────────────────────────────────────┘
278
- ```
279
-
280
- ### **🧪 Test Configuration**
281
- ```typescript
282
- // vitest.config.ts
283
- export default defineConfig({
284
- test: {
285
- environment: 'jsdom', // React testing
286
- setupFiles: ['./tests/setup.ts'],
287
- coverage: {
288
- reporter: ['text', 'html'],
289
- threshold: {
290
- global: {
291
- branches: 80,
292
- functions: 80,
293
- lines: 80,
294
- statements: 80
295
- }
296
- }
297
- }
298
- }
299
- })
300
- ```
301
-
302
- ## 🔧 **Configuration Architecture**
303
-
304
- ### **⚙️ Dynamic Environment System**
305
- ```typescript
306
- // Precedence: Process Env > Runtime > .env > Defaults
307
- class EnvironmentManager {
308
- static precedence = [
309
- 'process.env', // Highest priority
310
- 'runtime.env', // Runtime overrides
311
- 'file.env', // .env file
312
- 'defaults' // Framework defaults
313
- ]
314
-
315
- static get(key: string): string {
316
- return this.resolveWithPrecedence(key)
317
- }
318
- }
319
- ```
320
-
321
- ### **🎛️ Plugin Configuration**
322
- ```typescript
323
- interface PluginConfig {
324
- logger: {
325
- level: 'debug' | 'info' | 'warn' | 'error'
326
- format: 'json' | 'pretty'
327
- }
328
- swagger: {
329
- path: string
330
- title: string
331
- version: string
332
- }
333
- vite: {
334
- port: number
335
- host: string
336
- open: boolean
337
- }
338
- }
339
- ```
340
-
341
- ## 🚀 **Deployment Architecture**
342
-
343
- ### **☁️ Production Deployment Options**
344
-
345
- #### **1. Single Container (Recommended)**
346
- ```yaml
347
- # docker-compose.yml
348
- services:
349
- app:
350
- build: .
351
- ports:
352
- - "3000:3000"
353
- environment:
354
- - NODE_ENV=production
355
- - DATABASE_URL=${DATABASE_URL}
356
- ```
357
-
358
- #### **2. Microservices (Advanced)**
359
- ```yaml
360
- services:
361
- api:
362
- build:
363
- target: api-only
364
- ports:
365
- - "3000:3000"
366
-
367
- frontend:
368
- build:
369
- target: frontend-only
370
- ports:
371
- - "80:80"
372
- ```
373
-
374
- #### **3. Serverless (Future)**
375
- ```typescript
376
- // Planned: Vercel/Netlify adapters
377
- export default FluxStackFramework.createServerlessHandler({
378
- platform: 'vercel' | 'netlify' | 'aws-lambda'
379
- })
380
- ```
381
-
382
- ## 🔮 **Future Architecture**
383
-
384
- ### **📈 Planned Enhancements**
385
- - **Database Layer**: Native ORM integration
386
- - **Authentication**: Built-in auth system
387
- - **Real-time**: WebSocket support
388
- - **Microservices**: Service mesh support
389
- - **Observability**: Metrics & tracing
390
-
391
- ### **🎯 Architecture Goals**
392
- - **Zero config** for common use cases
393
- - **Infinite customization** for advanced needs
394
- - **Production ready** out of the box
395
- - **Developer happiness** as top priority
396
-
397
- ---
398
-
399
- **🎯 Esta arquitetura garante que FluxStack seja tanto simples para começar quanto poderoso para escalar!**
@@ -1,213 +0,0 @@
1
- # 🚀 FluxStack - Visão Geral do Projeto
2
-
3
- ## 📋 **Resumo Executivo**
4
-
5
- **FluxStack** é um framework full-stack moderno que combina **Bun**, **Elysia.js**, **React 19** e **TypeScript** numa arquitetura monorepo unificada com **type-safety end-to-end automática** via Eden Treaty.
6
-
7
- ### 🎯 **Diferenciais**
8
- - **⚡ Performance**: Bun runtime (3x mais rápido que Node.js)
9
- - **🔒 Type Safety**: Inferência automática client↔server sem declarações manuais
10
- - **🔥 Hot Reload**: Backend e frontend independentes
11
- - **📖 Auto-docs**: Swagger UI gerado automaticamente
12
- - **🧪 Testing**: Suite completa com Vitest
13
- - **🐳 Deploy**: Docker otimizado incluído
14
-
15
- ## 📊 **Estado Atual (Janeiro 2025)**
16
-
17
- ### ✅ **Sistema Estável**
18
- - **Zero erros TypeScript** (vs 200+ anteriormente)
19
- - **100% type inference** Eden Treaty funcionando
20
- - **Hot reload independente** backend/frontend
21
- - **Monorepo unificado** com uma instalação
22
- - **Response schemas** completos para documentação automática
23
-
24
- ### 📈 **Estatísticas**
25
- - **Runtime**: Bun 1.1.34+
26
- - **Frontend**: React 19.1.0 + Vite 7.0.4
27
- - **Backend**: Elysia.js 1.3.7 + TypeScript 5.8.3
28
- - **Testing**: Vitest 3.2.4 + 100% taxa de sucesso
29
- - **Build**: Docker multi-stage otimizado
30
-
31
- ## 🏗️ **Arquitetura Tecnológica**
32
-
33
- ### **Backend Stack**
34
- ```typescript
35
- // Runtime & Framework
36
- Bun 1.1.34+ // Runtime ultrarrápido
37
- Elysia.js 1.3.7 // Framework web performático
38
- TypeScript 5.8.3 // Type safety total
39
-
40
- // APIs & Documentação
41
- Eden Treaty // Type-safe client generation
42
- Swagger UI // Documentação automática
43
- TypeBox // Validação runtime + compile-time
44
- ```
45
-
46
- ### **Frontend Stack**
47
- ```typescript
48
- // UI & Build
49
- React 19.1.0 // UI library com Concurrent Features
50
- Vite 7.0.4 // Build tool + HMR ultrarrápido
51
- TypeScript 5.8.3 // Type safety client
52
-
53
- // Styling & State
54
- CSS Moderno // Custom properties + Grid/Flexbox
55
- React Hooks Nativos // useState, useEffect, etc.
56
- ```
57
-
58
- ### **DevTools & Testing**
59
- ```typescript
60
- // Testing & Quality
61
- Vitest 3.2.4 // Test runner rápido
62
- JSDOM // DOM testing environment
63
- ESLint 9.30.1 // Code quality
64
- TypeScript Compiler // Type checking
65
-
66
- // CI/CD & Deploy
67
- GitHub Actions // Continuous integration
68
- Docker // Containerização
69
- Multi-stage builds // Otimização de imagem
70
- ```
71
-
72
- ## 📁 **Estrutura do Projeto**
73
-
74
- ```
75
- FluxStack/
76
- ├── core/ # 🔒 FRAMEWORK (read-only)
77
- │ ├── server/ # Framework Elysia + plugins
78
- │ ├── config/ # Sistema de configuração
79
- │ ├── types/ # Types do framework
80
- │ └── build/ # Sistema de build
81
- ├── app/ # 👨‍💻 CÓDIGO DA APLICAÇÃO
82
- │ ├── server/ # Backend (controllers, routes)
83
- │ │ ├── controllers/ # Lógica de negócio
84
- │ │ ├── routes/ # Endpoints da API
85
- │ │ └── app.ts # Export do tipo para Eden Treaty
86
- │ ├── client/ # Frontend (React + Vite)
87
- │ │ ├── src/components/ # Componentes React
88
- │ │ ├── src/lib/ # Cliente Eden Treaty
89
- │ │ └── src/App.tsx # Interface principal
90
- │ └── shared/ # Types compartilhados
91
- ├── tests/ # Testes do framework
92
- ├── docs/ # Documentação técnica
93
- └── ai-context/ # 📖 Esta documentação
94
- ```
95
-
96
- ## 🚀 **Funcionalidades Principais**
97
-
98
- ### ✨ **1. Type Safety End-to-End**
99
- ```typescript
100
- // ✅ Eden Treaty infere automaticamente
101
- const { data: user, error } = await api.users.post({
102
- name: "João",
103
- email: "joao@example.com"
104
- })
105
-
106
- // TypeScript sabe que:
107
- // - user: UserResponse = { success: boolean; user?: User; message?: string }
108
- // - error: undefined (em caso de sucesso)
109
- ```
110
-
111
- ### ⚡ **2. Hot Reload Independente**
112
- ```bash
113
- bun run dev # Backend + Frontend juntos
114
- # Backend recarrega sem afetar frontend
115
- # Frontend HMR sem reiniciar backend
116
- ```
117
-
118
- ### 📖 **3. Documentação Automática**
119
- ```typescript
120
- // ✅ Swagger gerado automaticamente das rotas
121
- .post("/users", handler, {
122
- body: t.Object({
123
- name: t.String(),
124
- email: t.String({ format: "email" })
125
- }),
126
- response: t.Object({
127
- success: t.Boolean(),
128
- user: t.Optional(t.Object({...}))
129
- })
130
- })
131
- // → Vira documentação automática
132
- ```
133
-
134
- ### 🧪 **4. Testing Integrado**
135
- ```bash
136
- bun run test # Todos os testes
137
- bun run test:ui # Interface visual
138
- bun run test:coverage # Relatório cobertura
139
- ```
140
-
141
- ## 🔄 **Fluxo de Desenvolvimento**
142
-
143
- ### **1. Desenvolvimento Local**
144
- ```bash
145
- bun install # Uma instalação (monorepo)
146
- bun run dev # Full-stack server
147
- # → Backend: http://localhost:3000
148
- # → Frontend: http://localhost:5173
149
- # → Swagger: http://localhost:3000/swagger
150
- ```
151
-
152
- ### **2. Criação de Features**
153
- ```typescript
154
- // 1. Types em app/shared/
155
- export interface Product { id: number; name: string }
156
-
157
- // 2. Controller em app/server/controllers/
158
- export class ProductsController { ... }
159
-
160
- // 3. Routes em app/server/routes/
161
- export const productsRoutes = new Elysia()...
162
-
163
- // 4. Frontend em app/client/src/
164
- const { data, error } = await api.products.get()
165
- ```
166
-
167
- ### **3. Build & Deploy**
168
- ```bash
169
- bun run build # Build otimizado
170
- bun run start # Servidor produção
171
- # ou
172
- docker build . # Container Docker
173
- ```
174
-
175
- ## 🎯 **Casos de Uso Ideais**
176
-
177
- ### ✅ **Excelente Para:**
178
- - **APIs REST modernas** com documentação automática
179
- - **SPAs React** com type safety total
180
- - **Protótipos rápidos** com hot reload
181
- - **Microserviços** com alta performance
182
- - **Apps corporativos** com qualidade enterprise
183
-
184
- ### ⚠️ **Considere Alternativas Para:**
185
- - **Apps server-side rendering** complexos (use Next.js)
186
- - **Projetos que precisam de Node.js** específico
187
- - **Teams sem experiência TypeScript** (curva de aprendizado)
188
-
189
- ## 📈 **Roadmap & Futuro**
190
-
191
- ### 🎯 **Próximas Versões**
192
- - **Database layer**: Integração nativa com ORMs
193
- - **Authentication**: Sistema de auth built-in
194
- - **Real-time**: WebSockets + Server-Sent Events
195
- - **API versioning**: Versionamento automático
196
- - **Monitoring**: Métricas e observabilidade
197
-
198
- ### 🔮 **Visão de Longo Prazo**
199
- - Framework **plug-and-play** para startups
200
- - **Marketplace de plugins** da comunidade
201
- - **Templates** para domínios específicos
202
- - **CLI generator** para scaffolding
203
-
204
- ## 🆘 **Suporte & Comunidade**
205
-
206
- - **📖 Documentação**: Esta pasta `ai-context/`
207
- - **🐛 Issues**: GitHub repository
208
- - **💬 Discussões**: GitHub Discussions
209
- - **📧 Email**: Para questões privadas
210
-
211
- ---
212
-
213
- **🎯 FluxStack é ideal para desenvolvedores que querem produtividade máxima com type safety garantida e performance de ponta.**