qhttpx 2.1.0 → 2.3.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 (267) hide show
  1. package/LICENSE +201 -21
  2. package/README.md +117 -221
  3. package/dist/chunk-QW72SEAS.mjs +98 -0
  4. package/dist/{src/cli/index.d.ts → cli.d.mts} +0 -1
  5. package/dist/cli.d.ts +1 -0
  6. package/dist/cli.js +287 -0
  7. package/dist/cli.mjs +209 -0
  8. package/dist/index.d.mts +433 -0
  9. package/dist/index.d.ts +433 -0
  10. package/dist/index.js +1955 -0
  11. package/dist/index.mjs +1863 -0
  12. package/dist/qhttpx-core-new.linux-x64-gnu.node +0 -0
  13. package/dist/qhttpx-core-new.node +0 -0
  14. package/dist/qhttpx-core-new.win32-x64-msvc.node +0 -0
  15. package/examples/benchmark.ts +67 -0
  16. package/examples/body_demo.ts +32 -0
  17. package/examples/chat_client.ts +36 -0
  18. package/examples/chat_demo.ts +41 -0
  19. package/examples/cluster_demo.ts +26 -0
  20. package/examples/cors_demo.ts +25 -0
  21. package/examples/db_auth_demo.ts +66 -0
  22. package/examples/demo.ts +52 -0
  23. package/examples/headers_demo.ts +24 -0
  24. package/examples/hello.ts +7 -0
  25. package/examples/http2_demo.ts +52 -0
  26. package/examples/magic-dev.ts +15 -0
  27. package/examples/middleware_demo.ts +34 -0
  28. package/examples/mongo_demo.ts +40 -0
  29. package/examples/native_policy_demo.ts +33 -0
  30. package/examples/observability_demo.ts +24 -0
  31. package/examples/public/1mb.dat +1 -0
  32. package/examples/query_demo.ts +29 -0
  33. package/examples/response_demo.ts +21 -0
  34. package/examples/routing_demo.ts +24 -0
  35. package/examples/server.ts +51 -0
  36. package/examples/static_demo.ts +29 -0
  37. package/examples/test_middleware_client.ts +33 -0
  38. package/examples/test_query_client.ts +34 -0
  39. package/examples/test_response_client.ts +30 -0
  40. package/examples/tls_demo.ts +32 -0
  41. package/examples/upload_demo.ts +43 -0
  42. package/examples/uploads/test.txt +1 -0
  43. package/examples/verify_upload.ts +69 -0
  44. package/examples/ws_client.ts +26 -0
  45. package/examples/ws_demo.ts +21 -0
  46. package/package.json +65 -81
  47. package/CHANGELOG.md +0 -285
  48. package/dist/examples/api-server.d.ts +0 -1
  49. package/dist/examples/api-server.js +0 -80
  50. package/dist/examples/basic.d.ts +0 -1
  51. package/dist/examples/basic.js +0 -9
  52. package/dist/examples/compression.d.ts +0 -1
  53. package/dist/examples/compression.js +0 -15
  54. package/dist/examples/cors.d.ts +0 -1
  55. package/dist/examples/cors.js +0 -18
  56. package/dist/examples/errors.d.ts +0 -1
  57. package/dist/examples/errors.js +0 -26
  58. package/dist/examples/file-upload.d.ts +0 -1
  59. package/dist/examples/file-upload.js +0 -22
  60. package/dist/examples/fusion.d.ts +0 -1
  61. package/dist/examples/fusion.js +0 -21
  62. package/dist/examples/rate-limiting.d.ts +0 -1
  63. package/dist/examples/rate-limiting.js +0 -17
  64. package/dist/examples/validation.d.ts +0 -1
  65. package/dist/examples/validation.js +0 -22
  66. package/dist/examples/websockets.d.ts +0 -1
  67. package/dist/examples/websockets.js +0 -19
  68. package/dist/package.json +0 -107
  69. package/dist/src/benchmarks/quantam-users.d.ts +0 -1
  70. package/dist/src/benchmarks/quantam-users.js +0 -56
  71. package/dist/src/benchmarks/quick-bench.d.ts +0 -1
  72. package/dist/src/benchmarks/quick-bench.js +0 -57
  73. package/dist/src/benchmarks/simple-json.d.ts +0 -1
  74. package/dist/src/benchmarks/simple-json.js +0 -171
  75. package/dist/src/benchmarks/ultra-mode.d.ts +0 -1
  76. package/dist/src/benchmarks/ultra-mode.js +0 -64
  77. package/dist/src/cli/index.js +0 -222
  78. package/dist/src/client/index.d.ts +0 -17
  79. package/dist/src/client/index.js +0 -72
  80. package/dist/src/core/batch.d.ts +0 -24
  81. package/dist/src/core/batch.js +0 -97
  82. package/dist/src/core/body-parser.d.ts +0 -15
  83. package/dist/src/core/body-parser.js +0 -121
  84. package/dist/src/core/buffer-pool.d.ts +0 -41
  85. package/dist/src/core/buffer-pool.js +0 -70
  86. package/dist/src/core/config.d.ts +0 -7
  87. package/dist/src/core/config.js +0 -50
  88. package/dist/src/core/context-pool.d.ts +0 -12
  89. package/dist/src/core/context-pool.js +0 -34
  90. package/dist/src/core/errors.d.ts +0 -34
  91. package/dist/src/core/errors.js +0 -70
  92. package/dist/src/core/fusion.d.ts +0 -20
  93. package/dist/src/core/fusion.js +0 -191
  94. package/dist/src/core/logger.d.ts +0 -22
  95. package/dist/src/core/logger.js +0 -49
  96. package/dist/src/core/metrics.d.ts +0 -50
  97. package/dist/src/core/metrics.js +0 -123
  98. package/dist/src/core/resources.d.ts +0 -9
  99. package/dist/src/core/resources.js +0 -25
  100. package/dist/src/core/scheduler.d.ts +0 -38
  101. package/dist/src/core/scheduler.js +0 -126
  102. package/dist/src/core/scope.d.ts +0 -41
  103. package/dist/src/core/scope.js +0 -107
  104. package/dist/src/core/serializer.d.ts +0 -10
  105. package/dist/src/core/serializer.js +0 -82
  106. package/dist/src/core/server.d.ts +0 -179
  107. package/dist/src/core/server.js +0 -1511
  108. package/dist/src/core/stream.d.ts +0 -15
  109. package/dist/src/core/stream.js +0 -71
  110. package/dist/src/core/tasks.d.ts +0 -29
  111. package/dist/src/core/tasks.js +0 -87
  112. package/dist/src/core/timer.d.ts +0 -11
  113. package/dist/src/core/timer.js +0 -29
  114. package/dist/src/core/types.d.ts +0 -225
  115. package/dist/src/core/types.js +0 -19
  116. package/dist/src/core/websocket.d.ts +0 -25
  117. package/dist/src/core/websocket.js +0 -86
  118. package/dist/src/core/worker-queue.d.ts +0 -41
  119. package/dist/src/core/worker-queue.js +0 -73
  120. package/dist/src/database/adapters/memory.d.ts +0 -21
  121. package/dist/src/database/adapters/memory.js +0 -90
  122. package/dist/src/database/adapters/mongo.d.ts +0 -11
  123. package/dist/src/database/adapters/mongo.js +0 -141
  124. package/dist/src/database/adapters/postgres.d.ts +0 -10
  125. package/dist/src/database/adapters/postgres.js +0 -111
  126. package/dist/src/database/adapters/sqlite.d.ts +0 -10
  127. package/dist/src/database/adapters/sqlite.js +0 -42
  128. package/dist/src/database/coalescer.d.ts +0 -14
  129. package/dist/src/database/coalescer.js +0 -134
  130. package/dist/src/database/manager.d.ts +0 -35
  131. package/dist/src/database/manager.js +0 -87
  132. package/dist/src/database/types.d.ts +0 -20
  133. package/dist/src/database/types.js +0 -2
  134. package/dist/src/index.d.ts +0 -52
  135. package/dist/src/index.js +0 -92
  136. package/dist/src/middleware/compression.d.ts +0 -2
  137. package/dist/src/middleware/compression.js +0 -133
  138. package/dist/src/middleware/cors.d.ts +0 -2
  139. package/dist/src/middleware/cors.js +0 -66
  140. package/dist/src/middleware/presets.d.ts +0 -15
  141. package/dist/src/middleware/presets.js +0 -52
  142. package/dist/src/middleware/rate-limit.d.ts +0 -14
  143. package/dist/src/middleware/rate-limit.js +0 -83
  144. package/dist/src/middleware/security.d.ts +0 -10
  145. package/dist/src/middleware/security.js +0 -74
  146. package/dist/src/middleware/static.d.ts +0 -11
  147. package/dist/src/middleware/static.js +0 -191
  148. package/dist/src/openapi/generator.d.ts +0 -19
  149. package/dist/src/openapi/generator.js +0 -149
  150. package/dist/src/router/radix-router.d.ts +0 -18
  151. package/dist/src/router/radix-router.js +0 -89
  152. package/dist/src/router/radix-tree.d.ts +0 -21
  153. package/dist/src/router/radix-tree.js +0 -175
  154. package/dist/src/router/router.d.ts +0 -37
  155. package/dist/src/router/router.js +0 -203
  156. package/dist/src/testing/index.d.ts +0 -25
  157. package/dist/src/testing/index.js +0 -84
  158. package/dist/src/utils/cookies.d.ts +0 -3
  159. package/dist/src/utils/cookies.js +0 -59
  160. package/dist/src/utils/logger.d.ts +0 -2
  161. package/dist/src/utils/logger.js +0 -45
  162. package/dist/src/utils/signals.d.ts +0 -6
  163. package/dist/src/utils/signals.js +0 -31
  164. package/dist/src/utils/sse.d.ts +0 -6
  165. package/dist/src/utils/sse.js +0 -32
  166. package/dist/src/validation/index.d.ts +0 -3
  167. package/dist/src/validation/index.js +0 -19
  168. package/dist/src/validation/simple.d.ts +0 -5
  169. package/dist/src/validation/simple.js +0 -102
  170. package/dist/src/validation/types.d.ts +0 -32
  171. package/dist/src/validation/types.js +0 -12
  172. package/dist/src/validation/zod.d.ts +0 -4
  173. package/dist/src/validation/zod.js +0 -18
  174. package/dist/src/views/index.d.ts +0 -1
  175. package/dist/src/views/index.js +0 -17
  176. package/dist/src/views/types.d.ts +0 -3
  177. package/dist/src/views/types.js +0 -2
  178. package/dist/tests/adapters.test.d.ts +0 -1
  179. package/dist/tests/adapters.test.js +0 -106
  180. package/dist/tests/batch.test.d.ts +0 -1
  181. package/dist/tests/batch.test.js +0 -117
  182. package/dist/tests/body-parser.test.d.ts +0 -1
  183. package/dist/tests/body-parser.test.js +0 -52
  184. package/dist/tests/compression-sse.test.d.ts +0 -1
  185. package/dist/tests/compression-sse.test.js +0 -87
  186. package/dist/tests/cookies.test.d.ts +0 -1
  187. package/dist/tests/cookies.test.js +0 -63
  188. package/dist/tests/cors.test.d.ts +0 -1
  189. package/dist/tests/cors.test.js +0 -55
  190. package/dist/tests/database.test.d.ts +0 -1
  191. package/dist/tests/database.test.js +0 -80
  192. package/dist/tests/dx.test.d.ts +0 -1
  193. package/dist/tests/dx.test.js +0 -114
  194. package/dist/tests/ecosystem.test.d.ts +0 -1
  195. package/dist/tests/ecosystem.test.js +0 -133
  196. package/dist/tests/features.test.d.ts +0 -1
  197. package/dist/tests/features.test.js +0 -47
  198. package/dist/tests/fusion.test.d.ts +0 -1
  199. package/dist/tests/fusion.test.js +0 -92
  200. package/dist/tests/http-basic.test.d.ts +0 -1
  201. package/dist/tests/http-basic.test.js +0 -124
  202. package/dist/tests/logger.test.d.ts +0 -1
  203. package/dist/tests/logger.test.js +0 -33
  204. package/dist/tests/middleware.test.d.ts +0 -1
  205. package/dist/tests/middleware.test.js +0 -109
  206. package/dist/tests/observability.test.d.ts +0 -1
  207. package/dist/tests/observability.test.js +0 -59
  208. package/dist/tests/openapi.test.d.ts +0 -1
  209. package/dist/tests/openapi.test.js +0 -64
  210. package/dist/tests/plugin.test.d.ts +0 -1
  211. package/dist/tests/plugin.test.js +0 -65
  212. package/dist/tests/plugins.test.d.ts +0 -1
  213. package/dist/tests/plugins.test.js +0 -71
  214. package/dist/tests/rate-limit.test.d.ts +0 -1
  215. package/dist/tests/rate-limit.test.js +0 -77
  216. package/dist/tests/resources.test.d.ts +0 -1
  217. package/dist/tests/resources.test.js +0 -47
  218. package/dist/tests/scheduler.test.d.ts +0 -1
  219. package/dist/tests/scheduler.test.js +0 -46
  220. package/dist/tests/schema-routes.test.d.ts +0 -1
  221. package/dist/tests/schema-routes.test.js +0 -79
  222. package/dist/tests/security.test.d.ts +0 -1
  223. package/dist/tests/security.test.js +0 -83
  224. package/dist/tests/server-db.test.d.ts +0 -1
  225. package/dist/tests/server-db.test.js +0 -72
  226. package/dist/tests/smoke.test.d.ts +0 -1
  227. package/dist/tests/smoke.test.js +0 -10
  228. package/dist/tests/sqlite-fusion.test.d.ts +0 -1
  229. package/dist/tests/sqlite-fusion.test.js +0 -92
  230. package/dist/tests/static.test.d.ts +0 -1
  231. package/dist/tests/static.test.js +0 -102
  232. package/dist/tests/stream.test.d.ts +0 -1
  233. package/dist/tests/stream.test.js +0 -44
  234. package/dist/tests/task-metrics.test.d.ts +0 -1
  235. package/dist/tests/task-metrics.test.js +0 -53
  236. package/dist/tests/tasks.test.d.ts +0 -1
  237. package/dist/tests/tasks.test.js +0 -62
  238. package/dist/tests/testing.test.d.ts +0 -1
  239. package/dist/tests/testing.test.js +0 -47
  240. package/dist/tests/validation.test.d.ts +0 -1
  241. package/dist/tests/validation.test.js +0 -107
  242. package/dist/tests/websocket.test.d.ts +0 -1
  243. package/dist/tests/websocket.test.js +0 -146
  244. package/dist/vitest.config.d.ts +0 -2
  245. package/dist/vitest.config.js +0 -9
  246. package/docs/AEGIS.md +0 -91
  247. package/docs/API_REFERENCE.md +0 -749
  248. package/docs/BENCHMARKS.md +0 -39
  249. package/docs/CAPABILITIES.md +0 -70
  250. package/docs/CLI.md +0 -43
  251. package/docs/DATABASE.md +0 -142
  252. package/docs/ECOSYSTEM.md +0 -146
  253. package/docs/ERRORS.md +0 -112
  254. package/docs/FUSION.md +0 -87
  255. package/docs/MIDDLEWARE.md +0 -65
  256. package/docs/MIGRATION_1.9_TO_2.0.md +0 -495
  257. package/docs/NEXT_STEPS.md +0 -99
  258. package/docs/OPENAPI.md +0 -99
  259. package/docs/PLUGINS.md +0 -59
  260. package/docs/PRODUCTION_DEPLOYMENT.md +0 -798
  261. package/docs/REAL_WORLD_EXAMPLES.md +0 -109
  262. package/docs/ROADMAP.md +0 -366
  263. package/docs/ROUTING.md +0 -78
  264. package/docs/SECURITY.md +0 -876
  265. package/docs/STATIC.md +0 -61
  266. package/docs/VALIDATION.md +0 -114
  267. package/docs/WEBSOCKETS.md +0 -76
package/LICENSE CHANGED
@@ -1,21 +1,201 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Quantam Open Source
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md CHANGED
@@ -1,141 +1,62 @@
1
1
  <div align="center">
2
- <img src="https://raw.githubusercontent.com/Quantam-Open-Source/qhttpx/main/assets/logo.svg" alt="QHTTPX Logo" width="200" height="200" />
2
+ <img src="assets/qhttpx.svg" alt="QHTTPX Logo" width="180" height="auto" />
3
+ <h1>QHTTPX</h1>
4
+ <p>
5
+ <b>The AI-Native High-Performance Web Engine</b>
6
+ </p>
3
7
  </div>
4
8
 
5
- <div align="center">
6
- <strong>The Ultra-Fast HTTP Framework for Node.js</strong>
7
- </div>
8
-
9
- <br />
10
-
11
- <div align="center">
12
-
13
- [![npm version](https://img.shields.io/npm/v/qhttpx.svg?style=flat-square)](https://www.npmjs.com/package/qhttpx)
14
- [![Downloads](https://img.shields.io/npm/dm/qhttpx.svg?style=flat-square)](https://www.npmjs.com/package/qhttpx)
15
- [![License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://github.com/Quantam-Open-Source/qhttpx/blob/main/LICENSE)
16
- [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
17
- [![TypeScript](https://img.shields.io/badge/Written%20in-TypeScript-blue?style=flat-square)](https://www.typescriptlang.org)
18
- [![Production Ready](https://img.shields.io/badge/Production-Ready-brightgreen.svg?style=flat-square)](#)
19
-
20
- </div>
9
+ [![Website](https://img.shields.io/badge/website-qhttpx.gridrr.com-blue?style=flat&logo=google-chrome&logoColor=white)](https://qhttpx.gridrr.com)
10
+ [![npm version](https://img.shields.io/npm/v/qhttpx.svg?style=flat)](https://www.npmjs.com/package/qhttpx)
11
+ [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
12
+ [![Downloads](https://img.shields.io/npm/dm/qhttpx.svg)](https://www.npmjs.com/package/qhttpx)
13
+ [![GitHub stars](https://img.shields.io/github/stars/Quantam-Open-Source/QHTTPX.svg?style=social)](https://github.com/Quantam-Open-Source/QHTTPX)
21
14
 
22
- <br />
23
-
24
- **QHttpX** is a high-performance HTTP framework for Node.js. Minimal API. Maximum performance. Built-in features like Request Fusion, WebSockets, and rate limiting.
25
-
26
- ---
15
+ QHTTPX is a next-generation web framework that combines the **developer experience of Node.js** with the **raw performance of Rust**. It is designed for high-load applications, AI agents, and distributed systems where latency and throughput are critical.
27
16
 
28
17
  ## 🚀 Why QHTTPX?
29
18
 
30
- Most Node.js frameworks rely on the event loop blindly. QHTTPX introduces a **Cooperative Scheduler** and **Request Fusion Engine** to take control.
31
-
32
- ### The "Quantum" Difference
33
- | Feature | Traditional Frameworks | QHTTPX |
34
- |---------|------------------------|--------|
35
- | **Architecture** | Call Stack (Blocking risk) | **Async Scheduler** (Non-blocking) |
36
- | **Simultaneous Requests** | Handled individually (N executions) | **Request Fusion** (1 execution broadcast to N) |
37
- | **Rate Limiting** | Middleware (CPU heavy) | **Aegis Engine** (Zero-overhead Token Bucket) |
38
- | **Routing** | Regex / Linear Scan | **Radix Tree** (O(1) lookup) |
39
- | **Streaming** | Basic Pipe | **Smart Streams** (Backpressure-aware) |
40
-
41
- ### 🏆 Feature Comparison
42
-
43
- | Feature | **QHTTPX** | Fastify | Express | Hono |
44
- | :--- | :---: | :---: | :---: | :---: |
45
- | **Core Runtime** | **⚡ Pure TypeScript** | JS | JS | JS |
46
- | **Request Fusion** | **✅ Native** | ❌ | ❌ | ❌ |
47
- | **DDoS Protection** | **✅ Built-in (Aegis)** | ❌ | ❌ | ❌ |
48
- | **JSON Serialization** | **✅ Optimized Fast-Path** | Schema-based | Slow | Slow |
49
- | **Concurrency Model** | **✅ Async Scheduler** | Event Loop | Event Loop | Event Loop |
50
- | **Rate Limiting** | **✅ Zero-Overhead** | Plugin | Middleware | Middleware |
51
- | **Routing Algorithm** | **✅ Optimized Radix** | Radix Tree | Linear/Regex | RegExp/Trie |
52
- | **WebSocket** | **✅ Built-in Pub/Sub** | Plugin | Plugin | Helper |
53
- | **Multipart Uploads** | **✅ Native** | Plugin | Middleware | Plugin |
54
- | **Static Assets** | **✅ Smart Streaming** | Standard | Standard | Standard |
55
- | **Type Safety** | **✅ First-class** | Good | Partial | First-class |
56
-
57
- ### 🆚 Code Comparison
58
-
59
- See how QHTTPX simplifies common patterns compared to Express and Fastify.
60
-
61
- **The Task**: A simple API endpoint that reads a query parameter, sets a header, and returns JSON.
62
-
63
- #### Express
64
- ```javascript
65
- const express = require('express');
66
- const app = express();
67
-
68
- app.get('/hello', (req, res) => {
69
- const name = req.query.name || 'World';
70
- res.setHeader('X-Powered-By', 'Express');
71
- res.json({ message: `Hello ${name}` });
72
- });
73
-
74
- app.listen(3000);
75
- ```
76
-
77
- #### Fastify
78
- ```javascript
79
- const fastify = require('fastify')();
80
-
81
- fastify.get('/hello', async (request, reply) => {
82
- const name = request.query.name || 'World';
83
- reply.header('X-Powered-By', 'Fastify');
84
- return { message: `Hello ${name}` };
85
- });
86
-
87
- fastify.listen({ port: 3000 });
88
- ```
89
-
90
- #### QHTTPX
91
- ```typescript
92
- import { app } from 'qhttpx';
93
-
94
- app.get('/hello', ({ query, setHeader }) => {
95
- const name = query.name || 'World';
96
- setHeader('X-Powered-By', 'QHTTPX');
97
- return { message: `Hello ${name}` };
98
- });
19
+ - **Native Rust Core**: The heavy lifting (HTTP parsing, routing, JWT verification, DB drivers) happens in Rust. Node.js is just the orchestration layer.
20
+ - **Zero-Copy Architecture**: Data flows directly from the network to the database/response with minimal V8 overhead.
21
+ - **Developer Delight**: A fluent, declarative API that feels like home for Express/Fastify users.
22
+ - **Battery-Included**: Database, Auth, Rate Limiting, and Observability are built-in, not bolted on.
99
23
 
100
- app.start(3000);
101
- ```
24
+ ## 📊 Benchmarks
102
25
 
103
- ---
26
+ QHTTPX significantly outperforms traditional Node.js frameworks in high-throughput scenarios.
104
27
 
105
- ## Key Features
28
+ **Environment**: Windows, 2 vCPU, 8GB RAM
106
29
 
107
- ### 🛡️ Aegis Protection System
108
- Built-in DDoS protection and Rate Limiting that runs *before* your business logic.
109
- - **Token Bucket Algorithm**: Smooth traffic shaping.
110
- - **Dual-Layer Storage**: Memory (L1) + Redis (L2) ready.
111
- - **Smart Headers**: Automatic `Retry-After` and `X-RateLimit-*`.
30
+ ### Throughput (Requests/Sec)
112
31
 
113
- ### ⚛️ Request Fusion (Layer 2 Coalescing)
114
- The only framework that automatically collapses simultaneous duplicate requests.
115
- - **Scenario**: 1,000 users request `/api/trending` at the exact same millisecond.
116
- - **Result**: QHTTPX executes the handler **ONCE** and broadcasts the result to all 1,000 users.
117
- - **Impact**: Database load drops by 99.9%.
32
+ | Framework | Req/Sec | Multiplier |
33
+ | :--- | :--- | :--- |
34
+ | **Express** | 9,094 | 1.0x (Baseline) |
35
+ | **Koa** | 11,381 | 1.25x |
36
+ | **Fastify** | 12,265 | 1.35x |
37
+ | **QHTTPX** | **45,136** | **4.96x** |
118
38
 
119
- ### 🔌 Full-Stack Ecosystem
120
- Everything you need, built-in but modular.
121
- - **WebSockets**: Real-time channels with "Rooms" support.
122
- - **SSE**: Server-Sent Events helper `createSSE()`.
123
- - **Views**: Server-side rendering (EJS, Pug, etc.).
124
- - **Static Files**: Range requests (Video streaming), ETag caching.
125
- - **Multipart**: Native file upload handling.
39
+ ### Latency (Average)
126
40
 
127
- ---
41
+ | Framework | Latency |
42
+ | :--- | :--- |
43
+ | **Express** | 639.72 ms |
44
+ | **Koa** | 504.44 ms |
45
+ | **Fastify** | 454.32 ms |
46
+ | **QHTTPX** | **268.09 ms** |
128
47
 
129
- ## 📚 Documentation
48
+ ### Extreme Load Stability (C10K)
130
49
 
131
- New to QHttpX? Start here:
50
+ We simulated **10,000 concurrent connections** to test resilience.
132
51
 
133
- - **[API Reference](./docs/API_REFERENCE.md)** - Complete API documentation with examples
134
- - **[Security Guide](./docs/SECURITY.md)** - Production security best practices
135
- - **[Production Deployment](./docs/PRODUCTION_DEPLOYMENT.md)** - Deploy to VPS, Docker, or Kubernetes
136
- - **[Migration Guide](./docs/MIGRATION_1.9_TO_2.0.md)** - Migrate from v1.9.4 to v2.0+
52
+ | Framework | Status | Total Requests Served | Notes |
53
+ | :--- | :--- | :--- | :--- |
54
+ | **Express** | FAILED | 0 | 100% Timeout / Errors |
55
+ | **Koa** | ❌ FAILED | 0 | 100% Timeout / Errors |
56
+ | **Fastify** | ❌ FAILED | 0 | 100% Timeout / Errors |
57
+ | **QHTTPX** | **✅ PASS** | **147,930** | **Zero crashes**, 200ms latency |
137
58
 
138
- ---
59
+ > *See full benchmark details in [docs/benchmarks.md](./docs/benchmarks.md)*
139
60
 
140
61
  ## 📦 Installation
141
62
 
@@ -143,133 +64,108 @@ New to QHttpX? Start here:
143
64
  npm install qhttpx
144
65
  ```
145
66
 
146
- ---
147
-
148
67
  ## ⚡ Quick Start
149
68
 
150
- ### 1. The Modern Way (TypeScript + tsx) - Recommended
151
- Best for development and production with modern tooling.
152
-
153
- **Option A: Scaffolding (Fastest)**
154
- ```bash
155
- npm create qhttpx@latest my-app
156
- cd my-app
157
- npm install
158
- npm run dev
159
- ```
160
-
161
- **Option B: Manual Setup**
162
- ```bash
163
- npm install qhttpx tsx
164
- ```
165
-
166
- *src/index.ts*
167
69
  ```typescript
168
- import { app } from 'qhttpx';
169
-
170
- app.get('/', () => ({ msg: 'Works!' }));
70
+ import { Q } from 'qhttpx';
171
71
 
172
- // Ultra-Simple One-Liners
173
- app.security()
174
- .log()
175
- .production();
72
+ const app = Q.app();
176
73
 
177
- app.start(3000).then(({ port }) => console.log(`Server running on http://localhost:${port}`));
178
- ```
179
-
180
- Run with: `npx tsx src/index.ts`
181
-
182
- ### 2. The Classic Way (JavaScript + CommonJS)
183
- For legacy environments or simple scripts.
184
-
185
- ```bash
186
- npm install qhttpx
187
- ```
74
+ // Standard Route
75
+ app.get('/', (req, res) => {
76
+ return { hello: 'world' };
77
+ });
188
78
 
189
- *index.js*
190
- ```javascript
191
- const { app } = require('qhttpx');
79
+ // Zero-Copy Static JSON (Fastest)
80
+ app.get('/static', {
81
+ json: { status: 'ok', data: [1, 2, 3] }
82
+ });
192
83
 
193
- app.get('/', () => ({ msg: 'Works!' }));
194
- app.start(3000).then(() => console.log('Running on http://localhost:3000'));
84
+ app.listen(3000, () => {
85
+ console.log('Server running on http://localhost:3000');
86
+ });
195
87
  ```
196
88
 
197
- Run with: `node index.js`
89
+ ## 🛠 Key Features
198
90
 
199
- ### 3. The Fluent Way (Advanced Configuration)
200
- Use the chainable API to configure advanced features like Request Fusion, Metrics, and Body Limits.
91
+ ### 1. Universal Database Client
92
+ Connect to Postgres, MongoDB, SQLite, or Redis without installing extra drivers. The connection pool is managed natively in Rust.
201
93
 
202
94
  ```typescript
203
- import { app } from 'qhttpx';
204
-
205
- app.fusion(true) // Enable Request Coalescing
206
- .metrics(true) // Enable Prometheus-style metrics
207
- .bodyLimit(1024 * 1024)// Set 1MB body limit
208
- .security({ cors: true });
95
+ // Configure connection
96
+ const app = Q.app({
97
+ db: {
98
+ postgres: 'postgres://user:pass@localhost:5432/db',
99
+ redis: 'redis://localhost:6379'
100
+ }
101
+ });
209
102
 
210
- app.get('/heavy-compute', async () => {
211
- // If 1000 users hit this at once, it executes ONLY ONCE
212
- return await db.query('SELECT * FROM heavy_table');
103
+ app.get('/users', async (req) => {
104
+ // Zero-copy SQL execution
105
+ const users = await app.db.query('SELECT * FROM users WHERE active = $1', [true]);
106
+ return users;
213
107
  });
214
108
 
215
- app.start(3000);
109
+ app.get('/cache', async (req) => {
110
+ // Native Redis access
111
+ await app.db.redis.set('key', 'value');
112
+ const val = await app.db.redis.get('key');
113
+ return { val };
114
+ });
216
115
  ```
217
116
 
117
+ ### 2. Built-in Authentication
118
+ JWT verification happens in the Rust layer before the request even reaches Node.js.
218
119
 
219
- ---
220
-
221
- ## 📚 Documentation
222
-
223
- Detailed guides for every feature of QHTTPX:
224
-
225
- - **[Routing](./docs/ROUTING.md)**: Radix tree, parameters, and groups.
226
- - **[Middleware](./docs/MIDDLEWARE.md)**: Global and route-level hooks.
227
- - **[Error Handling](./docs/ERRORS.md)**: Standard exceptions and global handlers.
228
- - **[Aegis Rate Limiter](./docs/AEGIS.md)**: DDoS protection and traffic shaping.
229
- - **[Request Fusion](./docs/FUSION.md)**: "Thundering Herd" protection engine.
230
- - **[WebSockets](./docs/WEBSOCKETS.md)**: Real-time Pub/Sub and Rooms.
231
- - **[Static Files](./docs/STATIC.md)**: Streaming, Range requests, and Caching.
232
- - **[Ecosystem Integration](./docs/ECOSYSTEM.md)**: Auth, Database, and Validation patterns.
233
-
234
- ---
235
-
236
-
237
-
238
- ## 🤝 Ecosystem Compatibility
120
+ ```typescript
121
+ // Enable JWT Middleware
122
+ const app = Q.app({
123
+ auth: {
124
+ jwtSecret: 'super-secret-key'
125
+ }
126
+ });
239
127
 
240
- QHTTPX is an **Open Runtime**. It works seamlessly with standard tools:
241
- - **Databases**: Prisma, Drizzle, TypeORM, Mongoose
242
- - **Auth**: Jose (JWT), Passport (via adapter)
243
- - **Validation**: Zod, Valibot
244
- - **Logging**: Pino (Built-in)
128
+ // Protected Route
129
+ app.get('/profile', { auth: true }, (req) => {
130
+ // req.user is already populated if valid
131
+ return { user: req.user };
132
+ });
133
+ ```
245
134
 
246
- ---
135
+ ### 3. Distributed Rate Limiting
136
+ Cluster-ready rate limiting powered by Redis (or in-memory fallback).
247
137
 
248
- ## 👥 Team
138
+ ```typescript
139
+ app.get('/api', {
140
+ rateLimit: {
141
+ limit: 100,
142
+ window: 60, // 1 minute
143
+ distributed: true // Syncs across all instances via Redis
144
+ }
145
+ }, handler);
146
+ ```
249
147
 
250
- QHTTPX is developed and maintained by **Quantam Open Source**.
148
+ ### 4. Production Observability
149
+ Prometheus metrics and structured logging are enabled by default.
251
150
 
252
- ### Lead Developer
253
- **Byron Kennedy Pfukwa**
254
- *Creator & Core Maintainer*
255
- [![GitHub](https://img.shields.io/badge/GitHub-BYRON--lang-181717?style=flat&logo=github)](https://github.com/BYRON-lang)
256
- [![NPM](https://img.shields.io/badge/NPM-~brnxdev-CB3837?style=flat&logo=npm)](https://www.npmjs.com/~brnxdev)
257
- [![X](https://img.shields.io/badge/X-@byronpfukwa-000000?style=flat&logo=x)](https://x.com/byronpfukwa)
151
+ ```typescript
152
+ const app = Q.app();
153
+ app.enableLogging(); // Structured JSON logs
154
+ app.enableMetrics(); // Exposes /metrics endpoint for Prometheus
258
155
 
259
- ### Socials
260
- Follow us for updates:
261
- - **QHTTPX (X)**: [@qhttpx](https://x.com/qhttpx)
262
- - **Open Quantam (X)**: [@openquantam](https://x.com/openquantam)
156
+ // Metrics available at http://localhost:3000/metrics
157
+ ```
263
158
 
264
- ---
159
+ ## 🐳 Deployment
265
160
 
266
- ## 📜 License
161
+ Deploy easily with our optimized multi-stage Dockerfile.
267
162
 
268
- MIT © [Quantam Open Source](https://github.com/Quantam-Open-Source)
163
+ ```dockerfile
164
+ # Dockerfile is included in the root
165
+ docker build -t my-app .
166
+ docker run -p 3000:3000 my-app
167
+ ```
269
168
 
270
- <br />
169
+ ## License
271
170
 
272
- <div align="center">
273
- <p>Project Part of</p>
274
- <img src="assets/open%20quantam.png" alt="Open Quantam" width="150" />
275
- </div>
171
+ Apache-2.0