> 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.

# Navios Server

Navios Server is an HTTP framework for TypeScript built on one idea: an endpoint is declared once, with [`@navios/builder`](https://navios.tech/docs/builder/index.md), and the server implements that declaration. The route, the request validation, the response validation and the handler's types all come from it, and a client can call the same declaration with the same types.

```ts
import { Controller, Endpoint, inject, reply } from '@navios/server'

import type { HandlerParams } from '@navios/server'

// getUser and UsersService come from the Quick start
@Controller()
export class UsersController {
  private readonly users = inject(UsersService)

  @Endpoint(getUser)
  async getUser({ urlParams }: HandlerParams<typeof getUser>) {
    return this.users.findById(urlParams.userId) ?? reply(404, { message: 'User not found' })
  }
}
```

Return a user without `email`, or answer with a status the declaration does not list, and the controller stops compiling.

## What it does

- **Typed handlers.** Parameters, return values and status codes are checked against the declaration at compile time, and validated again at run time.
- **Any schema library.** Every schema slot accepts a [Standard Schema](https://standardschema.dev): Zod, Valibot, ArkType and others. These docs use Zod in examples.
- **Standard decorators.** Navios uses TC39 decorators, the kind TypeScript compiles without `experimentalDecorators` and Bun runs natively.
- **Adapters.** The HTTP server is Fastify on Node.js or `Bun.serve` on Bun. Application code is the same on both.
- **Singletons by default.** Controllers, guards and interceptors are created once at start-up. Per-request data travels in a typed request context, so nothing is constructed per request unless you ask for it.
- **One error format.** Every error response the framework produces is `application/problem+json`, unless the endpoint declares its own body for that status.
- **Dependency injection.** Services are wired by [`@navios/di`](https://navios.tech/docs/di/index.md), which `@navios/server` re-exports.

## Packages

| Package                   | What it is                                                                                         |
| ------------------------- | -------------------------------------------------------------------------------------------------- |
| `@navios/server`          | The framework: controllers, modules, guards, interceptors, errors, config, logger                  |
| `@navios/builder`         | Endpoint declarations, shared with clients                                                         |
| `@navios/adapter-fastify` | [Fastify adapter](https://navios.tech/docs/server/adapters/fastify.md) for Node.js                 |
| `@navios/adapter-bun`     | [Bun adapter](https://navios.tech/docs/server/adapters/bun.md)                                     |
| `@navios/adapter-xml`     | [XML responses](https://navios.tech/docs/server/adapters/xml.md) written as JSX                    |
| `@navios/jwt`             | [Signing and verifying JSON Web Tokens](https://navios.tech/docs/server/guides/authentication.md)  |
| `@navios/schedule`        | [Cron jobs](https://navios.tech/docs/server/guides/scheduled-jobs.md)                              |
| `@navios/microservice`    | [Message handlers](https://navios.tech/docs/server/guides/other-transports.md#messages) on a queue |
| `@navios/openapi`         | [An OpenAPI document](https://navios.tech/docs/server/guides/openapi.md) generated from the routes |
| `@navios/otel`            | [OpenTelemetry](https://navios.tech/docs/server/opentelemetry/index.md) traces and metrics         |

An application needs `@navios/server`, `@navios/builder` and one adapter. The rest are optional. They run on Node.js 24 or newer, and on Bun 1.4.5 or newer.

## Who it is for

Navios Server fits a team that writes both sides of an API in TypeScript and wants a change to the contract to be a compile error on each side. It also works as a plain server framework: the declarations are useful on their own as the single description of every route, and they feed the OpenAPI document.

If you come from NestJS, the vocabulary is familiar (modules, controllers, guards, interceptors, injectable services) and the differences are listed in [Migrating from NestJS](https://navios.tech/docs/server/reference/migrating-from-nestjs.md).

## Where to go

| You want to…                                 | Read                                                                                                            |
| -------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
| get a server running                         | [Quick start](https://navios.tech/docs/server/quick-start.md)                                                   |
| see what happens to a request, in order      | [How a request is handled](https://navios.tech/docs/server/request-lifecycle.md)                                |
| learn the everyday API in order              | Essentials, starting with [Controllers and handlers](https://navios.tech/docs/server/essentials/controllers.md) |
| declare endpoints                            | [Declaring endpoints](https://navios.tech/docs/builder/essentials/endpoints.md) in the Builder docs             |
| share declarations between client and server | [Sharing with Navios Server](https://navios.tech/docs/builder/guides/navios-server.md)                          |
| authenticate requests                        | [Authentication with JWT](https://navios.tech/docs/server/guides/authentication.md)                             |
| test an application                          | [Testing](https://navios.tech/docs/server/essentials/testing.md)                                                |
| upgrade from 1.x                             | [Migrating to 2.0](https://navios.tech/docs/server/reference/migrating-to-2.md)                                 |
