Skip to content
GigadriveDocs

Elysia

What Gigadrive Network detects for an Elysia project, why it runs on the Bun runtime, and the defaults it applies.

Gigadrive Network detects Elysia from an elysia entry in the dependencies or devDependencies of your root package.json. It is the one preset that defaults to the Bun runtime, so a TypeScript entrypoint runs without a compile step.

Defaults

SettingValue
Runtimebun-1
Memory128 MB
Max duration30 seconds
Entrypointsrc/index.ts
Route/* to the entrypoint
EnvironmentNODE_ENV=production
Buildyour package.json build script

Elysia is detected ahead of Fastify and Express and behind Hono.

The bun-1 runtime is the preset's choice for the deployed Function and is independent of the package manager the build uses. That is picked from your packageManager field or your lockfile, so a project installed with pnpm still runs on Bun once deployed. Runtimes lists every runtime identifier you can set.

The entrypoint

The preset starts from src/index.ts and then resolves the real file from your project: main in package.json first, then the file argument of a plain node, bun run, tsx or ts-node start script, then src/index.ts and the usual index, app and server candidates.

Export the app itself. The Bun runtime reads fetch off the module or its default export and binds it to the object it came from, so an Elysia instance keeps its this and routes correctly rather than falling through to its own 404:

import { Elysia } from 'elysia';

const app = new Elysia().get('/', () => 'Hello Elysia');

export default app;

Each request arrives as a Web Request and your Response is returned as is. A fetch export is a handler rather than a server, so it cannot hold a socket: WebSocket upgrades are refused with 426 Upgrade Required. WebSockets covers which Functions accept them.

Changing the defaults

version: 4
functions:
  src/index.ts:
    runtime: bun-1
    memory: 256
    max_duration: 60

A functions block replaces every entrypoint the preset produced, and settings you leave out fall back to the config file's defaults of memory: 128, max_duration: 30 and runtime node-20. Repeat runtime: bun-1 or your Elysia app will be handed to Node.

Elysia documents its own API at elysiajs.com.