Skip to content

Mount

WinterTC is a standard for building HTTP servers behind Cloudflare, Deno, Vercel, and others.

It allows web servers to run interoperably across runtimes by using Request, and Response.

Elysia is WinterTC compliant. It is optimized to run on Bun, but also supports other runtimes if possible.

This allows any WinterTC-compliant framework or code to run together, allowing frameworks like Elysia, Hono, Remix, Itty Router to run together in a simple function.

Pass a fetch function to .mount:

import { Elysia } from 'elysia'
import { Hono } from 'hono'
const hono = new Hono()
.get('/', (c) => c.text('Hello from Hono!'))
const app = new Elysia()
.get('/', () => 'Hello from Elysia')
.mount('/hono', hono.fetch)

Any framework that uses Request and Response can interoperate with Elysia, like:

And these can be used on multiple runtimes like:

  • Bun
  • Deno
  • Vercel Edge Runtime
  • Cloudflare Worker
  • Netlify Edge Function

If the framework supports the .mount function, you can also mount Elysia inside another framework:

import { Elysia } from 'elysia'
import { Hono } from 'hono'
const elysia = new Elysia()
.get('/', () => 'Hello from Elysia inside Hono inside Elysia')
const hono = new Hono()
.get('/', (c) => c.text('Hello from Hono!'))
.mount('/elysia', elysia.fetch)
const main = new Elysia()
.get('/', () => 'Hello from Elysia')
.mount('/hono', hono.fetch)
.listen(3000)

The mounted app receives a standard Request and returns a Response. When composing two Elysia instances, prefer .use() so Elysia can preserve their types and plugin scopes.

Type to search the documentation.

    Up arrowDown arrow to navigateEnter to selectEscape to close