@truxie/nitro

Nitro adapter for truxie — controller dispatcher and handler utilities
1,077
Install
npm install @truxie/nitro
Latest Version:0.1.3
License:MIT
Last Updated:Oct 15, 2026
Links: npm
Maintainer: vtdev

@truxie/nitro

Mount a truxie application inside Nitro / h3 — Nuxt server routes, or Nitro on its own.

npm install @truxie/nitro
// server/api/[...].ts
import {createControllerDispatcher} from '@truxie/nitro'
import {app} from '~/server/app'

export default createControllerDispatcher({app})

One catch-all handler serves every @Controller route, and every @WebSocketGateway upgrade on the same path — crossws peers are adapted to truxie's WsPeer, so a gateway is portable between adapters.

What it does

matchRoute, then the application's pipeline: middlewares → guards → pipes → interceptors → handler → filters. Body parsing goes through h3 (so urlencoded bodies decode), with @RawBody() and @FormData() honoured when the handler asks for them. A malformed JSON body is reported as a 400 rather than arriving as an empty object.

A returned Response is passed through, a redirect() becomes sendRedirect, and a status recorded by a filter is applied with setResponseStatus.

One handler, without a controller

For a single endpoint that does not want a controller class:

export default defineHandler(app, {guards: [AuthGuard]}, async ctx => {
  return {ok: true}
})

It runs the same pipeline, including the application's global guards and filters.

MIT.

Related Packages

@danceroutine/tango-adapters-nuxt

Nuxt Nitro adapter for Tango viewsets

6,130 2
@iga-pages/nuxt

IGA Pages adapter module for Nuxt

1,005
@objectstack/nuxt

Nuxt adapter for ObjectStack — Nitro server routes for the ObjectStack REST API.

12,329 76
@jfungus/ratelimit-h3

H3/Nitro middleware for @jfungus/ratelimit

505 9
@drzl/generator-h3

Generate h3 and Nitro route handlers from a Drizzle schema, one module per table...

1,641 110

Version History

Version Released License
0.1.3 MIT
0.1.2 MIT
0.1.1 MIT
Pre-releases (1)
Version Released License
0.1.0-test.6 MIT