> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/zhcndoc/bun/llms.txt
> Use this file to discover all available pages before exploring further.

# Build an HTTP server with Elysia

> Use Elysia with Bun for type-safe APIs

Elysia is a fast and ergonomic web framework built specifically for Bun.

## Installation

```bash theme={null}
bun add elysia
```

## Basic Server

```typescript server.ts theme={null}
import { Elysia } from "elysia";

const app = new Elysia()
  .get("/", () => "Hello Elysia")
  .get("/json", () => ({ message: "Hello JSON" }))
  .listen(3000);

console.log(`Server running at http://localhost:${app.server?.port}`);
```

## Type-Safe Routes

```typescript theme={null}
import { Elysia, t } from "elysia";

new Elysia()
  .post("/user", ({ body }) => ({
    id: 1,
    ...body
  }), {
    body: t.Object({
      name: t.String(),
      email: t.String()
    })
  })
  .listen(3000);
```

<Card title="Elysia Documentation" icon="book" href="https://elysiajs.com">
  Learn more about Elysia
</Card>
