CLI & Type Generation
Generate src/.taserjs/routes.gen.ts, scaffold empty route files, and run standalone typechecks with @taserjs/cli.
The @taserjs/cli package provides the taser binary. Use it to scan routes, scaffold blank files, and write the unified manifest at src/.taserjs/routes.gen.ts without running a development server.
Installation
Install as a development dependency:
bash pnpm add -D @taserjs/cli Project Config (taserjs.config.ts)
Most projects define paths once with defineConfig from @taserjs/cli:
import { defineConfig } from "@taserjs/cli";
export default defineConfig({
serverDir: "src",
routesDir: "routes",
outputDir: ".taserjs",
app: "taser.ts",
});With those defaults, routes live in src/routes/, the app definition is src/taser.ts, and generation writes src/.taserjs/routes.gen.ts.
Prop
Type
taser generate
Scans the routes directory, scaffolds blank route files with filesystem-synced path strings, and writes ${serverDir}/${outputDir}/routes.gen.ts (default src/.taserjs/routes.gen.ts): compiled app, ambient route types, and the composite AppManifest for @taserjs/client.
# In package.json scripts (when installed as a dev dependency)
taser generate [--config <path>] [--watch]
# On-demand via npx
npx @taserjs/cli generate [--config <path>] [--watch]Prop
Type
Binary name
The npm package is @taserjs/cli; the executable is taser.
Scaffolding blank files
Empty route files (for example after touch src/routes/admin/users.get.ts) are filled with starter boilerplate and the matching path string. Existing non-empty files are never overwritten.
import { json } from "@taserjs/router/reply";
import { t } from "@taserjs/router";
const GET = t.get("/admin/users");
export type RouteContext = Parameters<typeof GET.handler>[0];
export default GET.handler(() => {
return json({ ok: true });
});Build vs. Standalone Typecheck
Bundler plugins (vite build, next build) generate the manifest during compilation — you do not need a separate CLI step in those pipelines.
For standalone tsc --noEmit in CI or pre-commit hooks, generate first:
{
"scripts": {
"dev": "vite",
"build": "vite build",
"typecheck": "taser generate && tsc --noEmit"
}
}Next Steps
Typed Client SDK
Connect to Taser.js backends with end-to-end type safety using @taserjs/client. Enjoy autocomplete for routes, query schemas, and return types.
@taserjs/router
Complete API reference for @taserjs/router: createTaserApp, createContext, fluent RouteBuilder chaining, reply helpers, and core types.