create-fluxstack 1.19.0 → 1.20.1

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 (37) hide show
  1. package/LLMD/INDEX.md +1 -1
  2. package/LLMD/MAINTENANCE.md +197 -197
  3. package/LLMD/MIGRATION.md +44 -1
  4. package/LLMD/agent.md +20 -7
  5. package/LLMD/config/declarative-system.md +268 -268
  6. package/LLMD/config/environment-vars.md +3 -6
  7. package/LLMD/config/runtime-reload.md +401 -401
  8. package/LLMD/core/build-system.md +599 -599
  9. package/LLMD/core/framework-lifecycle.md +249 -229
  10. package/LLMD/core/plugin-system.md +154 -100
  11. package/LLMD/patterns/anti-patterns.md +397 -397
  12. package/LLMD/patterns/project-structure.md +264 -264
  13. package/LLMD/patterns/type-safety.md +61 -5
  14. package/LLMD/reference/cli-commands.md +31 -7
  15. package/LLMD/reference/plugin-hooks.md +4 -2
  16. package/LLMD/reference/troubleshooting.md +364 -364
  17. package/LLMD/resources/controllers.md +465 -465
  18. package/LLMD/resources/live-auth.md +178 -1
  19. package/LLMD/resources/live-binary-delta.md +3 -1
  20. package/LLMD/resources/live-components.md +1192 -1041
  21. package/LLMD/resources/live-logging.md +3 -1
  22. package/LLMD/resources/live-rooms.md +1 -1
  23. package/LLMD/resources/live-upload.md +228 -181
  24. package/LLMD/resources/plugins-external.md +8 -7
  25. package/LLMD/resources/rest-auth.md +290 -290
  26. package/LLMD/resources/routes-eden.md +254 -254
  27. package/app/client/.live-stubs/LiveAdminPanel.js +15 -0
  28. package/app/client/.live-stubs/LiveCounter.js +9 -0
  29. package/app/client/.live-stubs/LiveForm.js +11 -0
  30. package/app/client/.live-stubs/LiveLocalCounter.js +8 -0
  31. package/app/client/.live-stubs/LivePingPong.js +10 -0
  32. package/app/client/.live-stubs/LiveRoomChat.js +11 -0
  33. package/app/client/.live-stubs/LiveSharedCounter.js +10 -0
  34. package/app/client/.live-stubs/LiveUpload.js +15 -0
  35. package/app/server/live/auto-generated-components.ts +1 -1
  36. package/core/utils/version.ts +6 -6
  37. package/package.json +108 -108
@@ -1,254 +1,254 @@
1
- # Routes with Eden Treaty
2
-
3
- **Version:** 1.11.0 | **Updated:** 2025-02-08
4
-
5
- ## Quick Facts
6
-
7
- - Routes use Elysia with `t.Object()` validation schemas
8
- - **Response schemas are REQUIRED** for Eden Treaty type inference
9
- - Frontend gets automatic type inference via Eden Treaty
10
- - Route grouping uses `prefix` option
11
- - Validation happens automatically via schemas
12
-
13
- ## Route Definition Pattern
14
-
15
- ```typescript
16
- import { Elysia, t } from 'elysia'
17
-
18
- export const usersRoutes = new Elysia({ prefix: '/users', tags: ['Users'] })
19
- .get('/', async () => {
20
- // Handler logic
21
- return { success: true, users: [], count: 0 }
22
- }, {
23
- detail: {
24
- summary: 'Get All Users',
25
- description: 'Retrieves a list of all registered users',
26
- tags: ['Users', 'CRUD']
27
- },
28
- response: t.Object({
29
- success: t.Boolean(),
30
- users: t.Array(UserSchema),
31
- count: t.Number()
32
- })
33
- })
34
- ```
35
-
36
- ## Schema Definition
37
-
38
- Define schemas at the top of route files:
39
-
40
- ```typescript
41
- const UserSchema = t.Object({
42
- id: t.Number(),
43
- name: t.String(),
44
- email: t.String()
45
- }, {
46
- description: 'User object'
47
- })
48
-
49
- const CreateUserRequestSchema = t.Object({
50
- name: t.String({ minLength: 2, description: 'User name (minimum 2 characters)' }),
51
- email: t.String({ format: 'email', description: 'Valid email address' })
52
- }, {
53
- description: 'Request body for creating a new user'
54
- })
55
- ```
56
-
57
- ## Response Schema (REQUIRED!)
58
-
59
- **Every route MUST define a response schema** for Eden Treaty type inference:
60
-
61
- ```typescript
62
- .get('/users', async () => {
63
- return { success: true, users: [] }
64
- }, {
65
- response: t.Object({
66
- success: t.Boolean(),
67
- users: t.Array(UserSchema)
68
- })
69
- })
70
- ```
71
-
72
- Without response schema, frontend loses type inference.
73
-
74
- ## Multiple Status Code Responses
75
-
76
- ```typescript
77
- .post('/', async ({ body, set }) => {
78
- // Validation error
79
- if (!body.name) {
80
- set.status = 400
81
- return { success: false, error: 'Name required' }
82
- }
83
-
84
- // Success
85
- set.status = 201
86
- return { success: true, user: newUser }
87
- }, {
88
- body: CreateUserRequestSchema,
89
- response: {
90
- 201: t.Object({
91
- success: t.Literal(true),
92
- user: UserSchema
93
- }),
94
- 400: t.Object({
95
- success: t.Literal(false),
96
- error: t.String()
97
- })
98
- }
99
- })
100
- ```
101
-
102
- ## Route Parameters
103
-
104
- ```typescript
105
- .get('/:id', async ({ params }) => {
106
- const id = Number(params.id)
107
- return { success: true, user: foundUser }
108
- }, {
109
- params: t.Object({
110
- id: t.String({ description: 'User ID' })
111
- }),
112
- response: {
113
- 200: GetUserResponseSchema,
114
- 404: ErrorResponseSchema
115
- }
116
- })
117
- ```
118
-
119
- ## Request Body Validation
120
-
121
- ```typescript
122
- .post('/', async ({ body }) => {
123
- // body is automatically validated against schema
124
- const user = await createUser(body)
125
- return { success: true, user }
126
- }, {
127
- body: t.Object({
128
- name: t.String({ minLength: 2 }),
129
- email: t.String({ format: 'email' })
130
- }),
131
- response: CreateUserResponseSchema
132
- })
133
- ```
134
-
135
- ## Route Grouping
136
-
137
- ```typescript
138
- // Main API routes with prefix
139
- export const apiRoutes = new Elysia({ prefix: "/api" })
140
- .get("/health", () => ({ status: "ok" }), {
141
- response: t.Object({ status: t.String() })
142
- })
143
- // Register sub-routes
144
- .use(usersRoutes)
145
- .use(postsRoutes)
146
- ```
147
-
148
- ## Frontend Usage (Eden Treaty)
149
-
150
- Once routes are defined with response schemas, frontend gets automatic type inference:
151
-
152
- ```typescript
153
- import { api } from '@/lib/eden-api'
154
-
155
- // GET request - types inferred from response schema
156
- const { data, error } = await api.users.get()
157
- // data: { success: boolean, users: User[], count: number } | undefined
158
- // error: Error | undefined
159
-
160
- // POST request - body type inferred from body schema
161
- const { data, error } = await api.users.post({
162
- name: 'John Doe',
163
- email: 'john@example.com'
164
- })
165
- // TypeScript validates body matches CreateUserRequestSchema
166
-
167
- // Path parameters
168
- const { data } = await api.users({ id: '123' }).get()
169
-
170
- // Query parameters
171
- const { data } = await api.users.get({
172
- query: { page: 1, limit: 10 }
173
- })
174
- ```
175
-
176
- ## Type Flow Diagram
177
-
178
- ```
179
- Backend Route Definition
180
-
181
- t.Object() Schema (response)
182
-
183
- Eden Treaty Type Inference
184
-
185
- Frontend api.users.get()
186
-
187
- Typed { data, error }
188
- ```
189
-
190
- ## Common Validation Types
191
-
192
- ```typescript
193
- // String validations
194
- t.String({ minLength: 2, maxLength: 100 })
195
- t.String({ format: 'email' })
196
- t.String({ pattern: '^[a-z]+$' })
197
-
198
- // Number validations
199
- t.Number({ minimum: 0, maximum: 100 })
200
- t.Integer()
201
-
202
- // Arrays
203
- t.Array(t.String())
204
- t.Array(UserSchema, { minItems: 1 })
205
-
206
- // Optional fields
207
- t.Optional(t.String())
208
-
209
- // Unions (multiple types)
210
- t.Union([
211
- t.Object({ success: t.Literal(true), data: t.Any() }),
212
- t.Object({ success: t.Literal(false), error: t.String() })
213
- ])
214
-
215
- // Enums
216
- t.Union([t.Literal('active'), t.Literal('inactive')])
217
- ```
218
-
219
- ## OpenAPI Documentation
220
-
221
- The `detail` object generates OpenAPI/Swagger documentation:
222
-
223
- ```typescript
224
- .get('/users', handler, {
225
- detail: {
226
- summary: 'Get All Users',
227
- description: 'Retrieves a list of all registered users',
228
- tags: ['Users', 'CRUD']
229
- },
230
- response: ResponseSchema
231
- })
232
- ```
233
-
234
- Access Swagger UI at `/swagger` when server is running.
235
-
236
- ## Critical Rules
237
-
238
- **ALWAYS:**
239
- - Define response schema for every route
240
- - Use `t.Object()` for validation
241
- - Set `set.status` for non-200 responses
242
- - Define schemas at file top for reusability
243
-
244
- **NEVER:**
245
- - Omit response schema (breaks type inference)
246
- - Use plain objects without `t.Object()`
247
- - Forget to validate user input
248
- - Mix route logic with business logic (use controllers)
249
-
250
- ## Related
251
-
252
- - [Controllers & Services](./controllers.md)
253
- - [Type Safety Patterns](../patterns/type-safety.md)
254
- - [Anti-Patterns](../patterns/anti-patterns.md)
1
+ # Routes with Eden Treaty
2
+
3
+ **Version:** 1.19.0 | **Updated:** 2026-04-14
4
+
5
+ ## Quick Facts
6
+
7
+ - Routes use Elysia with `t.Object()` validation schemas
8
+ - **Response schemas are REQUIRED** for Eden Treaty type inference
9
+ - Frontend gets automatic type inference via Eden Treaty
10
+ - Route grouping uses `prefix` option
11
+ - Validation happens automatically via schemas
12
+
13
+ ## Route Definition Pattern
14
+
15
+ ```typescript
16
+ import { Elysia, t } from 'elysia'
17
+
18
+ export const usersRoutes = new Elysia({ prefix: '/users', tags: ['Users'] })
19
+ .get('/', async () => {
20
+ // Handler logic
21
+ return { success: true, users: [], count: 0 }
22
+ }, {
23
+ detail: {
24
+ summary: 'Get All Users',
25
+ description: 'Retrieves a list of all registered users',
26
+ tags: ['Users', 'CRUD']
27
+ },
28
+ response: t.Object({
29
+ success: t.Boolean(),
30
+ users: t.Array(UserSchema),
31
+ count: t.Number()
32
+ })
33
+ })
34
+ ```
35
+
36
+ ## Schema Definition
37
+
38
+ Define schemas at the top of route files:
39
+
40
+ ```typescript
41
+ const UserSchema = t.Object({
42
+ id: t.Number(),
43
+ name: t.String(),
44
+ email: t.String()
45
+ }, {
46
+ description: 'User object'
47
+ })
48
+
49
+ const CreateUserRequestSchema = t.Object({
50
+ name: t.String({ minLength: 2, description: 'User name (minimum 2 characters)' }),
51
+ email: t.String({ format: 'email', description: 'Valid email address' })
52
+ }, {
53
+ description: 'Request body for creating a new user'
54
+ })
55
+ ```
56
+
57
+ ## Response Schema (REQUIRED!)
58
+
59
+ **Every route MUST define a response schema** for Eden Treaty type inference:
60
+
61
+ ```typescript
62
+ .get('/users', async () => {
63
+ return { success: true, users: [] }
64
+ }, {
65
+ response: t.Object({
66
+ success: t.Boolean(),
67
+ users: t.Array(UserSchema)
68
+ })
69
+ })
70
+ ```
71
+
72
+ Without response schema, frontend loses type inference.
73
+
74
+ ## Multiple Status Code Responses
75
+
76
+ ```typescript
77
+ .post('/', async ({ body, set }) => {
78
+ // Validation error
79
+ if (!body.name) {
80
+ set.status = 400
81
+ return { success: false, error: 'Name required' }
82
+ }
83
+
84
+ // Success
85
+ set.status = 201
86
+ return { success: true, user: newUser }
87
+ }, {
88
+ body: CreateUserRequestSchema,
89
+ response: {
90
+ 201: t.Object({
91
+ success: t.Literal(true),
92
+ user: UserSchema
93
+ }),
94
+ 400: t.Object({
95
+ success: t.Literal(false),
96
+ error: t.String()
97
+ })
98
+ }
99
+ })
100
+ ```
101
+
102
+ ## Route Parameters
103
+
104
+ ```typescript
105
+ .get('/:id', async ({ params }) => {
106
+ const id = Number(params.id)
107
+ return { success: true, user: foundUser }
108
+ }, {
109
+ params: t.Object({
110
+ id: t.String({ description: 'User ID' })
111
+ }),
112
+ response: {
113
+ 200: GetUserResponseSchema,
114
+ 404: ErrorResponseSchema
115
+ }
116
+ })
117
+ ```
118
+
119
+ ## Request Body Validation
120
+
121
+ ```typescript
122
+ .post('/', async ({ body }) => {
123
+ // body is automatically validated against schema
124
+ const user = await createUser(body)
125
+ return { success: true, user }
126
+ }, {
127
+ body: t.Object({
128
+ name: t.String({ minLength: 2 }),
129
+ email: t.String({ format: 'email' })
130
+ }),
131
+ response: CreateUserResponseSchema
132
+ })
133
+ ```
134
+
135
+ ## Route Grouping
136
+
137
+ ```typescript
138
+ // Main API routes with prefix
139
+ export const apiRoutes = new Elysia({ prefix: "/api" })
140
+ .get("/health", () => ({ status: "ok" }), {
141
+ response: t.Object({ status: t.String() })
142
+ })
143
+ // Register sub-routes
144
+ .use(usersRoutes)
145
+ .use(postsRoutes)
146
+ ```
147
+
148
+ ## Frontend Usage (Eden Treaty)
149
+
150
+ Once routes are defined with response schemas, frontend gets automatic type inference:
151
+
152
+ ```typescript
153
+ import { api } from '@/lib/eden-api'
154
+
155
+ // GET request - types inferred from response schema
156
+ const { data, error } = await api.users.get()
157
+ // data: { success: boolean, users: User[], count: number } | undefined
158
+ // error: Error | undefined
159
+
160
+ // POST request - body type inferred from body schema
161
+ const { data, error } = await api.users.post({
162
+ name: 'John Doe',
163
+ email: 'john@example.com'
164
+ })
165
+ // TypeScript validates body matches CreateUserRequestSchema
166
+
167
+ // Path parameters
168
+ const { data } = await api.users({ id: '123' }).get()
169
+
170
+ // Query parameters
171
+ const { data } = await api.users.get({
172
+ query: { page: 1, limit: 10 }
173
+ })
174
+ ```
175
+
176
+ ## Type Flow Diagram
177
+
178
+ ```
179
+ Backend Route Definition
180
+
181
+ t.Object() Schema (response)
182
+
183
+ Eden Treaty Type Inference
184
+
185
+ Frontend api.users.get()
186
+
187
+ Typed { data, error }
188
+ ```
189
+
190
+ ## Common Validation Types
191
+
192
+ ```typescript
193
+ // String validations
194
+ t.String({ minLength: 2, maxLength: 100 })
195
+ t.String({ format: 'email' })
196
+ t.String({ pattern: '^[a-z]+$' })
197
+
198
+ // Number validations
199
+ t.Number({ minimum: 0, maximum: 100 })
200
+ t.Integer()
201
+
202
+ // Arrays
203
+ t.Array(t.String())
204
+ t.Array(UserSchema, { minItems: 1 })
205
+
206
+ // Optional fields
207
+ t.Optional(t.String())
208
+
209
+ // Unions (multiple types)
210
+ t.Union([
211
+ t.Object({ success: t.Literal(true), data: t.Any() }),
212
+ t.Object({ success: t.Literal(false), error: t.String() })
213
+ ])
214
+
215
+ // Enums
216
+ t.Union([t.Literal('active'), t.Literal('inactive')])
217
+ ```
218
+
219
+ ## OpenAPI Documentation
220
+
221
+ The `detail` object generates OpenAPI/Swagger documentation:
222
+
223
+ ```typescript
224
+ .get('/users', handler, {
225
+ detail: {
226
+ summary: 'Get All Users',
227
+ description: 'Retrieves a list of all registered users',
228
+ tags: ['Users', 'CRUD']
229
+ },
230
+ response: ResponseSchema
231
+ })
232
+ ```
233
+
234
+ Access Swagger UI at `/swagger` when server is running.
235
+
236
+ ## Critical Rules
237
+
238
+ **ALWAYS:**
239
+ - Define response schema for every route
240
+ - Use `t.Object()` for validation
241
+ - Set `set.status` for non-200 responses
242
+ - Define schemas at file top for reusability
243
+
244
+ **NEVER:**
245
+ - Omit response schema (breaks type inference)
246
+ - Use plain objects without `t.Object()`
247
+ - Forget to validate user input
248
+ - Mix route logic with business logic (use controllers)
249
+
250
+ ## Related
251
+
252
+ - [Controllers & Services](./controllers.md)
253
+ - [Type Safety Patterns](../patterns/type-safety.md)
254
+ - [Anti-Patterns](../patterns/anti-patterns.md)
@@ -0,0 +1,15 @@
1
+ export class LiveAdminPanel {
2
+ static componentName = 'LiveAdminPanel'
3
+ static defaultState = {
4
+ users: [
5
+ { id: '1', name: 'Alice', role: 'admin', createdAt: Date.now() },
6
+ { id: '2', name: 'Bob', role: 'user', createdAt: Date.now() },
7
+ { id: '3', name: 'Carol', role: 'moderator', createdAt: Date.now() },
8
+ ],
9
+ audit: [],
10
+ currentUser: null,
11
+ currentRoles: [],
12
+ isAdmin: false,
13
+ }
14
+ static publicActions = ['getAuthInfo', 'init', 'listUsers', 'addUser', 'deleteUser', 'clearAudit']
15
+ }
@@ -0,0 +1,9 @@
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
+ }
@@ -0,0 +1,11 @@
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
+ }
@@ -0,0 +1,8 @@
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
+ }
@@ -0,0 +1,10 @@
1
+ export class LivePingPong {
2
+ static componentName = 'LivePingPong'
3
+ static defaultState = {
4
+ username: '',
5
+ onlineCount: 0,
6
+ totalPings: 0,
7
+ lastPingBy: null,
8
+ }
9
+ static publicActions = ['ping']
10
+ }
@@ -0,0 +1,11 @@
1
+ export class LiveRoomChat {
2
+ static componentName = 'LiveRoomChat'
3
+ static defaultState = {
4
+ username: '',
5
+ activeRoom: null,
6
+ rooms: [],
7
+ messages: {},
8
+ customRooms: []
9
+ }
10
+ static publicActions = ['createRoom', 'joinRoom', 'leaveRoom', 'switchRoom', 'sendMessage', 'setUsername']
11
+ }
@@ -0,0 +1,10 @@
1
+ export class LiveSharedCounter {
2
+ static componentName = 'LiveSharedCounter'
3
+ static defaultState = {
4
+ username: '',
5
+ count: 0,
6
+ lastUpdatedBy: null,
7
+ onlineCount: 0
8
+ }
9
+ static publicActions = ['increment', 'decrement', 'reset']
10
+ }
@@ -0,0 +1,15 @@
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,6 +1,6 @@
1
1
  // Auto-generated Live Components Registration
2
2
  // Generated by @fluxstack/live — DO NOT EDIT MANUALLY
3
- // Generated at: 2026-04-11T19:00:17.642Z
3
+ // Generated at: 2026-04-12T17:15:28.136Z
4
4
 
5
5
  import { LiveAdminPanel } from "./LiveAdminPanel"
6
6
  import { LiveCounter } from "./LiveCounter"
@@ -1,6 +1,6 @@
1
- /**
2
- * FluxStack Framework Version
3
- * Single source of truth for version number
4
- * Auto-synced with package.json
5
- */
6
- export const FLUXSTACK_VERSION = '1.19.0'
1
+ /**
2
+ * FluxStack Framework Version
3
+ * Single source of truth for version number
4
+ * Auto-synced with package.json
5
+ */
6
+ export const FLUXSTACK_VERSION = '1.20.1'