> For AI agents: the complete documentation index is available at https://navios.tech/llms.txt, the full documentation bundle is available at https://navios.tech/llms-full.txt.

TypeScript · ES decorators · Standard Schema

# Type-safe APIs, end to end

Navios is a decorator-based framework for building modern APIs. Define an endpoint once and use it on the server and the client.

[Get started](/docs/server/)[View on GitHub](https://github.com/navios-org/navios)

$`npm install @navios/server@next @navios/adapter-fastify@next @navios/builder@next fastify zod`Copy

******

user.controller.ts

```typescript
@Controller()
export class UserController {
  private users = inject(UserService)

  @Endpoint(getUser)
  async getUser({ urlParams }: HandlerParams<typeof getUser>) {
    // urlParams and the return type come from the definition
    return this.users.find(urlParams.userId)
  }
}
```

## Why Navios?

A modern approach to building type-safe APIs with TypeScript

[### Shared API definitions

Define your API once with @navios/builder and use it on both client and server. No more type mismatches or manual syncing.

Client`getUser({ urlParams })`

Shared definition`@navios/builder`

Server`@Endpoint(getUser)`](/docs/builder/)[### Type-safe by design

Built with TypeScript from the ground up. Full type inference across your entire API, from endpoint definitions to response handling.

](/docs/builder/)[### Decorator-based architecture

Define modules, controllers, and endpoints with intuitive decorators. Clean, readable code that scales with your application.

](/docs/server/)[### Powerful DI container

Lightweight dependency injection with hierarchical containers, multiple scopes, and async resolution for clean architecture.

](/docs/di/)[### Schema validation

Validate requests and responses with Zod, Valibot, ArkType or any Standard Schema library. Types are inferred from your schemas.

](/docs/builder/)[### Adapter-agnostic

Run on Fastify or Bun with the same codebase. Switch runtimes without changing your application code.

FastifyBun](/docs/server/adapters/fastify)

## One definition, three places

Create type-safe API definitions that work on both client and server

******

1Define2Serve3Callshared/api.ts

```typescript
import { builder } from '@navios/builder'
import { z } from 'zod'

export const API = builder()

export const getUser = API.declareEndpoint({
  method: 'GET',
  url: '/users/$userId',
  responseSchema: z.object({
    id: z.string(),
    name: z.string(),
    email: z.string(),
  }),
})
```

## How Navios compares

See how Navios stacks up against other popular frameworks

| Feature | Navios | NestJS | Express |
| --- | --- | --- | --- |
| TypeScript native | Yes | Yes | No |
| Shared client/server types | Yes | No | No |
| ES decorators (TC39) | Yes | Legacy | No |
| Bun support | Yes | Limited | Yes |
| Built-in validation | Standard Schema | class-validator | No |
| Bundle size | Small | Large | Minimal |
| DI flexibility | Hierarchical | Module-bound | No |

## Pick your pieces

Core packages, adapters, and recipes to build your application

`@navios/server`[![@navios/server version](https://img.shields.io/npm/v/@navios/server?style=flat-square&color=ea580c)](https://www.npmjs.com/package/@navios/server)

HTTP server framework with decorators, modules, and controllers

[Read the docs →](/docs/server/)

`@navios/builder`[![@navios/builder version](https://img.shields.io/npm/v/@navios/builder?style=flat-square&color=ea580c)](https://www.npmjs.com/package/@navios/builder)

Type-safe API declarations shared between client and server

[Read the docs →](/docs/builder/)

`@navios/di`[![@navios/di version](https://img.shields.io/npm/v/@navios/di?style=flat-square&color=ea580c)](https://www.npmjs.com/package/@navios/di)

Lightweight dependency injection with hierarchical containers

[Read the docs →](/docs/di/)

### Adapters

[FastifyHigh-performance Node.js server](/docs/server/adapters/fastify)[BunNative Bun HTTP server](/docs/server/adapters/bun)

### Recipes

[JWT authJSON Web Token authentication](/docs/server/guides/authentication)[Scheduled tasksCron-based job scheduling](/docs/server/guides/scheduled-jobs)[Prisma ORMType-safe database access](/docs/server/guides/prisma)

## Start with one endpoint

Set up a server, declare an endpoint, and call it with full types in a few minutes.

[Get started](/docs/server/)[Explore Builder](/docs/builder/)