barejs 0.2.5 → 0.2.6
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/README.md +24 -6
- package/dist/edge.js +37 -42
- package/dist/index.js +162 -158
- package/dist/node.js +162 -158
- package/dist/types/client/index.d.ts +58 -15
- package/dist/types/core/bare.d.ts +64 -24
- package/dist/types/core/router.d.ts +21 -2
- package/dist/types/core/ws-match.d.ts +34 -2
- package/dist/types/edge.d.ts +1 -0
- package/dist/types/index.d.ts +6 -5
- package/dist/types/security/validators.d.ts +13 -1
- package/dist/types/utils/tracing.d.ts +25 -0
- package/llms.txt +6 -2
- package/package.json +3 -3
- package/src/client/index.ts +129 -24
- package/src/core/bare.ts +352 -42
- package/src/core/radix.ts +54 -31
- package/src/core/router.ts +35 -3
- package/src/core/ws-match.ts +17 -2
- package/src/edge.ts +2 -0
- package/src/index.ts +6 -3
- package/src/runtime/bun.ts +27 -7
- package/src/runtime/node.ts +16 -1
- package/src/runtime/uws.ts +50 -10
- package/src/security/validators.ts +47 -2
- package/src/utils/openapi.ts +39 -9
- package/src/utils/tracing.ts +86 -0
package/README.md
CHANGED
|
@@ -50,6 +50,23 @@ app.listen(3000);
|
|
|
50
50
|
|
|
51
51
|
## Installation & Quick Start
|
|
52
52
|
|
|
53
|
+
### Official Starter CLI ([`create-barejs`](https://github.com/xarhang/create-barejs))
|
|
54
|
+
|
|
55
|
+
Scaffold a production-ready project (with JSON logging, `securityHeaders()`, `healthcheck()`, and OpenAPI 3.1 + Scalar `/docs`) in one command:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
# Interactive (prompts for Bun, Node.js, Node.js + uWebSockets.js, or Deno)
|
|
59
|
+
bun create barejs my-app
|
|
60
|
+
|
|
61
|
+
# Or choose a runtime directly:
|
|
62
|
+
bun create barejs my-bun-app --bun
|
|
63
|
+
bun create barejs my-node-app --node
|
|
64
|
+
bun create barejs my-uws-app --node-uws
|
|
65
|
+
bun create barejs my-deno-app --deno
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Manual Installation
|
|
69
|
+
|
|
53
70
|
<details open>
|
|
54
71
|
<summary><strong>Bun (>= 1.1.0)</strong></summary>
|
|
55
72
|
|
|
@@ -154,10 +171,10 @@ Measured in-process on **Bun** with [`mitata`](https://github.com/evanwash/mitat
|
|
|
154
171
|
|
|
155
172
|
| Scenario | **BareJS** | **ElysiaJS** | **Hono** |
|
|
156
173
|
| :--- | :---: | :---: | :---: |
|
|
157
|
-
| **1. 100 Routes + Dynamic Params** | **`1.
|
|
158
|
-
| **2. 10 Middlewares + Deep Path** | **`1.
|
|
159
|
-
| **3. POST JSON + Schema Validation** | **`
|
|
160
|
-
| **4. Async Handler + Query Parsing** |
|
|
174
|
+
| **1. 100 Routes + Dynamic Params** | **`1.28 µs`**<br><sub>`p99: 7.01 µs`</sub> | `1.91 µs`<br><sub>`p99: 8.83 µs`</sub> | `3.90 µs`<br><sub>`p99: 15.79 µs`</sub> |
|
|
175
|
+
| **2. 10 Middlewares + Deep Path** | **`1.19 µs`**<br><sub>`p99: 6.78 µs`</sub> | `1.99 µs`<br><sub>`p99: 8.04 µs`</sub> | `3.97 µs`<br><sub>`p99: 14.68 µs`</sub> |
|
|
176
|
+
| **3. POST JSON + Schema Validation** | **`3.54 µs`**<br><sub>`p99: 12.64 µs`</sub> | `4.61 µs`<br><sub>`p99: 14.65 µs`</sub> | `4.63 µs`<br><sub>`p99: 15.63 µs`</sub> |
|
|
177
|
+
| **4. Async Handler + Query Parsing** | **`1.88 µs`**<br><sub>`p99: 8.83 µs`</sub> | `2.21 µs`<br><sub>`p99: 9.09 µs`</sub> | `3.15 µs`<br><sub>`p99: 12.65 µs`</sub> |
|
|
161
178
|
|
|
162
179
|
> Last Updated: 2026-11-30 (github action — `linux`, AMD EPYC 7763 64-Core Processor, Bun `1.4.5`, Elysia `1.4.21`, Hono `4.11.4`)
|
|
163
180
|
|
|
@@ -186,7 +203,8 @@ BareJS is a complete, zero-boilerplate backend platform—every module below shi
|
|
|
186
203
|
## Documentation
|
|
187
204
|
|
|
188
205
|
- **[Documentation Site](https://xarhang.github.io/bareJS/)** — Interactive docs, code examples, and live CI benchmark dashboard.
|
|
189
|
-
- **[
|
|
206
|
+
- **[`create-barejs` Starter CLI](https://github.com/xarhang/create-barejs)** — Official multi-runtime project scaffolding (`bun create barejs my-app --bun|--node|--node-uws|--deno`).
|
|
207
|
+
- **[Comprehensive Guide](./docs/guide.md)** — Scaffolding, validation & auto-coercion, cookies & uploads, security suite, `app.derive()`, `app.macro()`, WebSockets, SSE, JSON-RPC 2.0, OpenAPI 3.1, `listenCluster()`, `uWebSockets.js`, native `tls`, `barejs/edge`, and `bareClient`/`bareTreaty`.
|
|
190
208
|
- **[External Integrations](./docs/integrations.md)** — Ready-to-use recipes for Better-Auth, GraphQL Yoga, Auth0, Clerk, Sentry, and OpenTelemetry.
|
|
191
209
|
- **[API & Configuration Reference](./docs/reference.md)** — Complete `Context` (`ctx`) & `BareJS` API tables, `poolSize`, `bare.config.ts`, and `NODE_ENV` settings.
|
|
192
210
|
- **[Benchmarks](./BENCHMARKS.md)** — Full 7-scenario results and reproduction instructions.
|
|
@@ -198,7 +216,7 @@ BareJS is a complete, zero-boilerplate backend platform—every module below shi
|
|
|
198
216
|
|
|
199
217
|
## Status, Contributing & License
|
|
200
218
|
|
|
201
|
-
- **Status:** Active `0.2.x` development (**
|
|
219
|
+
- **Status:** Active `0.2.x` development (**489 tests / 6,789 assertions**). Verified in [CI](./.github/workflows/ci.yml) across **Bun** (`bun test`), **Node.js 20 & 22** (`vitest run` + `tests/node-smoke.mjs`; Node 20 skips `production-db.test.ts` which requires `node:sqlite`), and **Deno 2** (`deno test` + `tests/deno-smoke.ts`; skips `playwright.test.ts` and `production-db.test.ts`).
|
|
202
220
|
- **Security:** See [SECURITY.md](./SECURITY.md) for reporting vulnerabilities.
|
|
203
221
|
- **Contributing:** See [CONTRIBUTING.md](./CONTRIBUTING.md) for development setup and release workflows.
|
|
204
222
|
- **License:** [MIT](./LICENSE) — Maintained by [xarhang](https://github.com/xarhang).
|