create-fluxstack 1.8.1 → 1.8.3

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 (132) hide show
  1. package/.env.example +19 -0
  2. package/README.md +6 -3
  3. package/app/client/SIMPLIFICATION.md +140 -0
  4. package/app/client/frontend-only.ts +1 -1
  5. package/app/client/src/App.tsx +148 -283
  6. package/app/client/src/index.css +5 -20
  7. package/app/client/src/lib/eden-api.ts +53 -220
  8. package/app/client/src/main.tsx +2 -3
  9. package/app/server/controllers/users.controller.ts +57 -31
  10. package/app/server/index.ts +5 -2
  11. package/app/server/live/register-components.ts +18 -7
  12. package/app/server/routes/env-test.ts +53 -2
  13. package/app/server/routes/index.ts +1 -8
  14. package/app/server/routes/users.routes.ts +192 -91
  15. package/config/fluxstack.config.ts +2 -2
  16. package/config/plugins.config.ts +22 -1
  17. package/core/build/flux-plugins-generator.ts +5 -5
  18. package/core/build/live-components-generator.ts +15 -12
  19. package/core/cli/command-registry.ts +4 -14
  20. package/core/cli/commands/plugin-deps.ts +8 -8
  21. package/core/cli/generators/component.ts +3 -3
  22. package/core/cli/generators/controller.ts +4 -4
  23. package/core/cli/generators/index.ts +8 -8
  24. package/core/cli/generators/interactive.ts +4 -4
  25. package/core/cli/generators/plugin.ts +3 -3
  26. package/core/cli/generators/prompts.ts +1 -1
  27. package/core/cli/generators/route.ts +27 -11
  28. package/core/cli/generators/service.ts +5 -5
  29. package/core/cli/generators/template-engine.ts +1 -1
  30. package/core/cli/generators/types.ts +1 -1
  31. package/core/cli/index.ts +158 -193
  32. package/core/cli/plugin-discovery.ts +3 -3
  33. package/core/client/hooks/index.ts +2 -2
  34. package/core/client/hooks/state-validator.ts +1 -1
  35. package/core/client/hooks/useAuth.ts +1 -1
  36. package/core/client/hooks/useChunkedUpload.ts +1 -1
  37. package/core/client/hooks/useHybridLiveComponent.ts +1 -1
  38. package/core/client/hooks/useWebSocket.ts +1 -1
  39. package/core/config/env.ts +1 -1
  40. package/core/config/runtime-config.ts +5 -5
  41. package/core/config/schema.ts +9 -0
  42. package/core/framework/server.ts +30 -15
  43. package/core/framework/types.ts +2 -2
  44. package/core/live/ComponentRegistry.ts +1 -1
  45. package/core/plugins/built-in/live-components/commands/create-live-component.ts +1 -1
  46. package/core/plugins/built-in/live-components/index.ts +1 -1
  47. package/core/plugins/built-in/monitoring/index.ts +65 -161
  48. package/core/plugins/built-in/static/index.ts +18 -47
  49. package/core/plugins/built-in/swagger/index.ts +301 -231
  50. package/core/plugins/built-in/vite/index.ts +74 -109
  51. package/core/plugins/config.ts +2 -2
  52. package/core/plugins/dependency-manager.ts +2 -2
  53. package/core/plugins/discovery.ts +1 -1
  54. package/core/plugins/executor.ts +2 -2
  55. package/core/plugins/manager.ts +19 -4
  56. package/core/plugins/module-resolver.ts +1 -1
  57. package/core/plugins/registry.ts +3 -3
  58. package/core/plugins/types.ts +147 -5
  59. package/core/server/framework.ts +2 -2
  60. package/core/server/live/ComponentRegistry.ts +9 -26
  61. package/core/server/live/FileUploadManager.ts +1 -1
  62. package/core/server/live/auto-generated-components.ts +26 -0
  63. package/core/server/live/websocket-plugin.ts +211 -19
  64. package/core/server/middleware/errorHandling.ts +1 -1
  65. package/core/server/middleware/index.ts +4 -4
  66. package/core/server/plugins/database.ts +1 -2
  67. package/core/server/plugins/static-files-plugin.ts +259 -231
  68. package/core/server/plugins/swagger.ts +1 -1
  69. package/core/server/services/BaseService.ts +1 -1
  70. package/core/server/services/ServiceContainer.ts +1 -1
  71. package/core/server/services/index.ts +4 -4
  72. package/core/server/standalone.ts +16 -1
  73. package/core/testing/index.ts +1 -1
  74. package/core/testing/setup.ts +1 -1
  75. package/core/utils/logger/startup-banner.ts +7 -33
  76. package/core/utils/version.ts +6 -6
  77. package/create-fluxstack.ts +68 -25
  78. package/package.json +2 -2
  79. package/plugins/crypto-auth/index.ts +52 -47
  80. package/plugins/crypto-auth/server/AuthMiddleware.ts +1 -1
  81. package/plugins/crypto-auth/server/middlewares/helpers.ts +16 -1
  82. package/vitest.config.ts +11 -2
  83. package/app/client/src/App.css +0 -883
  84. package/app/client/src/components/ErrorBoundary.tsx +0 -107
  85. package/app/client/src/components/ErrorDisplay.css +0 -365
  86. package/app/client/src/components/ErrorDisplay.tsx +0 -258
  87. package/app/client/src/components/FluxStackConfig.tsx +0 -1321
  88. package/app/client/src/components/HybridLiveCounter.tsx +0 -140
  89. package/app/client/src/components/LiveClock.tsx +0 -286
  90. package/app/client/src/components/MainLayout.tsx +0 -388
  91. package/app/client/src/components/SidebarNavigation.tsx +0 -391
  92. package/app/client/src/components/StateDemo.tsx +0 -178
  93. package/app/client/src/components/SystemMonitor.tsx +0 -1044
  94. package/app/client/src/components/UserProfile.tsx +0 -809
  95. package/app/client/src/hooks/useAuth.ts +0 -39
  96. package/app/client/src/hooks/useNotifications.ts +0 -56
  97. package/app/client/src/lib/errors.ts +0 -340
  98. package/app/client/src/lib/hooks/useErrorHandler.ts +0 -258
  99. package/app/client/src/lib/index.ts +0 -45
  100. package/app/client/src/pages/ApiDocs.tsx +0 -182
  101. package/app/client/src/pages/CryptoAuthPage.tsx +0 -394
  102. package/app/client/src/pages/Demo.tsx +0 -174
  103. package/app/client/src/pages/HybridLive.tsx +0 -263
  104. package/app/client/src/pages/Overview.tsx +0 -155
  105. package/app/client/src/store/README.md +0 -43
  106. package/app/client/src/store/index.ts +0 -16
  107. package/app/client/src/store/slices/uiSlice.ts +0 -151
  108. package/app/client/src/store/slices/userSlice.ts +0 -161
  109. package/app/client/src/test/README.md +0 -257
  110. package/app/client/src/test/setup.ts +0 -70
  111. package/app/client/src/test/types.ts +0 -12
  112. package/app/server/live/CounterComponent.ts +0 -191
  113. package/app/server/live/FluxStackConfig.ts +0 -534
  114. package/app/server/live/SidebarNavigation.ts +0 -157
  115. package/app/server/live/SystemMonitor.ts +0 -595
  116. package/app/server/live/SystemMonitorIntegration.ts +0 -151
  117. package/app/server/live/UserProfileComponent.ts +0 -141
  118. package/app/server/middleware/auth.ts +0 -136
  119. package/app/server/middleware/errorHandling.ts +0 -252
  120. package/app/server/middleware/index.ts +0 -10
  121. package/app/server/middleware/rateLimit.ts +0 -193
  122. package/app/server/middleware/requestLogging.ts +0 -215
  123. package/app/server/middleware/validation.ts +0 -270
  124. package/app/server/routes/config.ts +0 -145
  125. package/app/server/routes/crypto-auth-demo.routes.ts +0 -167
  126. package/app/server/routes/example-with-crypto-auth.routes.ts +0 -235
  127. package/app/server/routes/exemplo-posts.routes.ts +0 -161
  128. package/app/server/routes/upload.ts +0 -92
  129. package/app/server/services/NotificationService.ts +0 -302
  130. package/app/server/services/UserService.ts +0 -222
  131. package/app/server/services/index.ts +0 -46
  132. package/app/server/types/index.ts +0 -1
@@ -1,231 +1,301 @@
1
- import { swagger } from '@elysiajs/swagger'
2
- import type { FluxStack, PluginContext } from '../../types'
3
-
4
- type Plugin = FluxStack.Plugin
5
-
6
- export const swaggerPlugin: Plugin = {
7
- name: 'swagger',
8
- version: '1.0.0',
9
- description: 'Enhanced Swagger documentation plugin for FluxStack with customizable options',
10
- author: 'FluxStack Team',
11
- priority: 500,
12
- category: 'documentation',
13
- tags: ['swagger', 'documentation', 'api'],
14
- dependencies: [], // No dependencies
15
-
16
- configSchema: {
17
- type: 'object',
18
- properties: {
19
- enabled: {
20
- type: 'boolean',
21
- description: 'Enable Swagger documentation'
22
- },
23
- path: {
24
- type: 'string',
25
- description: 'Swagger UI path'
26
- },
27
- title: {
28
- type: 'string',
29
- description: 'API documentation title'
30
- },
31
- description: {
32
- type: 'string',
33
- description: 'API documentation description'
34
- },
35
- version: {
36
- type: 'string',
37
- description: 'API version'
38
- },
39
- tags: {
40
- type: 'array',
41
- items: {
42
- type: 'object',
43
- properties: {
44
- name: { type: 'string' },
45
- description: { type: 'string' }
46
- },
47
- required: ['name']
48
- },
49
- description: 'API tags for grouping endpoints'
50
- },
51
- servers: {
52
- type: 'array',
53
- items: {
54
- type: 'object',
55
- properties: {
56
- url: { type: 'string' },
57
- description: { type: 'string' }
58
- },
59
- required: ['url']
60
- },
61
- description: 'API servers'
62
- },
63
- excludePaths: {
64
- type: 'array',
65
- items: { type: 'string' },
66
- description: 'Paths to exclude from documentation'
67
- },
68
- securitySchemes: {
69
- type: 'object',
70
- description: 'Security schemes definition'
71
- },
72
- globalSecurity: {
73
- type: 'array',
74
- items: {
75
- type: 'object'
76
- },
77
- description: 'Global security requirements'
78
- }
79
- },
80
- additionalProperties: false
81
- },
82
-
83
- defaultConfig: {
84
- enabled: true,
85
- path: '/swagger',
86
- title: 'FluxStack API',
87
- description: 'Modern full-stack TypeScript framework with type-safe API endpoints',
88
- version: '1.7.4',
89
- tags: [
90
- {
91
- name: 'Health',
92
- description: 'Health check endpoints'
93
- },
94
- {
95
- name: 'API',
96
- description: 'API endpoints'
97
- }
98
- ],
99
- servers: [],
100
- excludePaths: [],
101
- securitySchemes: {},
102
- globalSecurity: []
103
- },
104
-
105
- setup: async (context: PluginContext) => {
106
- const config = getPluginConfig(context)
107
-
108
- if (!config.enabled) {
109
- context.logger.debug('Swagger plugin disabled by configuration')
110
- return
111
- }
112
-
113
- try {
114
- // Build servers list
115
- const servers = config.servers.length > 0 ? config.servers : [
116
- {
117
- url: `http://${context.config.server.host}:${context.config.server.port}`,
118
- description: 'Development server'
119
- }
120
- ]
121
-
122
- // Add production server if in production
123
- if (context.utils.isProduction()) {
124
- servers.push({
125
- url: 'https://api.example.com', // This would be configured
126
- description: 'Production server'
127
- })
128
- }
129
-
130
- const swaggerConfig = {
131
- path: config.path,
132
- documentation: {
133
- info: {
134
- title: config.title || context.config.app?.name || 'FluxStack API',
135
- version: config.version || context.config.app?.version || '1.7.4',
136
- description: config.description || context.config.app?.description || 'Modern full-stack TypeScript framework with type-safe API endpoints'
137
- },
138
- tags: config.tags,
139
- servers,
140
-
141
- // Add security schemes if defined
142
- ...(Object.keys(config.securitySchemes).length > 0 && {
143
- components: {
144
- securitySchemes: config.securitySchemes
145
- }
146
- }),
147
-
148
- // Add global security if defined
149
- ...(config.globalSecurity.length > 0 && {
150
- security: config.globalSecurity
151
- })
152
- },
153
- exclude: config.excludePaths,
154
- swaggerOptions: {
155
- persistAuthorization: true,
156
- displayRequestDuration: true,
157
- filter: true,
158
- showExtensions: true,
159
- tryItOutEnabled: true
160
- }
161
- }
162
-
163
- context.app.use(swagger(swaggerConfig))
164
-
165
- context.logger.debug(`Swagger documentation enabled at ${config.path}`, {
166
- title: swaggerConfig.documentation.info.title,
167
- version: swaggerConfig.documentation.info.version,
168
- servers: servers.length
169
- })
170
- } catch (error) {
171
- context.logger.error('Failed to setup Swagger plugin', { error })
172
- throw error
173
- }
174
- },
175
-
176
- onServerStart: async (context: PluginContext) => {
177
- const config = getPluginConfig(context)
178
-
179
- if (config.enabled) {
180
- const swaggerUrl = `http://${context.config.server.host}:${context.config.server.port}${config.path}`
181
- context.logger.debug(`Swagger documentation available at: ${swaggerUrl}`)
182
- }
183
- }
184
- }
185
-
186
- // Helper function to get plugin config from context
187
- function getPluginConfig(context: PluginContext) {
188
- // In a real implementation, this would get the config from the plugin context
189
- // For now, merge default config with any provided config
190
- const pluginConfig = context.config.plugins.config?.swagger || {}
191
- return { ...swaggerPlugin.defaultConfig, ...pluginConfig }
192
- }
193
-
194
- // Example usage for security configuration:
195
- //
196
- // To enable security in your FluxStack app, configure like this:
197
- //
198
- // plugins: {
199
- // config: {
200
- // swagger: {
201
- // securitySchemes: {
202
- // bearerAuth: {
203
- // type: 'http',
204
- // scheme: 'bearer',
205
- // bearerFormat: 'JWT'
206
- // },
207
- // apiKeyAuth: {
208
- // type: 'apiKey',
209
- // in: 'header',
210
- // name: 'X-API-Key'
211
- // }
212
- // },
213
- // globalSecurity: [
214
- // { bearerAuth: [] } // Apply JWT auth globally
215
- // ]
216
- // }
217
- // }
218
- // }
219
- //
220
- // Then in your routes, you can override per endpoint:
221
- // app.get('/public', handler, {
222
- // detail: { security: [] } // No auth required
223
- // })
224
- //
225
- // app.get('/private', handler, {
226
- // detail: {
227
- // security: [{ apiKeyAuth: [] }] // API key required
228
- // }
229
- // })
230
-
231
- export default swaggerPlugin
1
+ import { swagger } from '@elysiajs/swagger'
2
+ import type { FluxStack, PluginContext } from '@/core/plugins/types'
3
+ import { appConfig } from '@/config/app.config'
4
+ import { serverConfig } from '@/config/server.config'
5
+ import { pluginsConfig } from '@/config/plugins.config'
6
+
7
+ type Plugin = FluxStack.Plugin
8
+
9
+ /**
10
+ * Parse servers from config string
11
+ * Format: "url1|description1,url2|description2"
12
+ */
13
+ function parseServersFromConfig(serversString: string): Array<{ url: string; description: string }> {
14
+ if (!serversString || serversString.trim() === '') {
15
+ return []
16
+ }
17
+
18
+ return serversString.split(',').map(server => {
19
+ const [url, description] = server.split('|').map(s => s.trim())
20
+ return {
21
+ url: url || '',
22
+ description: description || 'Server'
23
+ }
24
+ }).filter(s => s.url !== '')
25
+ }
26
+
27
+ // Configuration from config/plugins.config.ts (user editable)
28
+ const DEFAULTS = {
29
+ enabled: pluginsConfig.swaggerEnabled,
30
+ path: pluginsConfig.swaggerPath,
31
+ title: pluginsConfig.swaggerTitle,
32
+ description: pluginsConfig.swaggerDescription,
33
+ version: pluginsConfig.swaggerVersion,
34
+ excludePaths: pluginsConfig.swaggerExcludePaths,
35
+ servers: parseServersFromConfig(pluginsConfig.swaggerServers),
36
+
37
+ // Swagger UI options
38
+ swaggerOptions: {
39
+ persistAuthorization: pluginsConfig.swaggerPersistAuthorization,
40
+ displayRequestDuration: pluginsConfig.swaggerDisplayRequestDuration,
41
+ filter: pluginsConfig.swaggerEnableFilter,
42
+ showExtensions: pluginsConfig.swaggerShowExtensions,
43
+ tryItOutEnabled: pluginsConfig.swaggerTryItOutEnabled
44
+ },
45
+
46
+ // Authentication
47
+ authEnabled: pluginsConfig.swaggerAuthEnabled,
48
+ authUsername: pluginsConfig.swaggerAuthUsername,
49
+ authPassword: pluginsConfig.swaggerAuthPassword,
50
+
51
+ // Security (can be extended via env vars if needed)
52
+ securitySchemes: {},
53
+ globalSecurity: [] as Array<Record<string, any>>
54
+ }
55
+
56
+ export const swaggerPlugin: Plugin = {
57
+ name: 'swagger',
58
+ version: '1.0.0',
59
+ description: 'Swagger documentation plugin for FluxStack with automatic tag discovery',
60
+ author: 'FluxStack Team',
61
+ priority: 500,
62
+ category: 'documentation',
63
+ tags: ['swagger', 'documentation', 'api'],
64
+ dependencies: [],
65
+
66
+ setup: async (context: PluginContext) => {
67
+ if (!DEFAULTS.enabled) {
68
+ context.logger.debug('Swagger plugin disabled by configuration')
69
+ return
70
+ }
71
+
72
+ try {
73
+ // Build servers list
74
+ const servers = DEFAULTS.servers.length > 0 ? DEFAULTS.servers : [
75
+ {
76
+ url: `http://${serverConfig.server.host}:${serverConfig.server.port}`,
77
+ description: 'Development server'
78
+ }
79
+ ]
80
+
81
+ // Add production server if in production
82
+ if (context.utils.isProduction()) {
83
+ servers.push({
84
+ url: 'https://api.example.com', // This would be configured
85
+ description: 'Production server'
86
+ })
87
+ }
88
+
89
+ // Simple Swagger configuration - all options from config/plugins.config.ts
90
+ const swaggerConfig = {
91
+ path: DEFAULTS.path,
92
+ documentation: {
93
+ info: {
94
+ title: DEFAULTS.title || appConfig.name || 'FluxStack API',
95
+ version: DEFAULTS.version || appConfig.version,
96
+ description: DEFAULTS.description || appConfig.description || 'Modern full-stack TypeScript framework with type-safe API endpoints'
97
+ },
98
+ servers,
99
+
100
+ // Add security schemes if defined
101
+ ...(Object.keys(DEFAULTS.securitySchemes).length > 0 && {
102
+ components: {
103
+ securitySchemes: DEFAULTS.securitySchemes
104
+ }
105
+ }),
106
+
107
+ // Add global security if defined
108
+ ...(DEFAULTS.globalSecurity.length > 0 && {
109
+ security: DEFAULTS.globalSecurity
110
+ })
111
+ },
112
+ exclude: DEFAULTS.excludePaths,
113
+ swaggerOptions: DEFAULTS.swaggerOptions
114
+ }
115
+
116
+ // Add Basic Auth middleware if enabled
117
+ if (DEFAULTS.authEnabled && DEFAULTS.authPassword) {
118
+ context.app.onBeforeHandle({ as: 'global' }, ({ request, set, path }) => {
119
+ // Only protect Swagger routes
120
+ if (!path.startsWith(DEFAULTS.path)) {
121
+ return
122
+ }
123
+
124
+ const authHeader = request.headers.get('authorization')
125
+
126
+ if (!authHeader || !authHeader.startsWith('Basic ')) {
127
+ set.status = 401
128
+ set.headers['WWW-Authenticate'] = 'Basic realm="Swagger Documentation"'
129
+ return {
130
+ error: 'Authentication required',
131
+ message: 'Please provide valid credentials to access Swagger documentation'
132
+ }
133
+ }
134
+
135
+ // Decode Basic Auth credentials
136
+ const base64Credentials = authHeader.substring(6)
137
+ const credentials = Buffer.from(base64Credentials, 'base64').toString('utf-8')
138
+ const [username, password] = credentials.split(':')
139
+
140
+ // Validate credentials
141
+ if (username !== DEFAULTS.authUsername || password !== DEFAULTS.authPassword) {
142
+ set.status = 401
143
+ set.headers['WWW-Authenticate'] = 'Basic realm="Swagger Documentation"'
144
+ return {
145
+ error: 'Invalid credentials',
146
+ message: 'The provided username or password is incorrect'
147
+ }
148
+ }
149
+
150
+ // Credentials valid, continue to Swagger
151
+ })
152
+
153
+ context.logger.debug(`🔒 Swagger authentication enabled (username: ${DEFAULTS.authUsername})`)
154
+ }
155
+
156
+ // That's it! Elysia Swagger auto-discovers everything else
157
+ context.app.use(swagger(swaggerConfig))
158
+
159
+ context.logger.debug(`Swagger documentation enabled at ${DEFAULTS.path}`, {
160
+ title: swaggerConfig.documentation.info.title,
161
+ version: swaggerConfig.documentation.info.version,
162
+ servers: servers.length,
163
+ authEnabled: DEFAULTS.authEnabled
164
+ })
165
+ } catch (error) {
166
+ context.logger.error('Failed to setup Swagger plugin', { error })
167
+ throw error
168
+ }
169
+ },
170
+
171
+ onServerStart: async (context: PluginContext) => {
172
+ if (DEFAULTS.enabled) {
173
+ const swaggerUrl = `http://${serverConfig.server.host}:${serverConfig.server.port}${DEFAULTS.path}`
174
+ context.logger.debug(`📋 Swagger documentation available at: ${swaggerUrl}`)
175
+ }
176
+ }
177
+ }
178
+
179
+ // ==========================================
180
+ // ⚙️ SWAGGER CONFIGURATION
181
+ // ==========================================
182
+ //
183
+ // All Swagger options are configurable via:
184
+ // 📁 config/plugins.config.ts (user editable)
185
+ // 🌍 Environment variables (.env file)
186
+ //
187
+ // Available configurations:
188
+ //
189
+ // 1️⃣ Basic Settings:
190
+ // - SWAGGER_ENABLED (default: true)
191
+ // - SWAGGER_TITLE (default: 'FluxStack API')
192
+ // - SWAGGER_VERSION (default: app version)
193
+ // - SWAGGER_DESCRIPTION (default: 'API documentation...')
194
+ // - SWAGGER_PATH (default: '/swagger')
195
+ //
196
+ // 2️⃣ Advanced Options:
197
+ // - SWAGGER_EXCLUDE_PATHS (array, default: [])
198
+ // - SWAGGER_SERVERS (format: "url1|desc1,url2|desc2")
199
+ // Example: "https://api.prod.com|Production,https://staging.com|Staging"
200
+ //
201
+ // 3️⃣ Swagger UI Options:
202
+ // - SWAGGER_PERSIST_AUTH (default: true)
203
+ // - SWAGGER_DISPLAY_DURATION (default: true)
204
+ // - SWAGGER_ENABLE_FILTER (default: true)
205
+ // - SWAGGER_SHOW_EXTENSIONS (default: true)
206
+ // - SWAGGER_TRY_IT_OUT (default: true)
207
+ //
208
+ // 4️⃣ Authentication (Basic Auth):
209
+ // - SWAGGER_AUTH_ENABLED (default: false)
210
+ // - SWAGGER_AUTH_USERNAME (default: 'admin')
211
+ // - SWAGGER_AUTH_PASSWORD (required if auth enabled)
212
+ //
213
+ // Example .env configuration:
214
+ // ```
215
+ // SWAGGER_ENABLED=true
216
+ // SWAGGER_TITLE=My API
217
+ // SWAGGER_PATH=/api-docs
218
+ // SWAGGER_SERVERS=https://api.myapp.com|Production,https://staging.myapp.com|Staging
219
+ // SWAGGER_EXCLUDE_PATHS=/internal,/admin
220
+ //
221
+ // # Protect Swagger with Basic Auth
222
+ // SWAGGER_AUTH_ENABLED=true
223
+ // SWAGGER_AUTH_USERNAME=admin
224
+ // SWAGGER_AUTH_PASSWORD=super-secret-password
225
+ // ```
226
+ //
227
+ // 🔒 When authentication is enabled:
228
+ // - Browser will prompt for username/password
229
+ // - All Swagger routes are protected (UI + JSON spec)
230
+ // - Credentials are validated using Basic Auth
231
+ // - Perfect for staging/production environments
232
+ //
233
+ // ==========================================
234
+ // 🏷️ AUTOMATIC TAG DISCOVERY
235
+ // ==========================================
236
+ //
237
+ // ✨ 100% AUTOMATIC - Just add tags to your routes!
238
+ //
239
+ // Example 1 - Simple route:
240
+ // app.get('/products', handler, {
241
+ // detail: {
242
+ // summary: 'Get all products',
243
+ // tags: ['Products', 'Catalog'] // ✅ Auto-discovered!
244
+ // }
245
+ // })
246
+ //
247
+ // Example 2 - Grouped routes:
248
+ // export const ordersRoutes = new Elysia({ prefix: '/orders', tags: ['Orders'] })
249
+ // .get('/', handler, {
250
+ // detail: {
251
+ // summary: 'List orders',
252
+ // tags: ['Orders', 'Management'] // ✅ Auto-discovered!
253
+ // }
254
+ // })
255
+ //
256
+ // Elysia Swagger automatically:
257
+ // - Discovers all tags from routes
258
+ // - Organizes endpoints by tag
259
+ // - Generates OpenAPI spec
260
+ // - Creates interactive UI
261
+ //
262
+ // ==========================================
263
+ // 🔐 SECURITY CONFIGURATION
264
+ // ==========================================
265
+ //
266
+ // To enable security in your FluxStack app, configure like this:
267
+ //
268
+ // plugins: {
269
+ // config: {
270
+ // swagger: {
271
+ // securitySchemes: {
272
+ // bearerAuth: {
273
+ // type: 'http',
274
+ // scheme: 'bearer',
275
+ // bearerFormat: 'JWT'
276
+ // },
277
+ // apiKeyAuth: {
278
+ // type: 'apiKey',
279
+ // in: 'header',
280
+ // name: 'X-API-Key'
281
+ // }
282
+ // },
283
+ // globalSecurity: [
284
+ // { bearerAuth: [] } // Apply JWT auth globally
285
+ // ]
286
+ // }
287
+ // }
288
+ // }
289
+ //
290
+ // Then in your routes, you can override per endpoint:
291
+ // app.get('/public', handler, {
292
+ // detail: { security: [] } // No auth required
293
+ // })
294
+ //
295
+ // app.get('/private', handler, {
296
+ // detail: {
297
+ // security: [{ apiKeyAuth: [] }] // API key required
298
+ // }
299
+ // })
300
+
301
+ export default swaggerPlugin