---
title: "End-to-end type safety"
description: "Elysia provides an end-to-end type safety between backend and frontend without code generation similar to tRPC, using Eden."
url: "https://next.elysiajs.com/tutorial/features/end-to-end-type-safety/"
---

# End-to-end type safety

Elysia provides an end-to-end type safety between backend and frontend **without code generation** similar to tRPC, using [Eden](/eden/).

```typescript
import { Elysia } from 'elysia'
import { treaty } from '@elysia/eden'

// Backend
export const app = new Elysia()
  .get('/', 'Hello Elysia!')
  .listen(3000)

// Frontend
const client = treaty<typeof app>('localhost:3000')

const { data, error } = await client.get()

console.log(data) // Hello Elysia!
```

This works by inferring the types from the Elysia instance, and uses type hints to provide type safety for the client.

See [Eden treaty](/eden/treaty/overview/).

## Assignment

Let’s click the  icon in the preview to see how’s the request is logged.
