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.
- package/LICENSE +201 -21
- package/README.md +117 -221
- package/dist/chunk-QW72SEAS.mjs +98 -0
- package/dist/{src/cli/index.d.ts → cli.d.mts} +0 -1
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +287 -0
- package/dist/cli.mjs +209 -0
- package/dist/index.d.mts +433 -0
- package/dist/index.d.ts +433 -0
- package/dist/index.js +1955 -0
- package/dist/index.mjs +1863 -0
- package/dist/qhttpx-core-new.linux-x64-gnu.node +0 -0
- package/dist/qhttpx-core-new.node +0 -0
- package/dist/qhttpx-core-new.win32-x64-msvc.node +0 -0
- package/examples/benchmark.ts +67 -0
- package/examples/body_demo.ts +32 -0
- package/examples/chat_client.ts +36 -0
- package/examples/chat_demo.ts +41 -0
- package/examples/cluster_demo.ts +26 -0
- package/examples/cors_demo.ts +25 -0
- package/examples/db_auth_demo.ts +66 -0
- package/examples/demo.ts +52 -0
- package/examples/headers_demo.ts +24 -0
- package/examples/hello.ts +7 -0
- package/examples/http2_demo.ts +52 -0
- package/examples/magic-dev.ts +15 -0
- package/examples/middleware_demo.ts +34 -0
- package/examples/mongo_demo.ts +40 -0
- package/examples/native_policy_demo.ts +33 -0
- package/examples/observability_demo.ts +24 -0
- package/examples/public/1mb.dat +1 -0
- package/examples/query_demo.ts +29 -0
- package/examples/response_demo.ts +21 -0
- package/examples/routing_demo.ts +24 -0
- package/examples/server.ts +51 -0
- package/examples/static_demo.ts +29 -0
- package/examples/test_middleware_client.ts +33 -0
- package/examples/test_query_client.ts +34 -0
- package/examples/test_response_client.ts +30 -0
- package/examples/tls_demo.ts +32 -0
- package/examples/upload_demo.ts +43 -0
- package/examples/uploads/test.txt +1 -0
- package/examples/verify_upload.ts +69 -0
- package/examples/ws_client.ts +26 -0
- package/examples/ws_demo.ts +21 -0
- package/package.json +65 -81
- package/CHANGELOG.md +0 -285
- package/dist/examples/api-server.d.ts +0 -1
- package/dist/examples/api-server.js +0 -80
- package/dist/examples/basic.d.ts +0 -1
- package/dist/examples/basic.js +0 -9
- package/dist/examples/compression.d.ts +0 -1
- package/dist/examples/compression.js +0 -15
- package/dist/examples/cors.d.ts +0 -1
- package/dist/examples/cors.js +0 -18
- package/dist/examples/errors.d.ts +0 -1
- package/dist/examples/errors.js +0 -26
- package/dist/examples/file-upload.d.ts +0 -1
- package/dist/examples/file-upload.js +0 -22
- package/dist/examples/fusion.d.ts +0 -1
- package/dist/examples/fusion.js +0 -21
- package/dist/examples/rate-limiting.d.ts +0 -1
- package/dist/examples/rate-limiting.js +0 -17
- package/dist/examples/validation.d.ts +0 -1
- package/dist/examples/validation.js +0 -22
- package/dist/examples/websockets.d.ts +0 -1
- package/dist/examples/websockets.js +0 -19
- package/dist/package.json +0 -107
- package/dist/src/benchmarks/quantam-users.d.ts +0 -1
- package/dist/src/benchmarks/quantam-users.js +0 -56
- package/dist/src/benchmarks/quick-bench.d.ts +0 -1
- package/dist/src/benchmarks/quick-bench.js +0 -57
- package/dist/src/benchmarks/simple-json.d.ts +0 -1
- package/dist/src/benchmarks/simple-json.js +0 -171
- package/dist/src/benchmarks/ultra-mode.d.ts +0 -1
- package/dist/src/benchmarks/ultra-mode.js +0 -64
- package/dist/src/cli/index.js +0 -222
- package/dist/src/client/index.d.ts +0 -17
- package/dist/src/client/index.js +0 -72
- package/dist/src/core/batch.d.ts +0 -24
- package/dist/src/core/batch.js +0 -97
- package/dist/src/core/body-parser.d.ts +0 -15
- package/dist/src/core/body-parser.js +0 -121
- package/dist/src/core/buffer-pool.d.ts +0 -41
- package/dist/src/core/buffer-pool.js +0 -70
- package/dist/src/core/config.d.ts +0 -7
- package/dist/src/core/config.js +0 -50
- package/dist/src/core/context-pool.d.ts +0 -12
- package/dist/src/core/context-pool.js +0 -34
- package/dist/src/core/errors.d.ts +0 -34
- package/dist/src/core/errors.js +0 -70
- package/dist/src/core/fusion.d.ts +0 -20
- package/dist/src/core/fusion.js +0 -191
- package/dist/src/core/logger.d.ts +0 -22
- package/dist/src/core/logger.js +0 -49
- package/dist/src/core/metrics.d.ts +0 -50
- package/dist/src/core/metrics.js +0 -123
- package/dist/src/core/resources.d.ts +0 -9
- package/dist/src/core/resources.js +0 -25
- package/dist/src/core/scheduler.d.ts +0 -38
- package/dist/src/core/scheduler.js +0 -126
- package/dist/src/core/scope.d.ts +0 -41
- package/dist/src/core/scope.js +0 -107
- package/dist/src/core/serializer.d.ts +0 -10
- package/dist/src/core/serializer.js +0 -82
- package/dist/src/core/server.d.ts +0 -179
- package/dist/src/core/server.js +0 -1511
- package/dist/src/core/stream.d.ts +0 -15
- package/dist/src/core/stream.js +0 -71
- package/dist/src/core/tasks.d.ts +0 -29
- package/dist/src/core/tasks.js +0 -87
- package/dist/src/core/timer.d.ts +0 -11
- package/dist/src/core/timer.js +0 -29
- package/dist/src/core/types.d.ts +0 -225
- package/dist/src/core/types.js +0 -19
- package/dist/src/core/websocket.d.ts +0 -25
- package/dist/src/core/websocket.js +0 -86
- package/dist/src/core/worker-queue.d.ts +0 -41
- package/dist/src/core/worker-queue.js +0 -73
- package/dist/src/database/adapters/memory.d.ts +0 -21
- package/dist/src/database/adapters/memory.js +0 -90
- package/dist/src/database/adapters/mongo.d.ts +0 -11
- package/dist/src/database/adapters/mongo.js +0 -141
- package/dist/src/database/adapters/postgres.d.ts +0 -10
- package/dist/src/database/adapters/postgres.js +0 -111
- package/dist/src/database/adapters/sqlite.d.ts +0 -10
- package/dist/src/database/adapters/sqlite.js +0 -42
- package/dist/src/database/coalescer.d.ts +0 -14
- package/dist/src/database/coalescer.js +0 -134
- package/dist/src/database/manager.d.ts +0 -35
- package/dist/src/database/manager.js +0 -87
- package/dist/src/database/types.d.ts +0 -20
- package/dist/src/database/types.js +0 -2
- package/dist/src/index.d.ts +0 -52
- package/dist/src/index.js +0 -92
- package/dist/src/middleware/compression.d.ts +0 -2
- package/dist/src/middleware/compression.js +0 -133
- package/dist/src/middleware/cors.d.ts +0 -2
- package/dist/src/middleware/cors.js +0 -66
- package/dist/src/middleware/presets.d.ts +0 -15
- package/dist/src/middleware/presets.js +0 -52
- package/dist/src/middleware/rate-limit.d.ts +0 -14
- package/dist/src/middleware/rate-limit.js +0 -83
- package/dist/src/middleware/security.d.ts +0 -10
- package/dist/src/middleware/security.js +0 -74
- package/dist/src/middleware/static.d.ts +0 -11
- package/dist/src/middleware/static.js +0 -191
- package/dist/src/openapi/generator.d.ts +0 -19
- package/dist/src/openapi/generator.js +0 -149
- package/dist/src/router/radix-router.d.ts +0 -18
- package/dist/src/router/radix-router.js +0 -89
- package/dist/src/router/radix-tree.d.ts +0 -21
- package/dist/src/router/radix-tree.js +0 -175
- package/dist/src/router/router.d.ts +0 -37
- package/dist/src/router/router.js +0 -203
- package/dist/src/testing/index.d.ts +0 -25
- package/dist/src/testing/index.js +0 -84
- package/dist/src/utils/cookies.d.ts +0 -3
- package/dist/src/utils/cookies.js +0 -59
- package/dist/src/utils/logger.d.ts +0 -2
- package/dist/src/utils/logger.js +0 -45
- package/dist/src/utils/signals.d.ts +0 -6
- package/dist/src/utils/signals.js +0 -31
- package/dist/src/utils/sse.d.ts +0 -6
- package/dist/src/utils/sse.js +0 -32
- package/dist/src/validation/index.d.ts +0 -3
- package/dist/src/validation/index.js +0 -19
- package/dist/src/validation/simple.d.ts +0 -5
- package/dist/src/validation/simple.js +0 -102
- package/dist/src/validation/types.d.ts +0 -32
- package/dist/src/validation/types.js +0 -12
- package/dist/src/validation/zod.d.ts +0 -4
- package/dist/src/validation/zod.js +0 -18
- package/dist/src/views/index.d.ts +0 -1
- package/dist/src/views/index.js +0 -17
- package/dist/src/views/types.d.ts +0 -3
- package/dist/src/views/types.js +0 -2
- package/dist/tests/adapters.test.d.ts +0 -1
- package/dist/tests/adapters.test.js +0 -106
- package/dist/tests/batch.test.d.ts +0 -1
- package/dist/tests/batch.test.js +0 -117
- package/dist/tests/body-parser.test.d.ts +0 -1
- package/dist/tests/body-parser.test.js +0 -52
- package/dist/tests/compression-sse.test.d.ts +0 -1
- package/dist/tests/compression-sse.test.js +0 -87
- package/dist/tests/cookies.test.d.ts +0 -1
- package/dist/tests/cookies.test.js +0 -63
- package/dist/tests/cors.test.d.ts +0 -1
- package/dist/tests/cors.test.js +0 -55
- package/dist/tests/database.test.d.ts +0 -1
- package/dist/tests/database.test.js +0 -80
- package/dist/tests/dx.test.d.ts +0 -1
- package/dist/tests/dx.test.js +0 -114
- package/dist/tests/ecosystem.test.d.ts +0 -1
- package/dist/tests/ecosystem.test.js +0 -133
- package/dist/tests/features.test.d.ts +0 -1
- package/dist/tests/features.test.js +0 -47
- package/dist/tests/fusion.test.d.ts +0 -1
- package/dist/tests/fusion.test.js +0 -92
- package/dist/tests/http-basic.test.d.ts +0 -1
- package/dist/tests/http-basic.test.js +0 -124
- package/dist/tests/logger.test.d.ts +0 -1
- package/dist/tests/logger.test.js +0 -33
- package/dist/tests/middleware.test.d.ts +0 -1
- package/dist/tests/middleware.test.js +0 -109
- package/dist/tests/observability.test.d.ts +0 -1
- package/dist/tests/observability.test.js +0 -59
- package/dist/tests/openapi.test.d.ts +0 -1
- package/dist/tests/openapi.test.js +0 -64
- package/dist/tests/plugin.test.d.ts +0 -1
- package/dist/tests/plugin.test.js +0 -65
- package/dist/tests/plugins.test.d.ts +0 -1
- package/dist/tests/plugins.test.js +0 -71
- package/dist/tests/rate-limit.test.d.ts +0 -1
- package/dist/tests/rate-limit.test.js +0 -77
- package/dist/tests/resources.test.d.ts +0 -1
- package/dist/tests/resources.test.js +0 -47
- package/dist/tests/scheduler.test.d.ts +0 -1
- package/dist/tests/scheduler.test.js +0 -46
- package/dist/tests/schema-routes.test.d.ts +0 -1
- package/dist/tests/schema-routes.test.js +0 -79
- package/dist/tests/security.test.d.ts +0 -1
- package/dist/tests/security.test.js +0 -83
- package/dist/tests/server-db.test.d.ts +0 -1
- package/dist/tests/server-db.test.js +0 -72
- package/dist/tests/smoke.test.d.ts +0 -1
- package/dist/tests/smoke.test.js +0 -10
- package/dist/tests/sqlite-fusion.test.d.ts +0 -1
- package/dist/tests/sqlite-fusion.test.js +0 -92
- package/dist/tests/static.test.d.ts +0 -1
- package/dist/tests/static.test.js +0 -102
- package/dist/tests/stream.test.d.ts +0 -1
- package/dist/tests/stream.test.js +0 -44
- package/dist/tests/task-metrics.test.d.ts +0 -1
- package/dist/tests/task-metrics.test.js +0 -53
- package/dist/tests/tasks.test.d.ts +0 -1
- package/dist/tests/tasks.test.js +0 -62
- package/dist/tests/testing.test.d.ts +0 -1
- package/dist/tests/testing.test.js +0 -47
- package/dist/tests/validation.test.d.ts +0 -1
- package/dist/tests/validation.test.js +0 -107
- package/dist/tests/websocket.test.d.ts +0 -1
- package/dist/tests/websocket.test.js +0 -146
- package/dist/vitest.config.d.ts +0 -2
- package/dist/vitest.config.js +0 -9
- package/docs/AEGIS.md +0 -91
- package/docs/API_REFERENCE.md +0 -749
- package/docs/BENCHMARKS.md +0 -39
- package/docs/CAPABILITIES.md +0 -70
- package/docs/CLI.md +0 -43
- package/docs/DATABASE.md +0 -142
- package/docs/ECOSYSTEM.md +0 -146
- package/docs/ERRORS.md +0 -112
- package/docs/FUSION.md +0 -87
- package/docs/MIDDLEWARE.md +0 -65
- package/docs/MIGRATION_1.9_TO_2.0.md +0 -495
- package/docs/NEXT_STEPS.md +0 -99
- package/docs/OPENAPI.md +0 -99
- package/docs/PLUGINS.md +0 -59
- package/docs/PRODUCTION_DEPLOYMENT.md +0 -798
- package/docs/REAL_WORLD_EXAMPLES.md +0 -109
- package/docs/ROADMAP.md +0 -366
- package/docs/ROUTING.md +0 -78
- package/docs/SECURITY.md +0 -876
- package/docs/STATIC.md +0 -61
- package/docs/VALIDATION.md +0 -114
- package/docs/WEBSOCKETS.md +0 -76
package/LICENSE
CHANGED
|
@@ -1,21 +1,201 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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="
|
|
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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
<div align="center">
|
|
12
|
-
|
|
13
|
-
[](https://www.npmjs.com/package/qhttpx)
|
|
14
|
-
[](https://www.npmjs.com/package/qhttpx)
|
|
15
|
-
[](https://github.com/Quantam-Open-Source/qhttpx/blob/main/LICENSE)
|
|
16
|
-
[](http://makeapullrequest.com)
|
|
17
|
-
[](https://www.typescriptlang.org)
|
|
18
|
-
[](#)
|
|
19
|
-
|
|
20
|
-
</div>
|
|
9
|
+
[](https://qhttpx.gridrr.com)
|
|
10
|
+
[](https://www.npmjs.com/package/qhttpx)
|
|
11
|
+
[](https://opensource.org/licenses/Apache-2.0)
|
|
12
|
+
[](https://www.npmjs.com/package/qhttpx)
|
|
13
|
+
[](https://github.com/Quantam-Open-Source/QHTTPX)
|
|
21
14
|
|
|
22
|
-
|
|
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
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
-
|
|
101
|
-
```
|
|
24
|
+
## 📊 Benchmarks
|
|
102
25
|
|
|
103
|
-
|
|
26
|
+
QHTTPX significantly outperforms traditional Node.js frameworks in high-throughput scenarios.
|
|
104
27
|
|
|
105
|
-
|
|
28
|
+
**Environment**: Windows, 2 vCPU, 8GB RAM
|
|
106
29
|
|
|
107
|
-
###
|
|
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
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
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
|
-
###
|
|
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
|
-
|
|
48
|
+
### Extreme Load Stability (C10K)
|
|
130
49
|
|
|
131
|
-
|
|
50
|
+
We simulated **10,000 concurrent connections** to test resilience.
|
|
132
51
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
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 {
|
|
169
|
-
|
|
170
|
-
app.get('/', () => ({ msg: 'Works!' }));
|
|
70
|
+
import { Q } from 'qhttpx';
|
|
171
71
|
|
|
172
|
-
|
|
173
|
-
app.security()
|
|
174
|
-
.log()
|
|
175
|
-
.production();
|
|
72
|
+
const app = Q.app();
|
|
176
73
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
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
|
-
|
|
190
|
-
|
|
191
|
-
|
|
79
|
+
// Zero-Copy Static JSON (Fastest)
|
|
80
|
+
app.get('/static', {
|
|
81
|
+
json: { status: 'ok', data: [1, 2, 3] }
|
|
82
|
+
});
|
|
192
83
|
|
|
193
|
-
app.
|
|
194
|
-
|
|
84
|
+
app.listen(3000, () => {
|
|
85
|
+
console.log('Server running on http://localhost:3000');
|
|
86
|
+
});
|
|
195
87
|
```
|
|
196
88
|
|
|
197
|
-
|
|
89
|
+
## 🛠 Key Features
|
|
198
90
|
|
|
199
|
-
###
|
|
200
|
-
|
|
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
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
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('/
|
|
211
|
-
|
|
212
|
-
|
|
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.
|
|
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
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
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
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
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
|
-
|
|
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
|
-
|
|
148
|
+
### 4. Production Observability
|
|
149
|
+
Prometheus metrics and structured logging are enabled by default.
|
|
251
150
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
[](https://www.npmjs.com/~brnxdev)
|
|
257
|
-
[](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
|
-
|
|
260
|
-
|
|
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
|
-
|
|
161
|
+
Deploy easily with our optimized multi-stage Dockerfile.
|
|
267
162
|
|
|
268
|
-
|
|
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
|
-
|
|
169
|
+
## License
|
|
271
170
|
|
|
272
|
-
|
|
273
|
-
<p>Project Part of</p>
|
|
274
|
-
<img src="assets/open%20quantam.png" alt="Open Quantam" width="150" />
|
|
275
|
-
</div>
|
|
171
|
+
Apache-2.0
|