Decouple Logic from HTTP Frameworks with TypeScript

If you are building an open-source tool and importing `express` or `next/server` into your core logic, you are building a trap. When you tightly couple your logic to an HTTP framework, you alienate 80% of the ecosystem. A Next.js dev can't use your Express tool. A Hono dev can't use your Fastify plugin. You need to build compilers, not switchboards. I use the 𝗘𝗻𝗴𝗶𝗻𝗲-𝗔𝗱𝗮𝗽𝘁𝗲𝗿 𝗣𝗮𝘁𝘁𝗲𝗿𝗻: 1. 𝗧𝗵𝗲 𝗘𝗻𝗴𝗶𝗻𝗲: Pure TypeScript. Zero HTTP context. It takes raw inputs and returns standard outputs. 2. 𝗧𝗵𝗲 𝗔𝗱𝗮𝗽𝘁𝗲𝗿𝘀: Tiny 20-line wrappers that translate a framework's request into your engine's context. This is exactly how I built TableCraft to seamlessly support Hono, Express, Next.js, and Elysia from a single codebase. Stop writing one-off endpoints. Start building generic compilers. I wrote a technical deep dive on how to structure this in a monorepo. Link below 👇 https://lnkd.in/gr9hBJnd #SoftwareArchitecture #TypeScript #OpenSource #WebDev #BackendEngineering

  • No alternative text description for this image

To view or add a comment, sign in

Explore content categories