This guide covers migration between major versions of Elysia. Always review the full changelog before upgrading.
Migrating to Elysia 1.4
Elysia 1.4 introduces several improvements focused on security, performance, and developer experience.Breaking changes
No breaking changes were introduced in 1.4. This is a backward-compatible release.Key improvements
Enhanced security
Multiple security improvements were added:
- Cookie prototype pollution prevention
- Constant-time comparison for signed cookie verification
- Cookie injection and RCE prevention
- Reject invalid cookie signatures when using cookie rotation
Recommended updates
Update your dependencies:@types/bun, ensure compatibility:
Migrating to Elysia 1.3
Elysia 1.3 introduced significant performance improvements and new features.Breaking changes
Removed as('plugin') in favor of as('scoped')
Removed as('plugin') in favor of as('scoped')
The
as('plugin') method has been removed. Use as('scoped') instead.Removed root index for Eden Treaty
Removed root index for Eden Treaty
The root index path has been removed from Eden Treaty type generation.If you were relying on this, update your client code accordingly.
Removed inference.request
Removed inference.request
The
inference.request configuration option has been removed.Major features
Bun System Router
Enable native Bun routing for better performance:
System Router is automatically enabled when using Bun 1.2.14 or later.
Performance improvements
Elysia 1.3 includes numerous performance optimizations:- Reduced type checking overhead with AOT compilation
- Optimized memory usage on route registration (~36% reduction)
- Improved startup time with multiple routes
- Dynamic cookie validator creation during compilation
- Optimized query parsing with
parseQueryFromURL
Migrating to Elysia 1.2
Elysia 1.2 brought universal runtime support and improved WebSocket handling.Breaking changes
Universal Runtime Support
Elysia 1.2 introduces adapters for multiple runtimes:Macro improvements
Macros now support resolve functionality:Migrating to Elysia 1.1
Elysia 1.1 introduced Trace v2 and improved type coercion.Breaking changes
Query parsing as string by default
Query parsing as string by default
Query parameters are now parsed as
string instead of string | string[] unless explicitly specified.onResponse renamed to onAfterResponse
onResponse renamed to onAfterResponse
The lifecycle hook has been renamed for clarity:
New features
Optional path parameters
Define optional segments in your routes:
Generator response streams
Stream responses using generators:
Data type coercion
Automatic type coercion for common types:
Trace v2
Enhanced tracing capabilities:
Migrating to Elysia 1.0
Elysia 1.0 was the first stable release with significant API changes from 0.x versions.Major changes from 0.x
Macro v1 removed
The original macro API has been completely redesigned. Review the macro documentation for the new API.
ObjectString/ArrayString security
Default values are no longer produced automatically for security reasons:
Version compatibility
Elysia follows semantic versioning:| Version | Bun Version | TypeScript | Status |
|---|---|---|---|
| 1.4.x | >= 1.2.0 | >= 5.0 | Current |
| 1.3.x | >= 1.2.0 | >= 5.0 | Supported |
| 1.2.x | >= 1.0.0 | >= 5.0 | Supported |
| 1.1.x | >= 1.0.0 | >= 5.0 | Legacy |
| 1.0.x | >= 1.0.0 | >= 5.0 | Legacy |
Elysia is designed for Bun but supports other runtimes via adapters starting from version 1.2.
Getting help
If you encounter issues during migration:- Check the GitHub Issues
- Join the Discord community
- Review the full changelog