π Hedystia Framework
Next-gen TypeScript framework for building type-safe APIs at lightspeed! β‘
Warning Framework is in active development. Core features are stable but some advanced functionality still being implemented.
- π 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.
- 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!"
// Server-side validation
.post("/users", (ctx) => {...}, {
body: h.object({
email: h.email(),
age: h.number()
})
})
// Client-side types
await client.users.post({
email: "user@example.com", // Autocompletes!
age: 25 // Type-checked
});
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" },
],
});
swaggerPlugin.captureRoutes(app);
app.use("/swagger", swaggerPlugin.plugin).listen(3000);
- Bun runtime optimized
- Faster by default
- Own type validation system
- Faster than Express
- Built-in response compression
// 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", ...)
)
)
- β 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
- β Standard Schema Compatibility
- β Hooks System (onRequest, onError, etc)
- β Macro System for Auth/Rate Limiting
- β OpenAPI - Swagger Integration
// Error handling
.onError((err) => {
return Response.json({
error: err.message
}, { status: 500 })
})
// Rate limiting macro
.macro({
rateLimit: () => ({
resolve: async (ctx) => {
// Implement your logic
}
})
})
MIT License Β© 2025 Hedystia