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

@proof-socials/socials

v2.1.0

Published

Instagram, Google Business, Square, and Shopify OAuth, APIs, discounts, and webhook helpers

Readme

@proof-socials/socials

Public npm package with Instagram and Google Business Profile (GMB) primitives only:

  • OAuth URL building and token exchange/refresh
  • Profile, stats, reviews, and location data fetch
  • GMB Pub/Sub push verification and review payload resolution (API fetch + normalization)
  • Minimal validation (socialsConfigSchema, token expiry helpers)

This package intentionally does not include Statsnapp app logic (database repositories, token persistence orchestration, or storage-shaped DTO mappers). Keep that in your consumer app.

Requirements

  • Node.js 22+ (see .nvmrc)
  • npm org/user with publish access to @proof-socials (for maintainers)

Install

npm install @proof-socials/socials

Public releases do not require auth to install.

Local development

cd proof-socials
npm install
npm run dev          # tsup --watch
npm link

# In your app:
npm link @proof-socials/socials

Scripts

| Script | Description | |--------|-------------| | npm run build | Clean + dual CJS/ESM build | | npm run test | Jest unit tests | | npm run test:exports | Build + verify require and import resolve | | npm run typecheck | tsc --noEmit | | npm run release | Publish to npm (public) |

CI/CD (automatic publish)

On every push to main (and on PRs), the CI workflow runs build + tests. npm publish runs only when package.json version changes on a main push.

npm run version:patch   # or version:minor / version:major
git push origin main

See CONTRIBUTING.md for details. Add repo secret NPM_TOKEN (automation token with publish + bypass 2FA).

Publish manually (maintainers)

Package is public (publishConfig.access: public). prepublishOnly runs test:exports.

Option A — automation/granular token (recommended for CI)

Create a token at npmjs.com → Access Tokens:

  • Type: Granular or Automation
  • Permissions: Read and write on @proof-socials/* (or all packages)
  • Enable “Bypass two-factor authentication for write operations” (required if your account has 2FA)
export NPM_TOKEN="npm_..."
npm run release

Option B — npm login + authenticator OTP

npm login
NPM_OTP=123456 npm run release   # 6-digit code from your 2FA app

Troubleshooting E403 (2FA required)

Your token is valid but npm still requires either --otp or a token with bypass 2FA enabled. Classic session tokens from npm login cannot publish without NPM_OTP.

Usage

import { ig, gmb, webhooks, socialsConfigSchema } from '@proof-socials/socials'

const config = socialsConfigSchema.parse({
  appBaseUrl: process.env.APP_URL!,
  instagram: {
    clientId,
    clientSecret,
    scopes: process.env.INSTAGRAM_SCOPES!,
    redirectPath: '/api/social/instagram',
    graphApiVersion: 'v23.0',
  },
  googleBusiness: {
    clientId,
    clientSecret,
    scopes: process.env.GOOGLE_BUSINESS_SCOPES!,
    redirectPath: '/api/social/google-business',
  },
  square: {
    clientId,
    clientSecret,
    scopes: process.env.SQUARE_SCOPES!,
    environment: 'sandbox',
    redirectPath: '/api/social/square',
  },
  shopify: {
    clientId,
    clientSecret,
    scopes: process.env.SHOPIFY_SCOPES!,
    redirectPath: '/api/social/shopify',
  },
  webhooks: { gmbPubsub: { audience, pubsubTopic } },
})

const authUrl = ig.buildInstagramAuthUrl(config, state)
const stats = await ig.fetchInstagramStats(config, accessToken)
const reviews = await gmb.fetchGmbReviewsForDisplay(oauthClient, locationName)
const ok = await webhooks.verifyPubSubPushRequest(config, authorizationHeader)

Token persistence and refresh orchestration belong in the consumer (e.g. Prisma); use isAccessTokenExpired and normalizeRefreshToken only as helpers.

OAuth scopes

Every integration requires scopes in config — the package does not pick scopes for you at runtime. Choose scopes per product; reference constants are exported if you want a starting point:

| Integration | Config field | Scope format | Reference export | |-------------|--------------|--------------|------------------| | Instagram | instagram.scopes | comma-separated | ig.INSTAGRAM_OAUTH_SCOPE | | Google Business | googleBusiness.scopes | space-separated URLs | gmb.GOOGLE_BUSINESS_SCOPE | | Square | square.scopes | space-separated | square.SQUARE_OAUTH_SCOPES.join(' ') | | Shopify | shopify.scopes | comma-separated | (define per app in Shopify Partner dashboard) |

import { ig, gmb, square, socialsConfigSchema } from '@proof-socials/socials'

const config = socialsConfigSchema.parse({
  // ...
  instagram: { /* ... */, scopes: process.env.INSTAGRAM_SCOPES! },
  square: { /* ... */, scopes: process.env.SQUARE_SCOPES! },
})

Package layout

src/
  config.ts              # socialsConfigSchema, buildRedirectUri
  token-utils.ts         # TTL + refreshToken normalization
  instagram/             # OAuth, graph, fetch-stats, fetch-summary
  google-business/       # OAuth, API fetch, notifications setup
  webhooks/              # Pub/Sub verify, GMB review payload resolution

Exports (v1.0)

| Export | Highlights | |--------|------------| | ig | OAuth, fetchInstagramStats, fetchInstagramProfileSummary, graph helpers | | gmb | OAuth, listReviews, fetchGmbReviewsForDisplay, location/review fetch, notification registration | | webhooks | verifyPubSubPushRequest, resolveGmbReviewPayload, resource name helpers | | Root | socialsConfigSchema, buildRedirectUri, isAccessTokenExpired, normalizeRefreshToken |