Native Fetch Frameworks
Run Taser alongside any Web Standard or Fetch-native host framework (Hono, Elysia, HatTip, or native Web Fetch handlers) using host pass-through dispatching.
Taser is built entirely on Web Standard Request and Response interfaces. Using the Host Pass-Through Architecture, you can pair Taser's file-based routing and cascading type safety with any Web Standard / Fetch-native framework or existing fetch handler.
Supported Fetch-Native Hosts
Because Taser evaluates standard Web Request objects, any framework or library exposing a standard .fetch(request) interface or { fetch: (req: Request) => Response | Promise<Response> } handler is supported out of the box:
- Hono: Ultra-fast web standard framework for Node, Bun, Deno, and Cloudflare.
- Elysia: Ergonomic, type-safe web framework for Bun.
- HatTip: Minimalist set of modular web-standard packages.
- Itty Router: Tiny router for JavaScript environments.
- Pure Web Standard Fetch: Any plain function receiving
Requestand returningResponse.
How Host Pass-Through Works
When an incoming HTTP request reaches your server:
- Taser Route Check: If the URL matches a file route in
src/routes/, Taser dispatches the request with complete compile-time type safety. - Host App Pass-Through: If no Taser route matches, the request falls through directly to your exported application in
src/server.ts. - 404 Not Found: If neither Taser nor the host framework handles the request, Taser returns a standard 404 response.
[Incoming Request]
│
▼
[Taser File Routes] ── Match? ──► [Execute Taser Route Handler]
│ (No match)
▼
[Fetch Host App] ───── Match? ──► [Execute Host App (Hono / Elysia / Web Fetch)]
│ (No match)
▼
[404 Not Found]Quickstart
1. Configure src/server.ts
Create src/server.ts exporting your preferred Fetch-native application:
import { Hono } from "hono";
const app = new Hono();
// Existing or custom Hono endpoints:
app.get("/host-info", (c) => {
return c.json({ framework: "Hono", status: "online" });
});
export default app;2. Add Taser Routes
Create file-based routes inside src/routes/:
import { json } from "@taserjs/router/reply";
import { t } from "@taserjs/router";
const GET = t.get("/users");
export default GET.handler(() => {
return json({ users: ["Alice", "Bob"] });
});3. Start Development Server
pnpm devGET http://localhost:3000/usersis dispatched through Taser file routing.GET http://localhost:3000/host-infois handled by your exported host application.
Reusing Web Standard Middleware in Taser
Using the honoMw() helper, you can adapt any native Web Standard and Fetch-native middleware function into Taser:
import { middleware, honoMw, t } from "@taserjs/router";
import { secureHeaders } from "hono/secure-headers";
// Wrap any Web Standard middleware seamlessly using honoMw()
const securityHeadersMiddleware = middleware(honoMw(secureHeaders()));
export default t.layout("/*").use(securityHeadersMiddleware);Next Steps
Standalone API
Build standalone, zero-host HTTP APIs with pure Taser, Vite, and Nitro. Maximum throughput, zero boilerplate, and web-standard Request/Response execution.
Express Integration
Add Taser file-based routing to an Express application. Coexist with legacy controllers and middleware using the host pass-through architecture.