@hedystia/client
v2.4.0
Published
Next-gen TypeScript framework for building type-safe APIs at lightspeed
Maintainers
Readme
🌟 Superpowers
- 🌐 Multi-runtime support - Bun (default), Deno, Node.js, Vercel, Cloudflare Workers, Fastly Compute, Lambda, etc.
- 🔒 End-to-end type safety - From params to response, full TypeScript integration
- ⚡ Bun-native performance - Built for Bun runtime with native validation
- 🧩 Client integration - Auto-generated type-safe HTTP client
- 🛡️ Validation built-in - Zod integration for runtime safety
- 🔌 Extensible architecture - Middleware, hooks and macros system
- 📝 Standard Schema - Compatibility with the standard schema so you can use it with Zod, Arktype, etc.
🚀 Launch in 30 Seconds
- Install with Bun:
bun add hedystia- Create your first API:
import { Hedystia, h } from "hedystia";
const app = new Hedystia()
.get("/hello/:name", (ctx) => `Hello ${ctx.params.name}!`, {
params: h.object({ name: h.string() }),
response: h.string()
})
.listen(3000);- Generate client and consume API:
import { createClient } from "@hedystia/client";
const client = createClient<typeof app>("http://localhost:3000");
// Fully typed request!
const { data } = await client.hello.name("World").get();
console.log(data); // "Hello World!"💡 Why Developers Love Hedystia
🔄 Full-stack Type Safety
// Server-side validation
.post("/users", (ctx) => {...}, {
body: h.object({
email: h.email(),
age: h.number()
})
})
// Client-side types
await client.users.post({
body: {
email: "[email protected]", // Autocompletes!
age: 25 // Type-checked
}
});📖 Swagger Integration
import { swagger } from "@hedystia/swagger";
const swaggerPlugin = swagger({
title: "My API",
description: "An example API with Swagger",
version: "1.0.0",
tags: [
{ name: "users", description: "User operations" },
],
});
app.use("/swagger", swaggerPlugin.plugin(app));
app.listen(3000);⚡ Performance First
- Bun runtime optimized
- Faster by default
- Own type validation system
- Faster than Express
- Built-in response compression
🧩 Modern Feature Set
// File uploads
.post("/upload", async (ctx) => {
const formData = await ctx.body; // FormData type
})
// Binary responses
.get("/pdf", () => new Blob([...]), {
response: h.instanceof(Blob)
})
// Nested routing
.group("/api/v1", (v1) => v1
.group("/users", (users) => users
.get("/:id", ...)
)
)🛠️ Development Roadmap
Core Features
- ✅ HTTP Methods: GET, POST, PUT, PATCH, DELETE
- ✅ Response Types: JSON, Text, FormData, Blob, ArrayBuffer
- ✅ Router Groups & Middleware
- ✅ Type-safe Client Generation
- ✅ WebSocket Support
- ✅ Adapter System to work with other frameworks
Advanced Capabilities
- ✅ Standard Schema Compatibility
- ✅ Hooks System (onRequest, onError, etc)
- ✅ Macro System for Auth/Rate Limiting
- ✅ OpenAPI - Swagger Integration
💼 Production Ready
// Error handling
.onError((err, ctx) => {
ctx.set.status(500);
return {
error: err.message
};
})
// Rate limiting macro
.macro({
rateLimit: () => ({
resolve: async (ctx) => {
// Implement your logic
}
})
})📜 License
MIT License © 2026 Hedystia
