Result
- 9 packages published under @panth977 on JSR
- One schema per endpoint gives the handler, OpenAPI docs and TypeScript types
Stack
TypeScriptzodExpressHonoRedisOpenAPIJSR
The problem
TypeScript types disappear at runtime, so they don't validate what a function actually receives or returns. On a backend that means the same schema gets written three times (validation, docs, types) and drifts. Caching and logging get the same treatment: copied by hand into every function.
What I built
@panth977/functions: define a function with zod input and output schemas and wrappers; every call gets a context (used for logs and disposal).@panth977/routeswithroutes-expressandroutes-hono: one typed schema per endpoint gives the HTTP handler, the OpenAPI docs and the types. Middleware, plain HTTP and SSE included.@panth977/cacheandcache-redis: wrappers for caching a single object, many objects and collections, with invalidation hooks.@panth977/logsand@panth977/tools: log helpers and small utilities such as pub/sub.
Result
The cache and logging designs in the case studies above are built on these packages, and the blog posts linked here walk through them with code.