Nitro Module
Deploy Taser.js with @taserjs/plugin/nitro — standalone or fullstack Nitro handlers across edge and serverless presets.
The @taserjs/plugin/nitro package connects Taser.js to the Nitro server engine so you can deploy to Cloudflare Workers, Vercel, AWS Lambda, Bun, Deno, or Node with the same route tree.
Setup & Usage
1. Via Vite (vite.config.ts)
Chain taser() and nitro():
import { defineConfig } from "vite";
import { nitro } from "nitro/vite";
import { taser } from "@taserjs/plugin/vite";
export default defineConfig({
plugins: [taser(), nitro()],
});Nitro detects the Vite plugin and applies Taser.js lifecycle hooks. Keep paths in taserjs.config.ts.
2. Standalone nitro.config.ts
For a pure Nitro project, register the Nitro module:
import { defineConfig } from "nitro/config";
import { taser } from "@taserjs/plugin/nitro";
export default defineConfig({
modules: [taser()],
preset: "node-server",
});Operational Modes
Controlled by standalone on the plugin options (automatically defaults to false when a fullstack framework like TanStack Start, Nuxt, Astro, SvelteKit, or Remix is detected, or true in a plain standalone Nitro project):
1. Standalone Mode (standalone: true, Default for plain Nitro)
Taser.js owns request dispatch:
import { defineConfig } from "nitro/config";
import { taser } from "@taserjs/plugin/nitro";
export default defineConfig({
modules: [
taser({
standalone: true,
}),
],
});2. Fullstack / Module Mode (standalone: false, Automatic when Framework Detected)
Taser.js registers as a Nitro handler alongside existing server routes. Mount the URL prefix with defineTaser().basePath("/api") so only matching paths hit Taser.js:
import { defineConfig } from "nitro/config";
import { taser } from "@taserjs/plugin/nitro";
export default defineConfig({
modules: [
taser({
standalone: false,
config: "./taserjs.config.ts",
}),
],
});Module Options
Shared with other @taserjs/plugin adapters (TaserPluginOptions):
Prop
Type
Path and mount options
serverDir and routesDir live in taserjs.config.ts. Runtime URL prefixes use
defineTaser().basePath(...); clients use baseUrl.