---
title: "Elysia 2 RC - またおいで"
description: "Elysia 2 RC is here after a year of development, with huge improvements to memory usage, type inference, and the lifecycle API, more control over macros, and the introduction of Eden Plugin and the new documentation."
url: "https://next.elysiajs.com/blog/elysia-20-rc/"
---

# Elysia 2 RC - またおいで

> Welcome back\~

After a year of development, Elysia 2 RC is finally here.

Elysia 2 is still named [DayDream](https://youtu.be/3qRd7Ok0NVY), but the development took a long time, and the improvements from beta to RC were big enough to could justtified as 2.1 so we decided honor this release with a name as well.

Elysia 2 RC is named after [またおいで (Please come again)](https://youtu.be/ezOrPwjaHZo) by South& to honor the improvements we’ve made.

We recommended reading the [beta release note](/blog/elysia-20) first, as this release builds upon it.

***

## Memory usage

First, Elysia 2 is about a better foundation.

We entirely rewrote Elysia to shift its focus from throughput alone to efficiency across all axes, starting with memory usage.

We invested in understanding the internal memory structures of JSC and V8 and how to optimize Elysia’s memory usage.

![Static Route Memory usage](/blog/elysia-20-rc/mem-static-route.webp) ![Dynamic Route Memory usage](/blog/elysia-20-rc/mem-dynamic-route.webp)

This means each route should use less memory than before. Even after a load test, peak memory shouldn’t increase as much and should stay close to its pre-test level.

![Return status Memory usage](/blog/elysia-20-rc/mem-return-status.webp) ![Set Headers Memory usage](/blog/elysia-20-rc/mem-set-headers.webp)

An actual codebase almost always uses `set.headers` and `status` on the response, so this improvement is relevant to real codebases.

![Inline Response Memory usage](/blog/elysia-20-rc/mem-inline-response.webp) ![Inline Guard Memory usage](/blog/elysia-20-rc/mem-inline-guard.webp)

This means that response schemas and guards use much less memory than before. This is relevant to a larger codebase rather than a “Hello World” test or benchmark.

You wouldn’t notice these improvements in a small “Hello World” demo benchmark. They become relevant in a real codebase, especially as the number of routes grows.

### Startup memory by route count

Here’s the measured startup memory usage for 25 and 400 routes.

Elysia 2

- No validator

  - 20/2425 routes: 20 MB; 400 routes: 24 MB
  -

- TypeBox

  - 31/3725 routes: 31 MB; 400 routes: 37 MB
  -

- Zod

  - 28/4425 routes: 28 MB; 400 routes: 44 MB
  -

Elysia 2 + AOT

- No validator

  - 19/2325 routes: 19 MB; 400 routes: 23 MB
  -

- TypeBox

  - 25/3525 routes: 25 MB; 400 routes: 35 MB
  -

- Zod

  - 28/4425 routes: 28 MB; 400 routes: 44 MB
  -

Hono

- No validator

  - 17/2325 routes: 17 MB; 400 routes: 23 MB
  -

- TypeBox

  - 33/4925 routes: 33 MB; 400 routes: 49 MB
  -

- Zod

  - 26/4325 routes: 26 MB; 400 routes: 43 MB
  -

H3

- No validator

  - 19/2525 routes: 19 MB; 400 routes: 25 MB
  -

- TypeBox

  - 31/4925 routes: 31 MB; 400 routes: 49 MB
  -

- Zod

  - 28/4525 routes: 28 MB; 400 routes: 45 MB
  -

Express

- No validator

  - 38/4225 routes: 38 MB; 400 routes: 42 MB
  -

- TypeBox

  - 44/6125 routes: 44 MB; 400 routes: 61 MB
  -

- Zod

  - 42/5825 routes: 42 MB; 400 routes: 58 MB
  -

Fastify

- No validator

  - 41/5125 routes: 41 MB; 400 routes: 51 MB
  -

- TypeBox

  - 65/10025 routes: 65 MB; 400 routes: 100 MB
  -

- Zod

  - 45/6725 routes: 45 MB; 400 routes: 67 MB
  -

Scroll horizontally to see all frameworks.

**No validator**TypeBox**Zod

Startup memory in MB. Values above each pair read 25/400 routes: the lighter left bar is 25 routes, and the stronger right bar is 400 routes. All bars share a 0–100 MB scale.

### Average memory usage per route

Here’s the average memory usage per route when scaling from 25 to 400 routes. The value is calculated by subtracting the 25-route measurement from the 400-route measurement, and then dividing by the 375 added routes.

Elysia 2

- No validator

  - 10.7 kB per route
  -

- TypeBox

  - 16 kB per route
  -

- Zod

  - 42.7 kB per route
  -

Elysia 2 + AOT

- No validator

  - 10.7 kB per route
  -

- TypeBox

  - 26.7 kB per route
  -

- Zod

  - 42.7 kB per route
  -

Hono

- No validator

  - 16 kB per route
  -

- TypeBox

  - 42.7 kB per route
  -

- Zod

  - 45.3 kB per route
  -

H3

- No validator

  - 16 kB per route
  -

- TypeBox

  - 48 kB per route
  -

- Zod

  - 45.3 kB per route
  -

Express

- No validator

  - 10.7 kB per route
  -

- TypeBox

  - 45.3 kB per route
  -

- Zod

  - 42.7 kB per route
  -

Fastify

- No validator

  - 26.7 kB per route
  -

- TypeBox

  - 93.3 kB per route
  -

- Zod

  - 58.7 kB per route
  -

Scroll horizontally to see all frameworks.

**No validator**TypeBox**Zod

The change in startup memory from 25 to 400 routes, divided by the 375 added routes, shown in decimal kB per route (1 MB = 1,000 kB). Subtracting the 25-route measurement largely removes the fixed startup footprint. **Lower is better.**

Because Elysia 2 includes a JIT and static code analysis, its bundle size is larger than Hono’s and h3’s, so it has a larger fixed startup footprint.

But as the route count increases, Elysia 2 should be one of the most memory-efficient frameworks.

***

## Throughput

It wouldn’t be Elysia if we didn’t improve throughput. Elysia 2 RC is still the fastest framework on Bun and very close to Fastify on Node.js.

[](/blog/elysia-20-rc/throughput.mp4)

See [HTTP Benchmark](https://github.com/SaltyAom/bun-http-framework-benchmark/tree/ebc9d5e7dcd1a1786ac77d77e8a2f1a84b026038) for the latest benchmark.

### Memory usage after load test

Even after a load test, Elysia 2’s peak memory usage is still very low and predictable compared to other frameworks.

**Before**After

1. ElysiaBun

   **42.2 MB****53.5 MB**

2. h3Bun

   **38.6 MB****55 MB**

3. HonoBun

   **38.6 MB****55 MB**

4. EffectBun

   **52.9 MB****81.4 MB**

5. ElysiaNode

   **109.4 MB****178.1 MB**

6. ExpressBun

   **69 MB****183.9 MB**

7. EffectNode

   **109.9 MB****190.5 MB**

8. h3Node

   **101.5 MB****202.7 MB**

9. AdonisNode

   **122.6 MB****216.8 MB**

10. KoaNode

    **111.6 MB****217.4 MB**

11. NestNode

    **135.4 MB****221.7 MB**

12. HonoNode

    **114.5 MB****226 MB**

13. FastifyNode

    **110.6 MB****226.5 MB**

14. ExpressNode

    **104.3 MB****238.4 MB**

The chart shows server RSS for the frameworks in the throughput video. **Before** is measured after startup validation, and **After** is measured after all benchmark workloads.

We have improved validation and coercion latency when using an `Elysia.t` schema.

![validation-coercion-latency.webp](/blog/elysia-20-rc/validation-coercion-latency.webp)

***

## Deeper type inference

Previously, we optimized Elysia’s types to be as fast as possible within TypeScript’s limits, so we had to limit what Elysia could do to keep type-checking time reasonable.

But now that TypeScript 7 has been released with much faster inference, we can give Elysia 2 much deeper type inference while still being conscious of type-checking speed.

We have expanded type inference to cover more cases, especially in error handling.

![Elysia infer error from all possible type](/blog/elysia-20-rc/error-infer.webp)

Elysia can now statically infer all possible types from macros, lifecycle hooks, and inline hooks. Even error responses can be mapped or overridden and remain statically analyzable.

This makes it easy to identify all possible errors and makes Eden Treaty and OpenAPI type generation more useful, as they can now generate much more accurate types for error responses.

![OpenAPI type gen showing all possible error](/blog/elysia-20-rc/openapi.webp)

With OpenAPI type generation, you no longer have to manually annotate errors. It lists all possible errors that the route can throw and generates a proper OpenAPI spec for them.

This is what you would get from neverthrow or Effect.ts error handling, but with Elysia’s ergonomics.

See [Error Handling](/patterns/error-handling) to learn how to structure your code to make Elysia infer errors.

***

## Reverting breaking changes to the lifecycle API

Previously, in the beta, we renamed the lifecycle API to remove the `on` prefix. But after a lot of feedback, and to make migrating to Elysia 2 smoother, we decided to revert the lifecycle API to the original `on` prefix.

Now Elysia 1 plugins should just work with Elysia 2 without any modifications.

![Error hook](/blog/elysia-20-rc/error-hook.webp)

However, the two-parameter `onError` hook would be a breaking change.

***

## Custom macro types

We have a rule to reduce explicit types as much as possible by making Elysia infer them for you. But sometimes, the cases are too limited, and giving you complete control is better than trying to infer the types for you.

With Elysia 2, you can now annotate and control macro types explicitly.

![Macro Type](/blog/elysia-20-rc/macro-type.webp)

This is less ergonomic than we want, but it gives you more control. Consider it an opt-in advanced feature for type wizards and plugin developers.

See [Macro Type Lambda](/patterns/macro#type-lambda) for how to use it.

***

## Eden Plugin

Along with macro types, we are now introducing Eden Plugin with an explicit type.

![Eden Plugin](/blog/elysia-20-rc/eden-plugin.webp)

This lets you control the plugin’s type so you can add custom fields or create new extensions to Eden Treaty.

See [Eden Treaty Plugin](/eden/treaty/plugin/) for how to use it.

***

## Node.js improvements

Elysia is a Web Standard framework similar to Hono. This means Elysia should be able to run on any runtime that supports Web Standard APIs.

Because Node.js doesn’t provide a Web Standard HTTP server out of the box, we have to provide a compatibility layer to make Elysia run on Node.js, similar to other frameworks like h3, Hono, Next.js, Nuxt, and Astro.

We are now using `srvx` and `crossws` on Node.js, which also form the foundation of `h3`.

This allows Elysia to maintain good performance and stability on Node.js while still supporting Web Standard APIs.

[](/blog/elysia-20-rc/node.mp4)

***

## Compression plugin

We have added an officially maintained compression plugin to Elysia 2. It is a simple plugin that compresses the response body using gzip or brotli.

```ts
import { compress } from '@elysia/compress'

new Elysia()
  .use(compress())
```

It will use Bun’s fast path when possible and fall back to the runtime’s native compression.

See [Compression Plugin](/plugins/compress/) for more details.

***

## Stability

Elysia 2 RC was supposed to be released about two months ago. But because we wanted to make sure the release was stable and smooth, we decided to delay it for intensive testing.

The number of test cases has tripled since the beta release and is around 10 times what it was in 1.4, with several performance, memory-usage, and type-inference gates to make sure Elysia doesn’t regress in the future.

We developed Elysia 2 while integrating it with our internal servers to make sure it’s ready for production.

We are quite confident that Elysia 2 RC is stable and ready for production.

What you will see in Elysia 2 is not better performance, but much lower memory usage and startup times.

***

We recommend starting new projects with Elysia 2 RC and planning to migrate existing projects to Elysia 2 RC. The migration should be relatively easy with the codemod we provide:

Terminal window

```bash
bunx @elysia/codemod@latest
```

You can create a new project with Elysia 2 RC using:

Terminal window

```bash
bun create elysia app
cd app
bun add elysia@rc
```

We’ve also update Elysia skills for LLM with a much better structure. You can install/update the skill to the latest version with:

```plaintext
bunx skills add elysiajs/skills
```

***

## Documentation

This release also comes with a new documentation site (you are currently viewing it).

The new documentation is revised to be more beginner-friendly and updated for Elysia 2.

We have rewrite the entire from Vitepress to Astro Starlight for more control over what we can do with the documentation. We write a lot of new component like [lifecycle playground](/essential/life-cycle) with our in-house design language.

We recommend you checking it out from the [documentation home page](/). Many pages has been summarized and rewritten to be more beginner-friendly, and we have added several new content.

***

## Afterword

I have never thought that it would be so hard to create something over a year and not release it.

From the outside, Elysia must seem like it has been stale for a year, even though we have been working harder than on any other version of Elysia.

It’s hard not to rush it. I wake up every day wanting to release it.

This reminds me of the song [またおいで (Please come again)](https://youtu.be/ezOrPwjaHZo) by South&. The song is about waiting for someone to come back.

I know that there are a lot of people who have been waiting.

I want to quickly go home.

I want to say that I have been working so hard every day.

I want to say that I have come back.

I want to give you the embrace you deserve.

But the right time for that will come.

It might be a year from now but I’ll bring my memory back.

Until then, I’ll let you have a piece of me in your heart.

***

Coincidentally, Elysia 2 RC is ready just before the end of the rainy season here, as the song keeps repeating:

> “I’ll be back before the rainy season is over”

> Cover art for Elysia 2.0 RC\
> \
> As promise I will be here before rainy season over\
> \
> Please wait just a little while longer <https://t.co/Dt2FX2Qv3z>
>
> — SaltyAom (@saltyAom) [October 9, 2026](https://x.com/saltyAom/status/2108602528497893405?ref_src=twsrc%5Etfw)

This wouldn’t be possible without all the support from the community and our GitHub sponsors, especially Jarred Sumner (Bun). Their support allows us to work on Elysia full-time.

For you it might have been another software release but for me it’s a year of my life.

I hope you can feel the love and care I put into it.

> Please don’t cry, please don’t cry
>
> I’ll be back when the rainy season is over
>
> Please come again, please come again
>
> May the scent of hollyhocks guide you here

I’ll stay within your heart.

Thank you for waiting for Elysia 2 RC.

\- SaltyAom
