Nitro Module
Deploy Taser across edge, serverless, and multi-cloud runtimes using the @taserjs/router-plugin/nitro module with automatic route registration.
The @taserjs/router-plugin/nitro package connects Taser directly to the Nitro server engine. It allows you to package and deploy Taser APIs to any platform (Cloudflare Workers, Vercel, AWS Lambda, Bun, Deno, or standalone Node.js) with zero runtime overhead.
Setup & Usage
You can use Taser with Nitro in two ways:
1. Via Vite (vite.config.ts)
When building with Vite, simply chain taser() and nitro() together:
import { defineConfig } from "vite";
import { nitro } from "nitro/vite";
import { taser } from "@taserjs/router-plugin/vite";
export default defineConfig({
plugins: [taser(), nitro()],
});Nitro automatically detects the taser() plugin and activates its lifecycle hooks.
2. Standalone nitro.config.ts
If you are running a pure Nitro project without Vite, register taser() in the modules array:
import { defineConfig } from "nitro/config";
import { taser } from "@taserjs/router-plugin/nitro";
export default defineConfig({
modules: [taser()],
preset: "node-server",
});Operational Modes
The Nitro module supports two operational modes controlled by the standalone option:
1. Standalone Mode (standalone: true, Default)
In Standalone Mode, Taser replaces Nitro's internal router entirely. Requests are dispatched directly through Taser's radix tree with zero intermediate framework layers or overhead.
import { defineConfig } from "nitro/config";
import { taser } from "@taserjs/router-plugin/nitro";
export default defineConfig({
modules: [
taser({
standalone: true, // Default
}),
],
});2. Fullstack / Module Mode (standalone: false)
If you have an existing Nitro or Nuxt project with existing server handlers, setting standalone: false unshifts Taser onto Nitro's handler pipeline:
import { defineConfig } from "nitro/config";
import { taser } from "@taserjs/router-plugin/nitro";
export default defineConfig({
modules: [
taser({
standalone: false,
basePath: "/api",
}),
],
});In this mode, requests matching /api/** are handled by Taser, while other routes continue to execute through Nitro.
Module Options
Prop
Type