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

@grantry/vue

v0.2.2

Published

Experimental: authentication, accounts and billing state for Vue 3 applications, as composables over @grantry/js. No prebuilt components.

Readme

@grantry/vue

Experimental. The API below may change between 0.x releases. This package ships the session state and the calls as composables; it has no prebuilt components — <SignIn>, <UserProfile>, <PricingTable> and the rest are @grantry/react's. A Vue application signs in through the hosted page (client.signInWithRedirect()) or builds its own forms.

Authentication, accounts and billing state for Vue 3, on top of @grantry/js.

Install

npm install @grantry/vue

Vue ^3.4 is a peer dependency. @grantry/js comes with it.

Set up

// src/main.ts
import { createApp } from 'vue';
import { createGrantry } from '@grantry/vue';
import App from './App.vue';

createApp(App)
  .use(createGrantry({ publishableKey: import.meta.env.VITE_GRANTRY_PUBLISHABLE_KEY }))
  .mount('#app');

The publishable key (pk_test_… or pk_live_…) is in the Grantry dashboard under API keys. Never pass a secret key (sk_…): the client refuses one.

Route options — signInUrl, signUpUrl, the sign-in and sign-up fallback and force redirect URLs, and afterSignOutUrl — can be passed to createGrantry() or set as VITE_GRANTRY_* variables; what the code passes wins.

Use

<script setup lang="ts">
import { useAuth, useGrantry, useUser } from '@grantry/vue';

const { client } = useGrantry();
const { isLoaded, isSignedIn, signOut } = useAuth();
const { user } = useUser();
</script>

<template>
  <p v-if="!isLoaded">Loading…</p>
  <button v-else-if="!isSignedIn" @click="client.signInWithRedirect()">Sign in</button>
  <p v-else>Signed in as {{ user?.email }} <button @click="signOut()">Sign out</button></p>
</template>

isLoaded is false until the session has been read. user is null both while loading and when nobody is signed in, so check isLoaded before drawing a sign-in screen.

| Composable | What it gives you | | --- | --- | | useGrantry() | The instance: client (the full @grantry/js client), signIn, signUp, signOut, getToken, reload. Throws if the plugin is not installed. | | useAuth() | isLoaded, isSignedIn, userId, signOut(), getToken() | | useUser() | isLoaded, user, reload() | | useEntitlements() | plan, plans, features, has({ plan, feature }), hasFeature() — read from the access token | | useEnvironment() | The application's configuration as the server describes it | | useRoutes() | Where sign-in and sign-up are, and where a finished flow goes | | usePlans() | The public plans, priced and ready to draw |

Selling

const { client } = useGrantry();
await client.redirectToCheckout({ items: [{ priceId: 'price_…' }] });

The browser leaves for Grantry's hosted checkout on your application's checkout domain and comes back to successUrl (this page when left out) once it is paid. client.createCheckout() makes the page without leaving, and client.redirectToPaymentMethodUpdate() replaces the card a plan renews with.

Calling your own backend

const { getToken } = useAuth();
const token = await getToken(); // null when signed out
await fetch('/api/things', { headers: { Authorization: `Bearer ${token}` } });

Verify the token on your server. Entitlements in the browser are for drawing the right screen, never for deciding access.

Things to know

  • No background refresh. The plugin fetches an access token when the session is read, at sign-in, and when getToken() finds none fresh. Call reload() after anything that changes the session or the plan — a second factor answered with client.verifyMfa(), a purchase — to read the user and a fresh token.
  • A correct password is not always a session. signIn() returns the whole result: mfa means a second factor is owed, status: 'password_update_required' means the password must be replaced first. Neither signs anybody in.
  • getToken() answers null when nobody is signed in or the token could not be fetched. A refused token (the session was revoked or signed out elsewhere) signs the page out; a network failure leaves the state as it was.
  • signOut() leaves every account in the browser and goes to afterSignOutUrl if one is set. signOut({ sessionId }) leaves one account and reads which one is active now.

Licence

MIT