Welcome to Elysia

It's great to have you here! This playground is will help you get started with Elysia interactively.

Unlike traditional backend framework, Elysia can also run in a browser as well! Although it doesn't support all features, it's a perfect environment for learning and experimentation.

You can check out the API docs by clicking on the left sidebar.

What is Elysia

Elysia is an ergonomic framework for humans.

Ok, seriously, Elysia is a backend TypeScript framework that focuses on developer experience and performance.

What makes Elysia different from other frameworks is that:

  1. Spectacular performance comparable to Golang.
  2. Extraordinary TypeScript support with type soundness.
  3. Built around OpenAPI from the ground up.
  4. Offers End-to-end Type Safety like tRPC.
  5. Use Web Standard, allows you to run your code anywhere like Cloudflare Workers, Deno, Bun, Node.js and more.
  6. It is, of course, designed for humans first.

Although Elysia has some important concept but once get the hang of it, many people find it very enjoyable, and intuative to work with.

How to use this playground

Playground is divided into 3 sections:

  1. Documentation and task on the left side (you're reading).
  2. Code editor in the top right
  3. Preview, output, and console in the bottom right

Assignment

As for the first assignment, let's modify the code to make the server respond with "Hello Elysia!" instead of "Hello World!".

Feels free to look around the code editor and preview section to get familiar with the environment.

  1. Return "Hello Elysia!"

    Modify the code to make the server respond with "Hello Elysia!" instead of "Hello World!".

Show answer

You can change the response by changing the content inside the .get method from 'Hello World!' to 'Hello Elysia!'.

typescript
import { Elysia } from 'elysia'

new Elysia()
	.get('/', 'Hello World!') 
	.get('/', 'Hello Elysia!') 
	.listen(3000)

This would make Elysia response with "Hello Elysia!" when you access /.

  • index.ts

Error

Error: No Elysia server is running in index.ts
Did you forget to call `.listen()`?
    at parse (file:///opt/buildhome/repo/docs/.vitepress/.temp/utils.0aH03kD0.js:202:66)
    at file:///opt/buildhome/repo/docs/.vitepress/.temp/utils.0aH03kD0.js:240:30
    at new Promise (<anonymous>)
    at execute (file:///opt/buildhome/repo/docs/.vitepress/.temp/utils.0aH03kD0.js:238:49)
    at Proxy.run (file:///opt/buildhome/repo/docs/.vitepress/.temp/store.CRK6Gjr2.js:190:51)
    at Proxy.wrappedAction (file:///opt/buildhome/repo/node_modules/pinia/dist/pinia.mjs:1394:26)
    at setup (file:///opt/buildhome/repo/docs/.vitepress/.temp/playground.B0y8s6YZ.js:133:50)
    at playground_vue_vue_type_script_setup_true_lang_default.setup (file:///opt/buildhome/repo/docs/.vitepress/.temp/playground.B0y8s6YZ.js:438:22)
    at callWithErrorHandling (/opt/buildhome/repo/node_modules/@vue/runtime-core/dist/runtime-core.cjs.prod.js:86:19)
    at setupStatefulComponent (/opt/buildhome/repo/node_modules/@vue/runtime-core/dist/runtime-core.cjs.prod.js:6365:25)