Elysia is a Bun-first web framework built around TypeBox for end-to-end type safety. Its plugin system propagates types across the application, derive() adds typed computed context, and Eden Treaty generates a fully typed client from the server's type definition without code generation.
0 / 5 completed
1 / 5
What is Elysia's type system built on, and what makes it unique among Node.js/Bun frameworks?
Elysia is built on TypeBox, a library that generates both JSON Schema (for runtime validation) and TypeScript types from the same definition. This means route parameters, request bodies, and responses are validated at runtime AND typed at compile time with zero duplication.
2 / 5
A developer uses t.Object({ name: t.String(), age: t.Number() }) in an Elysia route body schema. What does t refer to?
In Elysia, t is TypeBox's type builder, re-exported from the elysia package for convenience. t.Object(), t.String(), t.Number(), etc. create TypeBox schemas that simultaneously define the JSON Schema for validation and the TypeScript type for inference.
3 / 5
What is an Elysia plugin and how does it affect the type system?
Elysia plugins are functions that receive an Elysia instance and return a modified instance with new routes, decorators, derived state, or lifecycle hooks. Elysia uses TypeScript type merging to propagate the plugin's types into the parent app, so all additions are fully typed end-to-end.
4 / 5
A developer uses app.derive(({ headers }) => ({ user: parseJWT(headers.authorization) })) in Elysia. What does derive do?
.derive() in Elysia adds computed properties to the request context that are available in all downstream handlers. Elysia infers the return type of the derive callback and makes it available as a typed property on the context object, enabling type-safe dependency-like patterns.
5 / 5
What does Elysia's Eden Treaty client provide when used with a TypeScript frontend?
Eden Treaty is Elysia's end-to-end type safety client. By importing the Elysia app type and passing it to treaty(), the client gets fully inferred TypeScript types for all API calls — request bodies, path parameters, and response shapes — without any code generation step.