
Build a Bun CLI to Generate TypeScript Clients from API Docs
A Common Dev Pain Point (And My Excuse to Learn Bun) I hate it when I find an API I want to use, go to their documentation site, and find a beautiful page with endpoints, request/response examples, detailed explanations, and… no OpenAPI spec. No SDK, either. I understand creating a Swagger/OpenAPI schema involves far more effort than a typical docs page for an API, so I can’t be too upset. But this does limit my options — I’d either have to hand-write fetch calls for every endpoint (tedious, error-prone), or politely ask the API maintainer for an OpenAPI spec (they are not obligated to spend dev cycles on some rando’s request.) This is the case with at least 75% of all APIs here , for example. Even well-funded APIs sometimes have great docs but no machine-readable spec. So I built a CLI tool with full proxy support (with Bun — this experiment is mostly because I wanted to learn how to create tooling with it) that generates TypeScript clients from either OpenAPI specs or raw documentati
Continue reading on Dev.to Webdev
Opens in a new tab




