Own project, open source / 2024

@panth977: open-source TypeScript packages for schema-safe backends

A set of small packages on JSR: functions with zod-checked inputs and outputs, routes that produce the Express or Hono handler and the OpenAPI docs from one schema, cache wrappers with a Redis adapter, and request-scoped logs.

Diagram: the @panth977 packages and how they depend on each other: functions at the base, routes with Express and Hono adapters, cache with a Redis adapter, logs and tools.
Diagram: the @panth977 packages and how they depend on each other: functions at the base, routes with Express and Hono adapters, cache with a Redis adapter, logs and tools.

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/routes with routes-express and routes-hono: one typed schema per endpoint gives the HTTP handler, the OpenAPI docs and the types. Middleware, plain HTTP and SSE included.
  • @panth977/cache and cache-redis: wrappers for caching a single object, many objects and collections, with invalidation hooks.
  • @panth977/logs and @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.

Read more




You have requested the PDF version of this page!
This page was not designed or optimized for your request.


You have a redirct option for your expected request:



  1. Checkout the PDF version: https://firebasestorage.googleapis.com/v0/b/panth-personal.firebasestorage.app/o/portfolio%2FPanth-Patel-Resume.pdf?alt=media



  2. Back to website: https://panth.vardayinitech.in/