princejs 1.4.0 → 1.4.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/Readme.md +54 -57
- package/package.json +1 -1
package/Readme.md
CHANGED
|
@@ -1,93 +1,90 @@
|
|
|
1
|
-
#
|
|
1
|
+
# princejs — The Smallest Bun Framework in History
|
|
2
2
|
|
|
3
|
-
**
|
|
4
|
-
|
|
3
|
+
**2.8 kB gzipped** • **~600k req/30s** • **Built by a 13yo Nigerian**
|
|
4
|
+
|
|
5
|
+
> *"I didn’t beat Elysia. I outsmarted it."* — @Lil_Prince_1218
|
|
5
6
|
|
|
6
7
|
---
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
## 🚀 Get Started
|
|
9
10
|
|
|
10
11
|
```bash
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
bun
|
|
14
|
-
# or
|
|
15
|
-
npm install princejs
|
|
12
|
+
bun create princejs my-app
|
|
13
|
+
cd my-app
|
|
14
|
+
bun dev
|
|
16
15
|
```
|
|
17
16
|
|
|
18
|
-
### Quick Start
|
|
19
|
-
|
|
20
17
|
```ts
|
|
21
|
-
import { Prince } from
|
|
18
|
+
import { Prince } from "princejs";
|
|
19
|
+
import { cors } from "princejs/middleware";
|
|
22
20
|
|
|
23
|
-
const app = new Prince()
|
|
21
|
+
const app = new Prince()
|
|
22
|
+
.use(cors())
|
|
23
|
+
.get("/", () => "Hello princejs")
|
|
24
|
+
.get("/users/:id", (req) => ({ id: req.params.id }));
|
|
24
25
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
console.log(`${req.method} ${req.url}`);
|
|
28
|
-
const res = await next();
|
|
29
|
-
res.headers.set('Access-Control-Allow-Origin', '*');
|
|
30
|
-
return res;
|
|
31
|
-
});
|
|
26
|
+
app.listen(5000);
|
|
27
|
+
```
|
|
32
28
|
|
|
33
|
-
|
|
34
|
-
app.error((err) => app.json({ error: err.message }, 500));
|
|
29
|
+
---
|
|
35
30
|
|
|
36
|
-
|
|
37
|
-
app.get('/', () => app.json({ hello: 'PrinceJS', age: 13 }));
|
|
31
|
+
## ⚔️ Size War (Gzipped — Real World)
|
|
38
32
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
33
|
+
| Framework | Gzipped | Minified | vs princejs |
|
|
34
|
+
| ------------ | ---------- | ---------- | ----------- |
|
|
35
|
+
| **princejs** | **2.8 kB** | **7.8 kB** | — |
|
|
36
|
+
| **Hono** | 7.3 kB | 18.7 kB | 2.6× bigger |
|
|
37
|
+
| **Elysia** | 62.5 kB | 245 kB | 22× bigger |
|
|
44
38
|
|
|
45
|
-
|
|
46
|
-
```
|
|
39
|
+
> princejs fits in a tweet. Elysia needs a ZIP file.
|
|
47
40
|
|
|
48
41
|
---
|
|
49
42
|
|
|
50
|
-
##
|
|
43
|
+
## ⚡ Benchmarks (3×3 — Windows, Nov 11, 2025)
|
|
51
44
|
|
|
52
|
-
|
|
45
|
+
| Framework | Requests (30s) | Req/s | Notes |
|
|
46
|
+
| ------------ | -------------- | ---------- | -------------- |
|
|
47
|
+
| **princejs** | **599k** | **19,966** | 🥈 2nd fastest |
|
|
48
|
+
| **Elysia** | 602k | 20,071 | 🥇 0.5% faster |
|
|
49
|
+
| **Hono** | 578k | 19,254 | 🥉 Slower |
|
|
53
50
|
|
|
54
|
-
|
|
55
|
-
app.json(data, status?) — clean JSON with status
|
|
56
|
-
app.error(handler) — global error handling
|
|
57
|
-
```
|
|
51
|
+
> Elysia is only 0.5% faster. But princejs is **22× smaller**.
|
|
58
52
|
|
|
59
53
|
---
|
|
60
54
|
|
|
61
|
-
##
|
|
62
|
-
|
|
63
|
-
Real-world 30-second load test with `autocannon -c 100 -d 30`.
|
|
55
|
+
## 🧹 Features
|
|
64
56
|
|
|
65
|
-
|
|
57
|
+
```ts
|
|
58
|
+
.use(rateLimit({ max: 100 }))
|
|
59
|
+
.use(validate(z.object({ name: z.string() })))
|
|
60
|
+
```
|
|
66
61
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
| Hono | 8,044.8 | 241,000 | 1.08 MB/s | 11.22 ms |
|
|
71
|
-
| Elysia | 9,531.21 | 286,000 | 1.28 MB/s | 10 ms |
|
|
62
|
+
✅ Zod Validation
|
|
63
|
+
✅ CORS + Logger
|
|
64
|
+
✅ Rate Limit Middleware
|
|
72
65
|
|
|
73
66
|
---
|
|
74
67
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
Matthew Micheal — Nigeria
|
|
68
|
+
## 📦 Install
|
|
78
69
|
|
|
79
|
-
|
|
70
|
+
```bash
|
|
71
|
+
npm i princejs
|
|
72
|
+
# or
|
|
73
|
+
bun add princejs
|
|
74
|
+
```
|
|
80
75
|
|
|
81
|
-
|
|
76
|
+
---
|
|
82
77
|
|
|
83
|
-
|
|
78
|
+
## 📚 Docs
|
|
84
79
|
|
|
85
|
-
|
|
80
|
+
**coming soon →** [princejs.vercel.app](https://princejs.vercel.app)
|
|
86
81
|
|
|
87
82
|
---
|
|
88
83
|
|
|
89
|
-
|
|
84
|
+
## 🇳🇬 Built in Nigeria
|
|
90
85
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
86
|
+
**@Lil_Prince_1218 — 13 years old**
|
|
87
|
+
Lagos, Nigeria
|
|
88
|
+
**November 11, 2025**
|
|
89
|
+
|
|
90
|
+
> *“2.8 kB. 600k req. No excuses.”*
|