codediag
Which of your API routes can anyone call?
Auth and validation coverage for Next.js, SvelteKit, React Router, Express,
Fastify, Hono, Elysia, NestJS, and tRPC, plus security, dependency, test,
and structure checks. One command, no account, runs offline.
Install
npx @sabahattink/codediag scan .
That's it. Configuration is optional, no account or server is required, and
--no-audit keeps the scan fully offline.
Or install globally — this also puts the codediag command on your PATH,
which every other example below assumes:
npm install -g @sabahattink/codediag
Package name note: published as @sabahattink/codediag while ownership
of the legacy codediag name on npm is transferred. The CLI binary is still
codediag after install. A migration announcement will follow if/when the
unscoped name becomes available again.
What it checks
codediag auto-detects your stack and runs 5 analyzers. Every finding has a
stable rule ID (rule reference), a severity, a location when
one exists, and a suggested fix.
API Health NestJS · Express · Fastify · Hono · Elysia · Next.js · SvelteKit · React Router · tRPC
AST analysis (ts-morph, not regex) of the routes your app actually exposes.
- NestJS: auth guards, including global guards (
useGlobalGuards,
APP_GUARD), custom UseGuards-based decorators, and @Public()-style
opt-outs; DTO classes for request bodies (not any, Record, or
interfaces) and whether a ValidationPipe enforces them; Swagger docs and
return types.
- Express: routers resolved from
express(), Router(), and typed
parameters; auth and validation middleware on routes, earlier
router.use() calls, and app.use(path, mw, router) mounts across files;
centralized error handling and health endpoints.
- Fastify: routes from
fastify.get() and fastify.route(), followed
through register()-ed plugins, fastify-plugin encapsulation, and
@fastify/autoload directories (directory prefixes, autoPrefix, and
autohooks, as fastify-cli projects use them);
onRequest/preHandler auth hooks on the route or its context, body
schemas on mutating routes, setErrorHandler, and health endpoints.
- Hono: routes on
new Hono() apps, basePath(), and sub-apps mounted
with app.route() across files, replayed in registration order; auth
middleware (jwt(), bearerAuth(), basicAuth(), or your own) on the
route or an earlier matching app.use(); zValidator and other body
validators; onError; and health endpoints.
- Elysia: routes on
new Elysia() instances, prefix, group(), and
plugins mounted with use() across files, functional plugins included,
replayed in registration order with Elysia's hook scope: a plugin's hooks
reach the instance that uses it only when they are scoped or global
({ as: 'scoped' }, .as('scoped')). Auth from onBeforeHandle(), a
derive() or resolve() that rejects with 401, guard(), auth macros
such as better-auth's { auth: true }, onRequest(), or a check in the
handler; when a route misses an auth hook that exists, the finding says
whether the hook stayed local to its plugin or came after the route. Body
schemas (TypeBox, Zod, or another Standard Schema) in the route options or
a guard(); onError; and health endpoints.
- Next.js: App Router and Pages Router API handlers, without penalizing
frontend-only projects. Middleware (
proxy.ts in Next.js 16) protects a
route only if it turns an anonymous request to that path away: its
matcher, pathname checks, next-auth, Clerk's protect(), Auth.js
authorized callbacks, and helpers it returns, such as Supabase's
updateSession(), are evaluated for each route.
- SvelteKit:
+server endpoints and form actions, with route ids from
src/routes; auth in the handle hook (through sequence() and path or