https://github.com/hedystia/hedystia
end to end type safe framework
https://github.com/hedystia/hedystia
api backend bun framework hedystia server type-safe typescript web
Last synced: about 1 month ago
JSON representation
end to end type safe framework
- Host: GitHub
- URL: https://github.com/hedystia/hedystia
- Owner: Hedystia
- License: mit
- Created: 2025-04-13T03:36:36.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2026-03-28T23:46:08.000Z (3 months ago)
- Last Synced: 2026-04-03T00:28:33.575Z (3 months ago)
- Topics: api, backend, bun, framework, hedystia, server, type-safe, typescript, web
- Language: TypeScript
- Homepage: https://docs.hedystia.com
- Size: 843 KB
- Stars: 19
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
## 📦 Packages
| Package | npm | Description |
|---------|-----|-------------|
| [`hedystia`](./Packages/server) | [](https://www.npmjs.com/package/hedystia) | Core HTTP server framework with full type safety, WebSocket, SSE, middleware, hooks and macros |
| [`@hedystia/validations`](./Packages/validations) | [](https://www.npmjs.com/package/@hedystia/validations) | Schema validation system — Standard Schema v1 compliant, interoperable with Zod, ArkType, etc. |
| [`@hedystia/db`](./Packages/database) | [](https://www.npmjs.com/package/@hedystia/db) | Type-safe ORM with schema-first design, migrations, caching, and multi-driver support (MySQL, SQLite, S3) |
| [`@hedystia/view`](./Packages/view) | [](https://www.npmjs.com/package/@hedystia/view) | Reactive UI engine — fine-grained signals, no Virtual DOM, JSX, SSR, and control flow primitives |
| [`@hedystia/client`](./Packages/client) | [](https://www.npmjs.com/package/@hedystia/client) | Auto-generated type-safe HTTP client with path chaining, SSE and WebSocket support |
| [`@hedystia/adapter`](./Packages/adapter) | [](https://www.npmjs.com/package/@hedystia/adapter) | Multi-runtime adapters — Cloudflare Workers, Node.js, Deno, Lambda, Vercel, Fastly Compute |
| [`@hedystia/swagger`](./Packages/swagger) | [](https://www.npmjs.com/package/@hedystia/swagger) | OpenAPI/Swagger documentation auto-generated from your routes |
| [`@hedystia/types`](./Packages/types) | [](https://www.npmjs.com/package/@hedystia/types) | Route type generation utility for end-to-end type safety |
| [`@hedystia/ws`](./Packages/websocket) | [](https://www.npmjs.com/package/@hedystia/ws) | Universal WebSocket primitives — server, client, runtime detection |
### Integrations
| Package | npm | Description |
|---------|-----|-------------|
| [`@hedystia/astro`](./Packages/integrations/view/astro) | [](https://www.npmjs.com/package/@hedystia/astro) | Astro integration for `@hedystia/view` components |
| [`@hedystia/better-auth`](./Packages/integrations/database/better-auth) | [](https://www.npmjs.com/package/@hedystia/better-auth) | Better Auth adapter for `@hedystia/db` |
## 🚀 Quick Start
### Server
```bash
bun add hedystia
```
```typescript
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);
```
### Type-safe Client
```bash
bun add @hedystia/client
```
```typescript
import { createClient } from "@hedystia/client";
const client = createClient("http://localhost:3000");
const { data } = await client.hello.name("World").get();
console.log(data); // "Hello World!"
```
### Database (ORM)
```bash
bun add @hedystia/db
```
```typescript
import { table, integer, varchar, text } from "@hedystia/db";
// Define your schema
const users = table("example_users", {
id: integer().primaryKey().autoIncrement(),
fullName: varchar(255).name("full_name").notNull(),
email: varchar(255).unique(),
});
const posts = table("example_posts", {
id: integer().primaryKey().autoIncrement(),
authorId: integer().name("author_id").references(() => users.id),
title: varchar(255).notNull(),
body: text(),
});
```
```typescript
import { database } from "@hedystia/db";
import { users, posts } from "./schema";
// Initialize with object schema (recommended)
const db = database({
schemas: { users, posts },
database: "sqlite",
connection: { filename: "./main.db" },
syncSchemas: true, // Auto-create tables in development
});
await db.initialize();
// Query data
const newUser = await db.users.insert({
fullName: "Alice Vance",
email: "alice@hedystia.com"
});
const userWithPosts = await db.users.findFirst({
where: { fullName: "Alice Vance" },
with: { posts: true }
});
```
### Reactive UI (View)
```bash
bun add @hedystia/view
```
Configure your `tsconfig.json`:
```json
{
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "@hedystia/view"
}
}
```
```tsx
import { sig, val, set, mount } from "@hedystia/view";
function Counter() {
const count = sig(0);
return (
Counter: {() => val(count)}
set(count, val(count) + 1)}>+
);
}
mount(Counter, document.getElementById("root")!);
```
> Components run **once**. Reactivity comes from wrapping signal reads in `() => ...` accessors.
### Validations
```bash
bun add @hedystia/validations
```
```typescript
import { h, Infer } from "@hedystia/validations";
const userSchema = h.object({
id: h.number(),
name: h.string(),
email: h.string().email(),
tags: h.string().array().optional()
});
// Type inference
type User = Infer;
/*
{
id: number;
name: string;
email: string;
tags?: string[] | undefined;
}
*/
// Standard Schema v1 compliant — works with Zod, ArkType, etc.
```
### Swagger
```typescript
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));
```
### Multi-runtime Adapters
```typescript
import { adapter } from "@hedystia/adapter";
// Deploy anywhere
adapter(app).toCloudflareWorker();
adapter(app).toNodeHandler();
adapter(app).toDeno();
adapter(app).toLambda();
adapter(app).toVercel();
adapter(app).toFastlyCompute();
```
## 📜 License
MIT License © 2026 Hedystia
## 📖 Documentation
- [Full Documentation](https://docs.hedystia.com)
- [Getting Started Guide](https://docs.hedystia.com/framework/getting-started)
- [API Reference](https://docs.hedystia.com/framework/overview)
## 🗣️ Community
- [GitHub Issues](https://github.com/Hedystia/Hedystia/issues)
- [Discord Server](https://hedystia.com/support)