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

gately

v3.0.5

Published

Gately SDK for authentication, bookmarks, and CMS integration

Readme

gately

The official Gately SDK for building authenticated web applications with member management, payments, forms, and more.

npm version License: MIT

Installation

npm install gately
# or
yarn add gately
# or
pnpm add gately

Quick Start

Get Your API Key

  1. Go to your Gately Dashboard
  2. Navigate to Settings → API Keys
  3. Create a new Public Key for frontend apps

React

import { GatelyProvider, useGately } from 'gately';

function App() {
  return (
    <GatelyProvider apiKey="gately_pk_live_xxxxxxxx">
      <MyComponent />
    </GatelyProvider>
  );
}

function MyComponent() {
  const { user, login, logout, loading } = useGately();

  if (loading) return <div>Loading...</div>;

  if (!user) {
    return (
      <button onClick={() => login('[email protected]', 'password')}>
        Login
      </button>
    );
  }

  return (
    <div>
      <p>Welcome, {user.email}!</p>
      <button onClick={logout}>Logout</button>
    </div>
  );
}

Vanilla JavaScript

<script 
  src="https://cdn.usegately.com/gately.min.js" 
  data-api-key="gately_pk_live_xxxxxxxx"
  defer
></script>
<script>
  document.addEventListener('DOMContentLoaded', () => {
    const gately = window.Gately;

    // Listen for auth changes
    gately.onAuthStateChange((user, session) => {
      if (user) {
        console.log('Logged in:', user.email);
      } else {
        console.log('Logged out');
      }
    });

    // Login
    gately.login('[email protected]', 'password')
      .then(({ user }) => console.log('Success:', user))
      .catch(err => console.error('Error:', err));
  });
</script>

Node.js (Server-side)

import { GatelyNodeClient } from 'gately/node';

// Use SECRET key for server-side only
const gately = new GatelyNodeClient({
  apiKey: process.env.GATELY_SECRET_KEY // gately_sk_live_xxxxxxxx
});

// Server-side operations
const members = await gately.listMembers();
const user = await gately.verifyToken(token);

API Key Types

| Key Type | Prefix | Usage | |----------|--------|-------| | Public Key | gately_pk_ | Browser/frontend apps (safe to expose) | | Secret Key | gately_sk_ | Server-side only (never expose) |

⚠️ Never expose secret keys in client-side code.

Features

Authentication

import { GatelyClient } from 'gately';

const gately = new GatelyClient({
  apiKey: 'gately_pk_live_xxxxxxxx'
});

// Email login
await gately.login('[email protected]', 'password');

// Google SSO
await gately.loginWithGoogle({ redirectTo: '/dashboard' });

// Magic link
await gately.sendMagicLink('[email protected]');

// Password reset
await gately.resetPassword('[email protected]');

// Logout
await gately.logout();

User Profiles

// Get current user profile
const profile = await gately.getUserProfile();

// Update profile
await gately.updateUserProfile({
  full_name: 'John Doe',
  avatar_url: 'https://...',
  bio: 'Developer'
});

// Change password
await gately.changePassword('oldPassword', 'newPassword');

Member Content Protection

// Check if user has access to protected content
const access = await gately.checkMemberContentAccess('/premium-page');

if (!access.hasAccess) {
  console.log('Access denied:', access.reason);
}

// Auto-protect current page
await gately.autoProtectCurrentPage({
  onAccessDenied: (content, reason) => {
    window.location.href = '/login';
  }
});

Payments (Stripe Integration)

// Create a payment intent
const { payment_intent } = await gately.createPaymentIntent({
  amount: 2999, // $29.99 in cents
  currency: 'usd',
  description: 'Premium subscription'
});

// Confirm payment
await gately.confirmPaymentIntent(payment_intent.id, {
  payment_method_id: 'pm_...'
});

Forms

import { FormEmbed } from 'gately';

const form = new FormEmbed({
  formId: 'your-form-id',
  containerId: 'form-container',
  onSuccess: (submission) => {
    console.log('Form submitted:', submission);
  }
});

Bookmarks

await gately.addBookmark('page-slug');
await gately.removeBookmark('page-slug');
await gately.toggleBookmark('page-slug');
const bookmarks = await gately.getBookmarksByUser();

Chat Widget

import { createChatWidget } from 'gately';

const widget = createChatWidget({
  apiKey: 'gately_pk_live_xxxxxxxx',
  position: 'bottom-right',
  theme: 'light'
});

widget.open();

React Hooks

import { 
  useGately,      // Main auth hook
  useAuth,        // Auth state only
  useBookmarks,   // Bookmark management
  useGatelySDK    // Direct SDK access
} from 'gately';

function Component() {
  const { user, login, logout, loading, error } = useGately();
  const { bookmarks, addBookmark, removeBookmark } = useBookmarks();
  // ...
}

Imports

// Main entry (React hooks + browser client)
import { useGately, GatelyProvider, GatelyClient } from 'gately';

// Browser-specific
import { GatelyBrowserClient } from 'gately/browser';

// Node.js server
import { GatelyNodeClient } from 'gately/node';

// Core client (platform-agnostic)
import { GatelyCoreClient } from 'gately/core';

TypeScript Support

Full TypeScript support with exported types:

import type { 
  User,
  Session,
  AuthResponse,
  GatelyOptions,
  UserProfile,
  MemberContent,
  PaymentIntent,
  Form,
  Bookmark
} from 'gately';

CDN Usage

<!-- Full bundle -->
<script src="https://cdn.usegately.com/gately-full.min.js" data-api-key="YOUR_API_KEY"></script>

<!-- Core only (smaller) -->
<script src="https://cdn.usegately.com/gately.min.js" data-api-key="YOUR_API_KEY"></script>

<!-- Individual modules -->
<script src="https://cdn.usegately.com/gately-auth.min.js"></script>
<script src="https://cdn.usegately.com/gately-forms.min.js"></script>
<script src="https://cdn.usegately.com/gately-payments.min.js"></script>
<script src="https://cdn.usegately.com/gately-chat.min.js"></script>

Configuration

const gately = new GatelyClient({
  apiKey: 'gately_pk_live_xxxxxxxx',  // Required
  apiUrl: 'https://api.usegately.com', // Optional: custom API URL
  autoRefresh: true,                   // Optional: auto-refresh sessions
  suppressConsoleErrors: false         // Optional: suppress console errors
});

Documentation

For full documentation, visit usegately.com/docs

Support

License

MIT © Gately