@hedystia/swagger 1.1.5

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 +51 -0
  2. package/readme.md +164 -0
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "@hedystia/swagger",
3
+ "module": "index.ts",
4
+ "version": "1.1.5",
5
+ "devDependencies": {
6
+ "@types/bun": "latest",
7
+ "tsup": "^8.3.5"
8
+ },
9
+ "dependencies": {
10
+ "@apidevtools/swagger-parser": "^10.1.1",
11
+ "hedystia": "^1.1.5",
12
+ "openapi-types": "^12.1.3"
13
+ },
14
+ "peerDependencies": {
15
+ "@apidevtools/swagger-parser": "^10.1.1",
16
+ "typescript": ">= 5.0.0",
17
+ "hedystia": ">= 1.1.0",
18
+ "openapi-types": ">= 12.0.0"
19
+ },
20
+ "peerDependenciesMeta": {
21
+ "@apidevtools/swagger-parser": {
22
+ "optional": false
23
+ },
24
+ "typescript": {
25
+ "optional": true
26
+ },
27
+ "hedystia": {
28
+ "optional": false
29
+ },
30
+ "openapi-types": {
31
+ "optional": true
32
+ }
33
+ },
34
+ "private": false,
35
+ "scripts": {
36
+ "build": "tsup",
37
+ "dev": "bun --watch --no-clear-screen run src/index.ts"
38
+ },
39
+ "repository": {
40
+ "type": "git",
41
+ "url": "https://github.com/Hedystia/Framework"
42
+ },
43
+ "author": {
44
+ "name": "Zastinian",
45
+ "email": "contact@zastinian.com",
46
+ "url": "https://github.com/Zastinian"
47
+ },
48
+ "type": "commonjs",
49
+ "types": "./dist/index.d.ts",
50
+ "main": "./dist/index.js"
51
+ }
package/readme.md ADDED
@@ -0,0 +1,164 @@
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
+
30
+ ## 🚀 Launch in 30 Seconds
31
+
32
+ 1. Install with Bun:
33
+ ```bash
34
+ bun add hedystia
35
+ ```
36
+
37
+ 2. Create your first API:
38
+ ```typescript
39
+ import { Hedystia, z } from "hedystia";
40
+
41
+ const app = new Hedystia()
42
+ .get("/hello/:name", (ctx) => `Hello ${ctx.params.name}!`, {
43
+ params: z.object({ name: z.string() }),
44
+ response: z.string()
45
+ })
46
+ .listen(3000);
47
+ ```
48
+
49
+ 3. Generate client and consume API:
50
+ ```typescript
51
+ import { createClient } from "@hedystia/client";
52
+
53
+ const client = createClient<typeof app>("http://localhost:3000");
54
+
55
+ // Fully typed request!
56
+ const { data } = await client.hello.name("World").get();
57
+ console.log(data); // "Hello World!"
58
+ ```
59
+
60
+ ## 💡 Why Developers Love Hedystia
61
+
62
+ ### 🔄 Full-stack Type Safety
63
+ ```typescript
64
+ // Server-side validation
65
+ .post("/users", (ctx) => {...}, {
66
+ body: z.object({
67
+ email: z.string().email(),
68
+ age: z.number().positive()
69
+ })
70
+ })
71
+
72
+ // Client-side types
73
+ await client.users.post({
74
+ email: "user@example.com", // Autocompletes!
75
+ age: 25 // Type-checked
76
+ });
77
+ ```
78
+
79
+ ### 📖 Swagger Integration
80
+
81
+ ```typescript
82
+ import { swagger } from "@hedystia/swagger";
83
+
84
+ const swaggerPlugin = swagger({
85
+ title: "My API",
86
+ description: "An example API with Swagger",
87
+ version: "1.0.0",
88
+ tags: [
89
+ { name: "users", description: "User operations" },
90
+ ],
91
+ });
92
+
93
+ swaggerPlugin.captureRoutes(app);
94
+
95
+ app.use("/swagger", swaggerPlugin.plugin).listen(3000);
96
+ ```
97
+
98
+ ### ⚡ Performance First
99
+ - Bun runtime optimized
100
+ - Only zod dependency
101
+ - Faster than Express
102
+ - Built-in response compression
103
+
104
+ ### 🧩 Modern Feature Set
105
+ ```typescript
106
+ // File uploads
107
+ .post("/upload", async (ctx) => {
108
+ const formData = await ctx.body; // FormData type
109
+ })
110
+
111
+ // Binary responses
112
+ .get("/pdf", () => new Blob([...]), {
113
+ response: z.instanceof(Blob)
114
+ })
115
+
116
+ // Nested routing
117
+ .group("/api/v1", (v1) => v1
118
+ .group("/users", (users) => users
119
+ .get("/:id", ...)
120
+ )
121
+ )
122
+ ```
123
+
124
+ ## 🛠️ Development Roadmap
125
+
126
+ ### Core Features
127
+ - ✅ HTTP Methods: GET, POST, PUT, PATCH, DELETE
128
+ - ✅ Response Types: JSON, Text, FormData, Blob, ArrayBuffer
129
+ - ✅ Router Groups & Middleware
130
+ - ✅ Type-safe Client Generation
131
+ - ✅ WebSocket Support
132
+
133
+ ### Advanced Capabilities
134
+ - ✅ Zod Validation
135
+ - ✅ Hooks System (onRequest, onError, etc)
136
+ - ✅ Macro System for Auth/Rate Limiting
137
+ - 🚧 File System Routing
138
+ - ✅ OpenAPI - Swagger Integration
139
+
140
+ ## 💼 Production Ready
141
+ ```typescript
142
+ // Error handling
143
+ .onError((err) => {
144
+ return Response.json({
145
+ error: err.message
146
+ }, { status: 500 })
147
+ })
148
+
149
+ // Rate limiting macro
150
+ .macro({
151
+ rateLimit: () => ({
152
+ resolve: async (ctx) => {
153
+ // Implement your logic
154
+ }
155
+ })
156
+ })
157
+ ```
158
+
159
+ ## 📜 License
160
+ MIT License © 2025 Hedystia
161
+
162
+ ## 🗣️ Community
163
+ - [GitHub Issues](https://github.com/Hedystia/Framework/issues)
164
+ - [Discord Server](https://hedystia.com/support)