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

@ambushsoftworks/nestjs-subscriptions

v0.1.0-rc.1

Published

NestJS subscriptions module for RevenueCat — webhooks, access checks, grants, and subscription events

Readme

@ambushsoftworks/nestjs-subscriptions

A NestJS module for apps where paying unlocks features, built on RevenueCat: store and web purchases, access checks, grants, and subscription events.

Not released. The package is being built against the plan in docs/planning/, which records every decision and why it was taken. Start at docs/planning/README.md.

What it does

  • Receives RevenueCat webhooks — verified, deduplicated, and used as a trigger to fetch the customer from RevenueCat rather than trusted as state.
  • Answers "does this subscriber have this access level?" from a local copy of RevenueCat's subscriptions and purchases, plus grants your app issues.
  • Issues grants — trials, earned days, support grants — each with a source, an expiry and an idempotency key, so one share can never award days twice.
  • Announces changes: access gained or lost, renewals, billing problems, refunds.
  • Optional extras: an access guard for your resolvers, and two end-user GraphQL operations the Flutter package can call.

What stays in your app

Paywall screens and prices, what each access level unlocks, earning rules and caps, admin roles and audit, authentication, and scheduling. The package holds the subscription logic and nothing else.

Design

  • Interface-driven persistence. Your app passes repositories in, or takes the Prisma adapter from the /prisma entry point if you use the reference schema.
  • RevenueCat is the authority on paid access. Nothing computes an expiry by adding days.
  • No dependency on other packages. The subscriber is an opaque ID your app supplies, so the package never dictates your auth.

Entry points

| Import | Contents | |---|---| | @ambushsoftworks/nestjs-subscriptions | The module, services, GraphQL models, decorators, exceptions, ports | | …/prisma | Prisma repositories and transaction manager for the reference schema | | …/testing | Conformance kit, in-memory repositories, RevenueCat test double |

Exceptions

Every exception extends SubscriptionException and carries a stable .code. The codes are public API: map them to your own GraphQL or HTTP errors. They do not change without a major version.

| Exception | .code | Thrown when | |---|---|---| | UniqueConstraintViolationException | UNIQUE_CONSTRAINT_VIOLATION | An adapter translated its ORM's unique violation. The package adopts the winning row rather than failing | | SubscriptionsConfigurationException | SUBSCRIPTIONS_CONFIGURATION | The module was configured in a way that cannot work. Thrown at boot | | NoSubscriberException | NO_SUBSCRIBER | No subscriber could be resolved from the request | | AccessRequiredException | ACCESS_REQUIRED | The caller lacks the entitlement a guarded operation requires | | InvalidSubscriberIdException | INVALID_SUBSCRIBER_ID | A subscriber ID RevenueCat would reject as an App User ID | | UnknownEntitlementException | UNKNOWN_ENTITLEMENT | An entitlement that is not in the configured list | | UnknownGrantSourceException | UNKNOWN_GRANT_SOURCE | A grant source that is not in the configured list | | InvalidGrantException | INVALID_GRANT | A grant whose length is missing, doubly specified, or already over | | GrantNotFoundException | GRANT_NOT_FOUND | A grant that does not exist, or belongs to another subscriber | | RevenueCatUnavailableException | REVENUECAT_UNAVAILABLE | RevenueCat could not be reached, or answered with an error. A webhook failing this way answers non-200 so RevenueCat retries | | RevenueCatRateLimitedException | REVENUECAT_RATE_LIMITED | RevenueCat rate-limited the request. Carries retryAfterSeconds | | WebhookUnauthorizedException | WEBHOOK_UNAUTHORIZED | A webhook whose authorization value or signature did not match |

Reserved GraphQL names

Importing SubscriptionsGraphQLModule registers these type names. An app that declares its own type with any of them crashes at schema build with "type already registered", so rename yours or leave the optional module out.

| Name | Kind | |---|---| | SubscriptionAccessStatus | object type | | SubscriptionAccessSource | object type | | StorePurchaseKind | enum | | AccessSourceType | enum |

License

MIT © Ambush Softworks