cURL to TypeScript Fetch
Generate a typed native fetch() client for Next.js, Node 18+, Bun, Deno and the browser.
Native fetch, fully typed
The generated function builds the URL with URL / searchParams, throws on non-2xx responses, and returns Promise<TResponse>. No dependencies required.
Why curl2ts?
- Recursive type inference. JSON request bodies become clean, named
interfaces — nested objects get their own interface, arrays are typed, and keys missing from some array items become optional. - Typed query parameters. The URL query string becomes a
QueryParamsinterface, passed as an optional argument. - Fetch, Axios or Ky. Every client returns
Promise<TResponse>so you can plug in your own response type. - Private by design. Your Bearer tokens and cookies never leave the browser tab. There is no backend.
Supported cURL flags
-X / --request, -H / --header, -d / --data / --data-raw / --data-binary,
--json, -u / --user, -b / --cookie, --url,
plus single, double and $'…' quoting and \ line continuations (Chrome / Firefox "Copy as cURL" works).