TypeScript 281 FILES 8 FINDINGS

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.

QUICK_REF:
Validation: TypeBox schemas Error handling: Custom error classes

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/.

HIGH

This is a publishable library, not an application. Focus changes on the public API surface.

HIGH

Project uses barrel exports (index.ts files that re-export). Import from the directory, not from deep paths.

HIGH
3 barrel export files found

Project uses custom error classes. Throw specific error types instead of generic Error.

HIGH

Uses TypeBox (@sinclair/typebox) for validation via Elysia's t schema builder.

HIGH
TypeBox-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.

HIGH

Circular 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.

HIGH

3 dead code candidates: build.ts, src/formats.ts, src/universal/request.ts.

HIGH
GENERATED IN ~3 SECONDS WITH

npx sourcebook init

VIEW ON GITHUB star

FROM_THE_BLOG

RELATED_REPOS