Postman to Typescript

Ali Toshmatov
2 min readAug 11, 2021

Postman to code — https://postman-to-code.netlify.app/

As a frontend engineer, you have probably used Postman, which is a very helpful tool to preview Apis. Most of the time, the backend team prepares all postman collections beforehand for frontend developers. Based on that data you write your code.

If you have worked with postman a lot you might have had realized that most of the work you do, writing code based on postman data gets repetitive, at least that’s how I thought.

A few weeks ago I started working on automating this process, and after having found that postman provides you with all data in JSON format, I found a way to build a tool that can generate request functions in typescript including types-based on Postman data.

And a few moments ago I build and launched the first beta version of this tool in — https://postman-to-code.netlify.app/

How to use it

First, you have to export postman data in postman. Note that for now, you can only use collection data with this tool, note whole workspace data.

Exporting data from postman collection in JSON format

Now you have to open this JSON file and put it into a specified editor in site, and fill out all input fields with appropriate data.

Pasting JSON data into the site

Output

The generated code is functions for each request named in this structure FolderNameRequestName , also as you can see Axios is used for making API requests. Types are getting generated based on raw body in postman data.

Hope it will ease your coding process, and help build awesome applications. With love Ali.

Postman to code — https://postman-to-code.netlify.app/

Disclaimer: This is an early-stage beta version of the tool and have bugs that might effect badly, by using it you take all risks that might occur.

--

--