HOW ELYSIA
ACTUALLY WORKS
Ergonomic framework for humans. The fastest TypeScript framework built for Bun. Conventions, patterns, and architecture extracted from the elysiajs/elysia repository by sourcebook.
WHAT_MATTERS
-
→
This is a publishable library — focus on public API surface, avoid breaking exported types
-
→
src/types.ts is a hub file (imported by 17 files) — changes here ripple everywhere
-
→
Uses custom error classes — throw specific error types instead of generic Error
KEY_FINDINGS
Source code lives in src/ but some code files exist at the root. Keep application code in src/.
HIGHThis is a publishable library, not an application. Focus changes on the public API surface.
HIGHProject uses barrel exports (index.ts files that re-export). Import from the directory, not from deep paths.
HIGH3 barrel export files found
Project uses custom error classes. Throw specific error types instead of generic Error.
HIGHUses TypeBox (@sinclair/typebox) for validation via Elysia's t schema builder.
HIGHTypeBox-based type system via Elysia's t schema builder
Hub files (most depended on): src/types.ts (imported by 17 files); src/utils.ts (imported by 14 files); src/context.ts (imported by 12 files); src/cookies.ts (imported by 11 files); src/error.ts (imported by 11 files). Changes here have the widest blast radius.
HIGHCircular import chains detected: sucrose.ts → utils.ts; context.ts → server.ts → types.ts → index.ts; error.ts → schema.ts → index.ts. Avoid adding to these cycles.
HIGH3 dead code candidates: build.ts, src/formats.ts, src/universal/request.ts.
HIGH