hono-shaking
Find unused Hono RPC endpoints. Type-driven, monorepo-aware, Svelte / Vue / tsgo friendly.
hono-shaking is a static analyzer for projects that use Hono's RPC client (hc<AppType()). It reads the server's exported AppType via the TypeScript Compiler API, walks the client source for hc<() call sites, and reports the routes the server defines that nobody actually calls.
$ npx hono-shaking
# Discovered servers
apps/api/src/index.ts :: AppType (124 routes)
# Discovered bindings
apps/web/src/lib/client.ts :: backendClient → apps/api/src/index.ts :: AppType
== apps/api :: AppType ==
consumers: apps/web::backendClient(118)
defined routes : 124
used routes : 118orphan calls : 0
Unused routes (6) POST /api/v1/integrations/zendesk/webhook GET /api/v1/integrations/salesforce/oauth/callback GET /api/v1/dashboards ...
## Why
Hono RPC ties every client call to a server route through the type system.
Once you have that wire — `hc<AppType>` — you also have everything you need
to ask the opposite question: **which server routes does nobody on the
client ever call?**
Existing dead-code tools (`knip`, `ts-prune`, …) reason at the export level.
They can't say "this route handler is unused" because the route is reachable
via its registration in `app.get(...)`. `hono-shaking` operates at the
route-schema level instead, which is the unit of dead code that actuallyUse cases:
- PR gate: fail CI if a PR adds a new endpoint with no client call.
- Refactor planning: find handlers safe to delete after a frontend
rewrite.
- Schema drift detection: orphan call sites surface typos and removed
routes that the type checker missed (e.g. inside .svelte / .vue).
When NOT to use this
- Your API isn't called via hc<AppType(...) (REST clients, fetch wrappers,
generated SDKs). The analyzer keys on the hc proxy; outside that shape every route looks unused.
- Your endpoints are called only by external systems (webhook receivers,
OAuth callbacks, public APIs). They'll show up as "unused" — list them under ignore.routes to suppress.
- You're looking for unused functions / files in general. Use