create-fluxstack 1.0.0 → 1.0.2

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 (101) hide show
  1. package/create-fluxstack.ts +32 -17
  2. package/package-template.json +51 -0
  3. package/package.json +2 -1
  4. package/.env +0 -30
  5. package/LICENSE +0 -21
  6. package/app/client/README.md +0 -69
  7. package/app/client/frontend-only.ts +0 -12
  8. package/app/client/index.html +0 -13
  9. package/app/client/public/vite.svg +0 -1
  10. package/app/client/src/App.css +0 -883
  11. package/app/client/src/App.tsx +0 -669
  12. package/app/client/src/assets/react.svg +0 -1
  13. package/app/client/src/components/TestPage.tsx +0 -453
  14. package/app/client/src/index.css +0 -51
  15. package/app/client/src/lib/eden-api.ts +0 -110
  16. package/app/client/src/main.tsx +0 -10
  17. package/app/client/src/vite-env.d.ts +0 -1
  18. package/app/client/tsconfig.app.json +0 -43
  19. package/app/client/tsconfig.json +0 -7
  20. package/app/client/tsconfig.node.json +0 -25
  21. package/app/server/app.ts +0 -10
  22. package/app/server/backend-only.ts +0 -15
  23. package/app/server/controllers/users.controller.ts +0 -69
  24. package/app/server/index.ts +0 -104
  25. package/app/server/routes/index.ts +0 -25
  26. package/app/server/routes/users.routes.ts +0 -121
  27. package/app/server/types/index.ts +0 -1
  28. package/app/shared/types/index.ts +0 -18
  29. package/bun.lock +0 -1053
  30. package/core/__tests__/integration.test.ts +0 -227
  31. package/core/build/index.ts +0 -186
  32. package/core/cli/command-registry.ts +0 -334
  33. package/core/cli/index.ts +0 -394
  34. package/core/cli/plugin-discovery.ts +0 -200
  35. package/core/client/standalone.ts +0 -57
  36. package/core/config/__tests__/config-loader.test.ts +0 -591
  37. package/core/config/__tests__/config-merger.test.ts +0 -657
  38. package/core/config/__tests__/env-converter.test.ts +0 -372
  39. package/core/config/__tests__/env-processor.test.ts +0 -431
  40. package/core/config/__tests__/env.test.ts +0 -452
  41. package/core/config/__tests__/integration.test.ts +0 -418
  42. package/core/config/__tests__/loader.test.ts +0 -331
  43. package/core/config/__tests__/schema.test.ts +0 -129
  44. package/core/config/__tests__/validator.test.ts +0 -318
  45. package/core/config/env-dynamic.ts +0 -326
  46. package/core/config/env.ts +0 -597
  47. package/core/config/index.ts +0 -317
  48. package/core/config/loader.ts +0 -546
  49. package/core/config/runtime-config.ts +0 -322
  50. package/core/config/schema.ts +0 -694
  51. package/core/config/validator.ts +0 -540
  52. package/core/framework/__tests__/server.test.ts +0 -233
  53. package/core/framework/client.ts +0 -132
  54. package/core/framework/index.ts +0 -8
  55. package/core/framework/server.ts +0 -501
  56. package/core/framework/types.ts +0 -63
  57. package/core/plugins/__tests__/built-in.test.ts.disabled +0 -366
  58. package/core/plugins/__tests__/manager.test.ts +0 -398
  59. package/core/plugins/__tests__/monitoring.test.ts +0 -401
  60. package/core/plugins/__tests__/registry.test.ts +0 -335
  61. package/core/plugins/built-in/index.ts +0 -142
  62. package/core/plugins/built-in/logger/index.ts +0 -180
  63. package/core/plugins/built-in/monitoring/README.md +0 -193
  64. package/core/plugins/built-in/monitoring/index.ts +0 -912
  65. package/core/plugins/built-in/static/index.ts +0 -289
  66. package/core/plugins/built-in/swagger/index.ts +0 -229
  67. package/core/plugins/built-in/vite/index.ts +0 -316
  68. package/core/plugins/config.ts +0 -348
  69. package/core/plugins/discovery.ts +0 -350
  70. package/core/plugins/executor.ts +0 -351
  71. package/core/plugins/index.ts +0 -195
  72. package/core/plugins/manager.ts +0 -583
  73. package/core/plugins/registry.ts +0 -424
  74. package/core/plugins/types.ts +0 -254
  75. package/core/server/framework.ts +0 -123
  76. package/core/server/index.ts +0 -8
  77. package/core/server/plugins/database.ts +0 -182
  78. package/core/server/plugins/logger.ts +0 -47
  79. package/core/server/plugins/swagger.ts +0 -34
  80. package/core/server/standalone.ts +0 -91
  81. package/core/templates/create-project.ts +0 -455
  82. package/core/types/api.ts +0 -169
  83. package/core/types/build.ts +0 -174
  84. package/core/types/config.ts +0 -68
  85. package/core/types/index.ts +0 -127
  86. package/core/types/plugin.ts +0 -94
  87. package/core/utils/__tests__/errors.test.ts +0 -139
  88. package/core/utils/__tests__/helpers.test.ts +0 -297
  89. package/core/utils/__tests__/logger.test.ts +0 -141
  90. package/core/utils/env-runtime-v2.ts +0 -232
  91. package/core/utils/env-runtime.ts +0 -252
  92. package/core/utils/errors/codes.ts +0 -115
  93. package/core/utils/errors/handlers.ts +0 -63
  94. package/core/utils/errors/index.ts +0 -81
  95. package/core/utils/helpers.ts +0 -180
  96. package/core/utils/index.ts +0 -18
  97. package/core/utils/logger/index.ts +0 -161
  98. package/core/utils/logger.ts +0 -106
  99. package/core/utils/monitoring/index.ts +0 -212
  100. package/tsconfig.json +0 -51
  101. package/vite.config.ts +0 -42
@@ -1,193 +0,0 @@
1
- # FluxStack Monitoring Plugin
2
-
3
- The monitoring plugin provides comprehensive performance monitoring, metrics collection, and system monitoring for FluxStack applications.
4
-
5
- ## Features
6
-
7
- - **HTTP Metrics**: Request/response timing, status codes, request/response sizes
8
- - **System Metrics**: Memory usage, CPU usage, event loop lag, load average
9
- - **Custom Metrics**: Counters, gauges, and histograms
10
- - **Multiple Exporters**: Console, Prometheus, JSON, and file exporters
11
- - **Alert System**: Configurable thresholds and alerts
12
- - **Metrics Endpoint**: Built-in `/metrics` endpoint for Prometheus scraping
13
-
14
- ## Configuration
15
-
16
- ```typescript
17
- // fluxstack.config.ts
18
- export default {
19
- plugins: {
20
- config: {
21
- monitoring: {
22
- enabled: true,
23
- httpMetrics: true,
24
- systemMetrics: true,
25
- customMetrics: true,
26
- collectInterval: 5000, // 5 seconds
27
- retentionPeriod: 300000, // 5 minutes
28
-
29
- exporters: [
30
- {
31
- type: "prometheus",
32
- endpoint: "/metrics",
33
- enabled: true,
34
- format: "text"
35
- },
36
- {
37
- type: "console",
38
- interval: 30000,
39
- enabled: false
40
- },
41
- {
42
- type: "file",
43
- filePath: "./logs/metrics.json",
44
- interval: 60000,
45
- enabled: true,
46
- format: "json"
47
- }
48
- ],
49
-
50
- thresholds: {
51
- responseTime: 1000, // ms
52
- errorRate: 0.05, // 5%
53
- memoryUsage: 0.8, // 80%
54
- cpuUsage: 0.8 // 80%
55
- },
56
-
57
- alerts: [
58
- {
59
- metric: "http_request_duration_ms",
60
- operator: ">",
61
- value: 2000,
62
- severity: "warning",
63
- message: "High response time detected"
64
- },
65
- {
66
- metric: "process_memory_rss_bytes",
67
- operator: ">",
68
- value: 1000000000, // 1GB
69
- severity: "error",
70
- message: "High memory usage"
71
- }
72
- ]
73
- }
74
- }
75
- }
76
- }
77
- ```
78
-
79
- ## Metrics Collected
80
-
81
- ### HTTP Metrics
82
- - `http_requests_total` - Total number of HTTP requests
83
- - `http_responses_total` - Total number of HTTP responses
84
- - `http_errors_total` - Total number of HTTP errors
85
- - `http_request_duration_seconds` - HTTP request duration histogram
86
- - `http_request_size_bytes` - HTTP request size histogram
87
- - `http_response_size_bytes` - HTTP response size histogram
88
-
89
- ### System Metrics
90
- - `process_memory_rss_bytes` - Process resident set size
91
- - `process_memory_heap_used_bytes` - Process heap used
92
- - `process_memory_heap_total_bytes` - Process heap total
93
- - `process_memory_external_bytes` - Process external memory
94
- - `process_cpu_user_seconds_total` - Process CPU user time
95
- - `process_cpu_system_seconds_total` - Process CPU system time
96
- - `process_uptime_seconds` - Process uptime
97
- - `nodejs_eventloop_lag_seconds` - Node.js event loop lag
98
- - `system_memory_total_bytes` - System total memory
99
- - `system_memory_free_bytes` - System free memory
100
- - `system_load_average_1m` - System load average (1 minute)
101
-
102
- ## Exporters
103
-
104
- ### Prometheus Exporter
105
- Exports metrics in Prometheus format. Can be configured to:
106
- - Serve metrics at `/metrics` endpoint (default)
107
- - Push metrics to Prometheus pushgateway
108
-
109
- ### Console Exporter
110
- Logs metrics to console at specified intervals.
111
-
112
- ### JSON Exporter
113
- Exports metrics in JSON format to:
114
- - HTTP endpoint (POST request)
115
- - Console logs
116
-
117
- ### File Exporter
118
- Writes metrics to file in JSON or Prometheus format.
119
-
120
- ## Usage
121
-
122
- The monitoring plugin is automatically loaded and configured through the FluxStack plugin system. Once enabled, it will:
123
-
124
- 1. Start collecting system metrics at the configured interval
125
- 2. Record HTTP request/response metrics automatically
126
- 3. Export metrics according to the configured exporters
127
- 4. Monitor alert thresholds and log warnings/errors
128
-
129
- ## Accessing Metrics
130
-
131
- ### Prometheus Endpoint
132
- Visit `http://localhost:3000/metrics` (or your configured endpoint) to see Prometheus-formatted metrics.
133
-
134
- ### Programmatic Access
135
- ```typescript
136
- import { MetricsCollector } from 'fluxstack/core/utils/monitoring'
137
-
138
- const collector = new MetricsCollector()
139
-
140
- // Create custom metrics
141
- const myCounter = collector.createCounter('my_custom_counter', 'My custom counter')
142
- myCounter.inc(1)
143
-
144
- const myGauge = collector.createGauge('my_custom_gauge', 'My custom gauge')
145
- myGauge.set(42)
146
-
147
- const myHistogram = collector.createHistogram('my_custom_histogram', 'My custom histogram')
148
- myHistogram.observe(1.5)
149
-
150
- // Get system metrics
151
- const systemMetrics = collector.getSystemMetrics()
152
- console.log('Memory usage:', systemMetrics.memoryUsage)
153
-
154
- // Export metrics
155
- const prometheusData = collector.exportPrometheus()
156
- console.log(prometheusData)
157
- ```
158
-
159
- ## Alert Configuration
160
-
161
- Alerts can be configured to monitor specific metrics and trigger notifications when thresholds are exceeded:
162
-
163
- ```typescript
164
- alerts: [
165
- {
166
- metric: "http_request_duration_ms",
167
- operator: ">",
168
- value: 2000,
169
- severity: "warning",
170
- message: "High response time detected"
171
- },
172
- {
173
- metric: "process_memory_rss_bytes",
174
- operator: ">",
175
- value: 1000000000, // 1GB
176
- severity: "error",
177
- message: "High memory usage"
178
- }
179
- ]
180
- ```
181
-
182
- Supported operators: `>`, `<`, `>=`, `<=`, `==`, `!=`
183
- Supported severities: `info`, `warning`, `error`, `critical`
184
-
185
- ## Requirements Satisfied
186
-
187
- This monitoring plugin satisfies the following requirements:
188
-
189
- - **7.1**: Collects basic metrics (response time, memory usage, etc.)
190
- - **7.2**: Provides detailed performance logging with timing
191
- - **7.3**: Identifies performance problems through thresholds and alerts
192
- - **7.4**: Includes basic metrics dashboard via `/metrics` endpoint
193
- - **7.5**: Supports integration with external monitoring systems (Prometheus, etc.)