@hedystia/validations 0.0.1 → 1.2.0

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/package.json +1 -1
  2. package/readme.md +165 -165
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hedystia/validations",
3
3
  "module": "index.ts",
4
- "version": "0.0.1",
4
+ "version": "1.2.0",
5
5
  "devDependencies": {
6
6
  "@standard-schema/spec": "^1.0.0",
7
7
  "@types/bun": "latest",
package/readme.md CHANGED
@@ -1,165 +1,165 @@
1
- <div align="center">
2
- <p>
3
- <strong>🚀 Hedystia Framework</strong>
4
- </p>
5
-
6
- <p>
7
- <strong>Next-gen TypeScript framework for building type-safe APIs at lightspeed! ⚡</strong>
8
- </p>
9
-
10
- <p>
11
- <a href="https://www.npmjs.com/package/hedystia"><img src="https://img.shields.io/npm/v/hedystia.svg?style=flat-square" alt="npm version"></a>
12
- <a href="https://www.npmjs.com/package/hedystia"><img src="https://img.shields.io/npm/dm/hedystia.svg?style=flat-square" alt="npm downloads"></a>
13
- <a href="LICENSE"><img src="https://img.shields.io/github/license/Hedystia/Framework.svg?style=flat-square" alt="license"></a>
14
- <img src="https://img.shields.io/badge/Bun-powered-FFD43B?style=flat-square&logo=bun" alt="Bun powered">
15
- </p>
16
- </div>
17
-
18
- ## 🚨 Early Access Notice
19
- > **Warning**
20
- > Framework is in active development. Core features are stable but some advanced functionality still being implemented.
21
-
22
- ## 🌟 Superpowers
23
-
24
- - 🔒 **End-to-end type safety** - From params to response, full TypeScript integration
25
- - ⚡ **Bun-native performance** - Built for Bun runtime with zod dependency
26
- - 🧩 **Client integration** - Auto-generated type-safe HTTP client
27
- - 🛡️ **Validation built-in** - Zod integration for runtime safety
28
- - 🔌 **Extensible architecture** - Middleware, hooks and macros system
29
- - 📝 **Standard Schema** - Compatibility with the standard schema so you can use it with Zod, Arktype, etc.
30
-
31
- ## 🚀 Launch in 30 Seconds
32
-
33
- 1. Install with Bun:
34
- ```bash
35
- bun add hedystia
36
- ```
37
-
38
- 2. Create your first API:
39
- ```typescript
40
- import { Hedystia, h } from "hedystia";
41
-
42
- const app = new Hedystia()
43
- .get("/hello/:name", (ctx) => `Hello ${ctx.params.name}!`, {
44
- params: h.object({ name: h.string() }),
45
- response: h.string()
46
- })
47
- .listen(3000);
48
- ```
49
-
50
- 3. Generate client and consume API:
51
- ```typescript
52
- import { createClient } from "@hedystia/client";
53
-
54
- const client = createClient<typeof app>("http://localhost:3000");
55
-
56
- // Fully typed request!
57
- const { data } = await client.hello.name("World").get();
58
- console.log(data); // "Hello World!"
59
- ```
60
-
61
- ## 💡 Why Developers Love Hedystia
62
-
63
- ### 🔄 Full-stack Type Safety
64
- ```typescript
65
- // Server-side validation
66
- .post("/users", (ctx) => {...}, {
67
- body: h.object({
68
- email: h.email(),
69
- age: h.number()
70
- })
71
- })
72
-
73
- // Client-side types
74
- await client.users.post({
75
- email: "user@example.com", // Autocompletes!
76
- age: 25 // Type-checked
77
- });
78
- ```
79
-
80
- ### 📖 Swagger Integration
81
-
82
- ```typescript
83
- import { swagger } from "@hedystia/swagger";
84
-
85
- const swaggerPlugin = swagger({
86
- title: "My API",
87
- description: "An example API with Swagger",
88
- version: "1.0.0",
89
- tags: [
90
- { name: "users", description: "User operations" },
91
- ],
92
- });
93
-
94
- swaggerPlugin.captureRoutes(app);
95
-
96
- app.use("/swagger", swaggerPlugin.plugin).listen(3000);
97
- ```
98
-
99
- ### ⚡ Performance First
100
- - Bun runtime optimized
101
- - Only zod dependency
102
- - Faster than Express
103
- - Built-in response compression
104
-
105
- ### 🧩 Modern Feature Set
106
- ```typescript
107
- // File uploads
108
- .post("/upload", async (ctx) => {
109
- const formData = await ctx.body; // FormData type
110
- })
111
-
112
- // Binary responses
113
- .get("/pdf", () => new Blob([...]), {
114
- response: h.instanceof(Blob)
115
- })
116
-
117
- // Nested routing
118
- .group("/api/v1", (v1) => v1
119
- .group("/users", (users) => users
120
- .get("/:id", ...)
121
- )
122
- )
123
- ```
124
-
125
- ## 🛠️ Development Roadmap
126
-
127
- ### Core Features
128
- - ✅ HTTP Methods: GET, POST, PUT, PATCH, DELETE
129
- - ✅ Response Types: JSON, Text, FormData, Blob, ArrayBuffer
130
- - ✅ Router Groups & Middleware
131
- - ✅ Type-safe Client Generation
132
- - ✅ WebSocket Support
133
- - ✅ Standard Schema Compatibility
134
-
135
- ### Advanced Capabilities
136
- - ✅ Zod Validation - Changed to native validation plugin
137
- - ✅ Hooks System (onRequest, onError, etc)
138
- - ✅ Macro System for Auth/Rate Limiting
139
- - ✅ OpenAPI - Swagger Integration
140
-
141
- ## 💼 Production Ready
142
- ```typescript
143
- // Error handling
144
- .onError((err) => {
145
- return Response.json({
146
- error: err.message
147
- }, { status: 500 })
148
- })
149
-
150
- // Rate limiting macro
151
- .macro({
152
- rateLimit: () => ({
153
- resolve: async (ctx) => {
154
- // Implement your logic
155
- }
156
- })
157
- })
158
- ```
159
-
160
- ## 📜 License
161
- MIT License © 2025 Hedystia
162
-
163
- ## 🗣️ Community
164
- - [GitHub Issues](https://github.com/Hedystia/Framework/issues)
165
- - [Discord Server](https://hedystia.com/support)
1
+ <div align="center">
2
+ <p>
3
+ <strong>🚀 Hedystia Framework</strong>
4
+ </p>
5
+
6
+ <p>
7
+ <strong>Next-gen TypeScript framework for building type-safe APIs at lightspeed! ⚡</strong>
8
+ </p>
9
+
10
+ <p>
11
+ <a href="https://www.npmjs.com/package/hedystia"><img src="https://img.shields.io/npm/v/hedystia.svg?style=flat-square" alt="npm version"></a>
12
+ <a href="https://www.npmjs.com/package/hedystia"><img src="https://img.shields.io/npm/dm/hedystia.svg?style=flat-square" alt="npm downloads"></a>
13
+ <a href="LICENSE"><img src="https://img.shields.io/github/license/Hedystia/Framework.svg?style=flat-square" alt="license"></a>
14
+ <img src="https://img.shields.io/badge/Bun-powered-FFD43B?style=flat-square&logo=bun" alt="Bun powered">
15
+ </p>
16
+ </div>
17
+
18
+ ## 🚨 Early Access Notice
19
+ > **Warning**
20
+ > Framework is in active development. Core features are stable but some advanced functionality still being implemented.
21
+
22
+ ## 🌟 Superpowers
23
+
24
+ - 🔒 **End-to-end type safety** - From params to response, full TypeScript integration
25
+ - ⚡ **Bun-native performance** - Built for Bun runtime with zod dependency
26
+ - 🧩 **Client integration** - Auto-generated type-safe HTTP client
27
+ - 🛡️ **Validation built-in** - Zod integration for runtime safety
28
+ - 🔌 **Extensible architecture** - Middleware, hooks and macros system
29
+ - 📝 **Standard Schema** - Compatibility with the standard schema so you can use it with Zod, Arktype, etc.
30
+
31
+ ## 🚀 Launch in 30 Seconds
32
+
33
+ 1. Install with Bun:
34
+ ```bash
35
+ bun add hedystia
36
+ ```
37
+
38
+ 2. Create your first API:
39
+ ```typescript
40
+ import { Hedystia, h } from "hedystia";
41
+
42
+ const app = new Hedystia()
43
+ .get("/hello/:name", (ctx) => `Hello ${ctx.params.name}!`, {
44
+ params: h.object({ name: h.string() }),
45
+ response: h.string()
46
+ })
47
+ .listen(3000);
48
+ ```
49
+
50
+ 3. Generate client and consume API:
51
+ ```typescript
52
+ import { createClient } from "@hedystia/client";
53
+
54
+ const client = createClient<typeof app>("http://localhost:3000");
55
+
56
+ // Fully typed request!
57
+ const { data } = await client.hello.name("World").get();
58
+ console.log(data); // "Hello World!"
59
+ ```
60
+
61
+ ## 💡 Why Developers Love Hedystia
62
+
63
+ ### 🔄 Full-stack Type Safety
64
+ ```typescript
65
+ // Server-side validation
66
+ .post("/users", (ctx) => {...}, {
67
+ body: h.object({
68
+ email: h.email(),
69
+ age: h.number()
70
+ })
71
+ })
72
+
73
+ // Client-side types
74
+ await client.users.post({
75
+ email: "user@example.com", // Autocompletes!
76
+ age: 25 // Type-checked
77
+ });
78
+ ```
79
+
80
+ ### 📖 Swagger Integration
81
+
82
+ ```typescript
83
+ import { swagger } from "@hedystia/swagger";
84
+
85
+ const swaggerPlugin = swagger({
86
+ title: "My API",
87
+ description: "An example API with Swagger",
88
+ version: "1.0.0",
89
+ tags: [
90
+ { name: "users", description: "User operations" },
91
+ ],
92
+ });
93
+
94
+ swaggerPlugin.captureRoutes(app);
95
+
96
+ app.use("/swagger", swaggerPlugin.plugin).listen(3000);
97
+ ```
98
+
99
+ ### ⚡ Performance First
100
+ - Bun runtime optimized
101
+ - Only zod dependency
102
+ - Faster than Express
103
+ - Built-in response compression
104
+
105
+ ### 🧩 Modern Feature Set
106
+ ```typescript
107
+ // File uploads
108
+ .post("/upload", async (ctx) => {
109
+ const formData = await ctx.body; // FormData type
110
+ })
111
+
112
+ // Binary responses
113
+ .get("/pdf", () => new Blob([...]), {
114
+ response: h.instanceof(Blob)
115
+ })
116
+
117
+ // Nested routing
118
+ .group("/api/v1", (v1) => v1
119
+ .group("/users", (users) => users
120
+ .get("/:id", ...)
121
+ )
122
+ )
123
+ ```
124
+
125
+ ## 🛠️ Development Roadmap
126
+
127
+ ### Core Features
128
+ - ✅ HTTP Methods: GET, POST, PUT, PATCH, DELETE
129
+ - ✅ Response Types: JSON, Text, FormData, Blob, ArrayBuffer
130
+ - ✅ Router Groups & Middleware
131
+ - ✅ Type-safe Client Generation
132
+ - ✅ WebSocket Support
133
+ - ✅ Standard Schema Compatibility
134
+
135
+ ### Advanced Capabilities
136
+ - ✅ Zod Validation - Changed to native validation plugin
137
+ - ✅ Hooks System (onRequest, onError, etc)
138
+ - ✅ Macro System for Auth/Rate Limiting
139
+ - ✅ OpenAPI - Swagger Integration
140
+
141
+ ## 💼 Production Ready
142
+ ```typescript
143
+ // Error handling
144
+ .onError((err) => {
145
+ return Response.json({
146
+ error: err.message
147
+ }, { status: 500 })
148
+ })
149
+
150
+ // Rate limiting macro
151
+ .macro({
152
+ rateLimit: () => ({
153
+ resolve: async (ctx) => {
154
+ // Implement your logic
155
+ }
156
+ })
157
+ })
158
+ ```
159
+
160
+ ## 📜 License
161
+ MIT License © 2025 Hedystia
162
+
163
+ ## 🗣️ Community
164
+ - [GitHub Issues](https://github.com/Hedystia/Framework/issues)
165
+ - [Discord Server](https://hedystia.com/support)