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.
Files changed (2) hide show
  1. package/Readme.md +54 -57
  2. package/package.json +1 -1
package/Readme.md CHANGED
@@ -1,93 +1,90 @@
1
- # PrinceJS
1
+ # princejs — The Smallest Bun Framework in History
2
2
 
3
- **The fastest backend framework ever made.**
4
- **Beats Hono and Express • Built in 3 days** \
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
- ### Install
9
+ ## 🚀 Get Started
9
10
 
10
11
  ```bash
11
- pnpm add princejs
12
- # or
13
- bun add princejs
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 'princejs';
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
- // CORS + logging
26
- app.use(async (req, next) => {
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
- // Global error handler
34
- app.error((err) => app.json({ error: err.message }, 500));
29
+ ---
35
30
 
36
- // Routes
37
- app.get('/', () => app.json({ hello: 'PrinceJS', age: 13 }));
31
+ ## ⚔️ Size War (Gzipped — Real World)
38
32
 
39
- app.post('/pay', async (req) => {
40
- let body = {};
41
- try { body = await req.json(); } catch {}
42
- return app.json({ url: `https://stripe.com/pay/${body.amount || 999}` });
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. bigger |
37
+ | **Elysia** | 62.5 kB | 245 kB | 22× bigger |
44
38
 
45
- app.listen(3000);
46
- ```
39
+ > princejs fits in a tweet. Elysia needs a ZIP file.
47
40
 
48
41
  ---
49
42
 
50
- ## Features
43
+ ## ⚡ Benchmarks (3×3 — Windows, Nov 11, 2025)
51
44
 
52
- All HTTP methods: **GET, POST, PUT, DELETE, PATCH, OPTIONS, HEAD**
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
- ```bash
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
- ## 🔥 Benchmark Comparison (real Windows laptop)
62
-
63
- Real-world 30-second load test with `autocannon -c 100 -d 30`.
55
+ ## 🧹 Features
64
56
 
65
- ### **Framework Performance Table**
57
+ ```ts
58
+ .use(rateLimit({ max: 100 }))
59
+ .use(validate(z.object({ name: z.string() })))
60
+ ```
66
61
 
67
- | Framework | Avg Req/sec | Total Requests (30s) | Avg Bytes/sec | Avg Latency |
68
- | -------------------- | ------------ | -------------------- | ------------- | ------------ |
69
- | **PrinceJS** | **8,526.34** | **256,000** | **1.14 MB/s** | **11.22 ms** |
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
- ### Author
76
-
77
- Matthew Micheal — Nigeria
68
+ ## 📦 Install
78
69
 
79
- Made in PowerShell on a school laptop.
70
+ ```bash
71
+ npm i princejs
72
+ # or
73
+ bun add princejs
74
+ ```
80
75
 
81
- ### Links
76
+ ---
82
77
 
83
- npm: [https://www.npmjs.com/package/princejs](https://www.npmjs.com/package/princejs)
78
+ ## 📚 Docs
84
79
 
85
- github: [https://github.com/MatthewTheCoder1218/princejs](https://github.com/MatthewTheCoder1218/princejs)
80
+ **coming soon →** [princejs.vercel.app](https://princejs.vercel.app)
86
81
 
87
82
  ---
88
83
 
89
- PrinceJS Small. Fast. Unbeatable.
84
+ ## 🇳🇬 Built in Nigeria
90
85
 
91
- ```bash
92
- pnpm add princejs
93
- ```
86
+ **@Lil_Prince_1218 — 13 years old**
87
+ Lagos, Nigeria
88
+ **November 11, 2025**
89
+
90
+ > *“2.8 kB. 600k req. No excuses.”*
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "princejs",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "An easy and fast backend framework — by a 13yo developer, for developers.",
5
5
  "main": "dist/prince.js",
6
6
  "types": "dist/prince.d.ts",