npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@perdieminc/mobile-app-versions

v1.0.0

Published

Fetch production app versions from Google Play Store and Apple App Store

Readme

@perdieminc/mobile-app-versions

Fetch production app versions from Google Play Store and Apple App Store.

Installation

npm install @perdieminc/mobile-app-versions

Quick Start

const MobileAppVersions = require('@perdieminc/mobile-app-versions');

const client = new MobileAppVersions({
  gcpKey: process.env.GCP_KEY // Required for Android lookups
});

// Get iOS version
const iosVersion = await client.getIosVersion('com.example.app');
console.log(iosVersion); // "1.2.3"

// Get Android version
const androidVersion = await client.getAndroidVersion('com.example.app');
console.log(androidVersion); // "1.2.3"

// Get both versions
const versions = await client.getVersions('com.example.app');
console.log(versions);
// { ios: "1.2.3", android: "1.2.3" }

API Reference

Constructor

const client = new MobileAppVersions(options);

| Option | Type | Description | Default | |--------|------|-------------|---------| | gcpKey | string | Base64-encoded GCP service account JSON key | process.env.GCP_KEY | | googleAuthUrl | string | Google OAuth token URL | https://oauth2.googleapis.com/token | | itunesUrl | string | iTunes lookup API URL | https://itunes.apple.com/lookup | | androidPublisherUrl | string | Android Publisher API URL | https://androidpublisher.googleapis.com/androidpublisher/v3/applications |

Methods

getIosVersion(bundleId)

Fetches the production version of an iOS app from the App Store.

const version = await client.getIosVersion('com.example.app');
// Returns: "1.2.3"

getAndroidVersion(bundleId)

Fetches the production version of an Android app from Google Play.

const version = await client.getAndroidVersion('com.example.app');
// Returns: "1.2.3"

getVersions(bundleId)

Fetches both iOS and Android versions for a single bundle ID.

const result = await client.getVersions('com.example.app');
// Returns: { ios: "1.2.3", android: "1.2.3" }
// If one fails: { ios: "1.2.3", android: null, errors: { android: "error message" } }

getVersionsForMultipleBundles(bundleIds)

Fetches versions for multiple bundle IDs.

const results = await client.getVersionsForMultipleBundles([
  'com.app.one',
  'com.app.two'
]);
// Returns:
// {
//   "com.app.one": { ios: "1.0.0", android: "1.0.0" },
//   "com.app.two": { ios: "2.0.0", android: "2.0.0" }
// }

Convenience Methods

// Shorthand for getIosVersion
await client.ios('com.example.app');

// Shorthand for getAndroidVersion
await client.android('com.example.app');

Factory Function

const { createClient } = require('@perdieminc/mobile-app-versions');

const client = createClient({ gcpKey: '...' });

Configuration

Environment Variables

You can configure the module using environment variables instead of constructor options:

| Variable | Description | |----------|-------------| | GCP_KEY | Base64-encoded GCP service account JSON key | | GOOGLE_AUTH_URL | Google OAuth token URL | | ITUNES_URL | iTunes lookup API URL | | ANDROID_PUBLISHER_URL | Android Publisher API URL |

GCP Service Account Setup (for Android)

To fetch Android app versions, you need a Google Cloud Platform service account with access to the Google Play Developer API:

  1. Go to the Google Cloud Console
  2. Create or select a project
  3. Enable the Google Play Android Developer API
  4. Create a service account with appropriate permissions
  5. Download the JSON key file
  6. Base64 encode the JSON key:
    base64 -i service-account.json
  7. Set the encoded string as GCP_KEY

The service account must also be linked to your Google Play Console:

  1. Go to Google Play Console
  2. Navigate to Settings > API access
  3. Link your Google Cloud project
  4. Grant the service account access to your apps

Error Handling

The module throws descriptive errors for common issues:

try {
  const version = await client.getIosVersion('invalid.bundle.id');
} catch (error) {
  console.error(error.message);
  // "No iOS app found for bundleId: invalid.bundle.id"
}

When using getVersions(), errors are captured in the response instead of throwing:

const result = await client.getVersions('com.example.app');
if (result.errors?.ios) {
  console.error('iOS lookup failed:', result.errors.ios);
}
if (result.errors?.android) {
  console.error('Android lookup failed:', result.errors.android);
}

Testing

# Run unit tests
npm test

# Run integration tests (requires network access)
npm run test:integration

Requirements

  • Node.js >= 18.0.0

License

ISC