A TypeScript ecosystem for your data, interfaces and APIs. Use the ORM, reactive UI, routing, caching and server packages independently, or combine them around shared types.
import { database, integer, table, varchar } from "@hedystia/db";
const users = table("users", {
id: integer().primaryKey().autoIncrement(),
name: varchar(80).notNull(),
});
const db = database({
schemas: { users },
database: "sqlite",
connection: { filename: "./app.db" },
syncSchemas: true,
});
await db.initialize();
await db.users.insert({ name: "Ada" });The Hedystia ecosystem
Start with a database, a reactive interface or an API. Each package has its own installation and guide, so you can adopt the ecosystem one piece at a time.
@hedystia/dbModel your data with typed schemas, relations, queries and migrations across SQL databases, local files and S3.
Read the guide@hedystia/viewBuild JSX interfaces with fine-grained signals, native DOM updates, static rendering and interactive islands.
Read the guidehedystiaBuild typed APIs with schema validation, request controls, middleware, WebSockets and SSE.
Read the guide@hedystia/routerConnect View pages with typed navigation, generated lazy routes, nested layouts, cached loaders and View Transitions.
Read the guide@hedystia/queryShare reactive requests, cache results and invalidate data after mutations, with independent cancellation.
Read the guide@hedystia/clientCall APIs with typed paths, request options and responses, including global schemas inherited through nested groups.
Read the guide@hedystia/validationsDefine reusable runtime schemas with TypeScript inference, async validation and Standard Schema support.
Read the guide@hedystia/wsUse portable server and client WebSocket primitives, topic subscriptions and native socket controls.
Read the guide@hedystia/cacheUse a standalone Map-based key-value store with convenient collection and cache utilities.
Read the guide@hedystia/astroRender View components as static HTML and hydrate only client-directed islands while preserving native DOM and slots.
Read the guide@hedystia/better-authConnect Better Auth to Hedystia database schemas, queries and storage drivers.
Read the guide@hedystia/adapterAdapt your API to Node.js streaming handlers, serverless functions and supported edge runtimes.
Read the guide@hedystia/swaggerGenerate API documentation from route schemas, retaining declared contracts and omitting absent schema sections.
Read the guide@hedystia/typesGenerate portable, compact route declarations in memory or on disk without unused schema placeholders.
Read the guideView updates native DOM nodes with signals. Router adds typed destinations and cached loaders. Render static HTML and activate interactive islands with Astro or standalone View builds.
import { sig, val, set } from "@hedystia/view";
export default function Counter() {
const count = sig(0);
return (
<button onClick={() => set(count, val(count) + 1)}>
Count: {() => val(count)}
</button>
);
}import { createRoute, createRouter } from "@hedystia/router";
const user = createRoute("/users/$id", {
loader: ({ params }) => ({ name: params.id }),
component: ({ data }) => <h1>{() => data().name}</h1>,
});
const router = createRouter({
routes: [user],
viewTransitions: true,
});
router.mount(document.getElementById("app")!);
await router.navigate({
to: "/users/$id",
params: { id: "Ada" },
});Define API contracts once and carry them into your HTTP client. Add the ORM, reactive UI and application tools where you need them.
import { Hedystia, h } from "hedystia";
export const app = new Hedystia().post(
"/users",
({ body }) => ({ id: 1, name: body.name }),
{
body: h.object({ name: h.string() }),
response: h.object({
id: h.number(),
name: h.string(),
}),
},
);
app.listen(3000);import { createClient } from "@hedystia/client";
import type { app } from "./server";
const client = createClient<typeof app>("http://localhost:3000");
const { data, error } = await client.users.post({
body: { name: "Ada" },
});Trusted By & Contributors