DEV Community

Gaurav Kalal
Gaurav Kalal

Posted on

I built the first open source JS library for PhonePe Pulse data

PhonePe Pulse is one of the most interesting public datasets in India.

It contains real UPI transaction data — broken down by state, district, category and quarter — going all the way back to 2018. It covers all 36 states. It updates every quarter. And it is completely free and open.

The problem? It lives as raw JSON files in a GitHub repo. There is no SDK. No wrapper. No way to drop it into a project without writing a lot of fetch and parse logic yourself.

So I built one.


Introducing pulsekit.js

pulsekit.js is a zero-dependency JavaScript library that wraps the PhonePe Pulse dataset and lets you render beautiful India payments charts with a single function call.

No API key. No backend. No build step. Just one <script> tag.

<script src="https://cdn.jsdelivr.net/gh/gorupa/pulsekit/src/pulsekit.js"></script>
Enter fullscreen mode Exit fullscreen mode

Three components out of the box

📊 CategoryChart

Shows transaction categories (P2P, P2M, Recharge, Financial Services, etc.) for any state and quarter as animated horizontal bars.

PulseKit.CategoryChart('#chart', {
  state:   'maharashtra',
  year:    2023,
  quarter: 1,
  metric:  'count' // or 'amount'
});
Enter fullscreen mode Exit fullscreen mode

What you get — a clean card showing every transaction category for Maharashtra in Q1 2023, with animated bars and the actual transaction counts. All data fetched live from the PhonePe Pulse GitHub repo.


📈 GrowthChart

A line chart showing UPI growth across every available quarter for a state — from 2018 all the way to 2023. Hover over any dot to see the exact value.

PulseKit.GrowthChart('#chart', {
  state:  'delhi',
  metric: 'amount'
});
Enter fullscreen mode Exit fullscreen mode

This one is my favourite. You can actually see India's UPI adoption curve in one chart. The growth from 2018 Q1 to 2023 Q4 is remarkable.


🏆 StateRanking

Ranks all 36 Indian states by transaction volume or amount for a given period. You can control how many states to show.

PulseKit.StateRanking('#chart', {
  year:    2023,
  quarter: 4,
  metric:  'count',
  top:     10
});
Enter fullscreen mode Exit fullscreen mode

Maharashtra, Karnataka and Delhi consistently dominate — but the growth in tier-2 states over recent years is the real story.


How it works

pulsekit.js fetches data directly from raw.githubusercontent.com/PhonePe/pulse. No proxy. No middleman. The data goes straight from PhonePe's public repo to your user's browser.

PhonePe Pulse GitHub repo
        ↓
raw.githubusercontent.com
        ↓
pulsekit.js fetch()
        ↓
Your chart
Enter fullscreen mode Exit fullscreen mode

Each component handles its own loading state, error state and animation. You just point it at a container and pass options.


Advanced usage

For developers who want to go beyond the built-in components, all the data fetching utilities are exposed:

// Fetch one quarter for a state
const data = await PulseKit.utils.fetchStateQuarter('karnataka', 2022, 3);

// Fetch all quarters for a state
const history = await PulseKit.utils.fetchAllQuarters('rajasthan');

// Fetch all states for a period — for custom ranking
const states = await PulseKit.utils.fetchAllStates(2023, 1);

// Format helpers
PulseKit.utils.formatCrore(9870000000); // → "987.00 Cr"
PulseKit.utils.toDisplayName('tamil-nadu'); // → "Tamil Nadu"
Enter fullscreen mode Exit fullscreen mode

Why I built this

I'm a law student with a deep interest in India's digital infrastructure. I was building a small data dashboard and wanted to show UPI trends by state. The PhonePe Pulse data was exactly what I needed — but there was no clean way to use it.

After writing the same fetch-and-render logic three times, I extracted it into a library. Then I thought — if I needed this, other developers do too.

That's the whole story. A real problem, a clean solution, open sourced.


What's next — v0.2

  • India choropleth map — an SVG map of India where states are coloured by transaction intensity. This is the feature I'm most excited about.
  • NPCI data support — monthly UPI stats from NPCI alongside PhonePe Pulse, making pulsekit.js the most complete India payments data library available.
  • React wrapper — a proper @gorupa/pulsekit-react package on npm.

Try it

If you find it useful — a star on GitHub goes a long way. And if you build something with it, I'd genuinely love to see it.

Top comments (0)