
Research
2025 Report: Destructive Malware in Open Source Packages
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.
@subscribe.dev/react
Advanced tools
React hooks and components for SubscribeDev - provides context and hooks for managing AI predictions with billing and rate limiting
React hooks and components for SubscribeDev - provides context and hooks for managing AI predictions with billing and rate limiting.
npm install @subscribe.dev/react
# or
yarn add @subscribe.dev/react
# or
pnpm add @subscribe.dev/react
# or
bun add @subscribe.dev/react
This package requires the following peer dependencies:
npm install react @clerk/clerk-react @tanstack/react-query
Wrap your app with the SubscribeDevProvider:
import { SubscribeDevProvider } from '@subscribe.dev/react';
function App() {
return (
<SubscribeDevProvider
projectToken="pub_your_project_token_here"
clerkPublishableKey="pk_your_clerk_key_here"
baseUrl="https://api.subscribe.dev" // optional
>
<YourAppContent />
</SubscribeDevProvider>
);
}
import { useSubscribeDev, useSubscribeDevAuth } from '@subscribe.dev/react';
function MyComponent() {
const { client, token, isSignedIn } = useSubscribeDev();
const { subscribe, isSubscribed } = useSubscribeDevAuth();
if (!isSignedIn) {
return <div>Please sign in</div>;
}
if (!isSubscribed) {
return (
<button onClick={subscribe}>
Subscribe to continue
</button>
);
}
return (
<div>
<p>Ready to use AI services!</p>
</div>
);
}
SubscribeDevProviderThe main provider component that sets up authentication, query client, and SubscribeDev client.
Props:
children: React.ReactNode - Child componentsprojectToken: string - Your SubscribeDev project token (starts with pub_)clerkPublishableKey: string - Your Clerk publishable keybaseUrl?: string - Optional API base URL (defaults to SubscribeDev API)SignInIframe-compatible Clerk SignIn component with proper redirect handling.
import { SignIn } from '@subscribe.dev/react';
<SignIn />
SignInButtonIframe-compatible Clerk SignInButton component.
import { SignInButton } from '@subscribe.dev/react';
<SignInButton>Sign In</SignInButton>
UserButtonIframe-compatible Clerk UserButton component.
import { UserButton } from '@subscribe.dev/react';
<UserButton />
useSubscribeDev()Main hook providing access to client, authentication state, and storage utilities.
Returns:
{
client: SubscribeDevClient | null;
token: string | null;
isSignedIn: boolean;
subscribe: () => void;
isSubscribed: boolean;
subscriptionStatus: any;
subscriptionLoading: boolean;
refreshSubscriptionStatus: () => Promise<void>;
useStorage: <T>(key: string, initialValue: T) => [T, (value: T) => void, SyncStatus];
}
useSubscribeDevAuth()Authentication and subscription management hook.
Returns:
{
isSignedIn: boolean;
token: string | null;
isSubscribed: boolean;
subscribe: () => void;
subscriptionStatus: any;
subscriptionLoading: boolean;
refreshSubscriptionStatus: () => Promise<void>;
}
useSubscribeDevStorage<T>(key: string, initialValue: T)Persistent storage hook that syncs data between local storage and remote SubscribeDev storage.
Parameters:
key: string - Storage key identifierinitialValue: T - Default value if no stored data existsReturns:
[
T, // Current stored value
(value: T) => void, // Setter function
SyncStatus // Sync status: 'local' | 'syncing' | 'synced' | 'error'
]
Example:
function MyComponent() {
const [userPrefs, setUserPrefs, syncStatus] = useSubscribeDevStorage('preferences', {
theme: 'light',
language: 'en'
});
return (
<div>
<p>Sync Status: {syncStatus}</p>
<button onClick={() => setUserPrefs({ ...userPrefs, theme: 'dark' })}>
Toggle Theme
</button>
</div>
);
}
useClerkAuth()Low-level Clerk authentication hook.
Returns:
{
token: string | null;
isSignedIn: boolean;
}
useStorage()Low-level storage operations hook.
Returns:
{
get: (key: string) => Promise<string | null>;
set: (key: string, value: string) => Promise<void>;
remove: (key: string) => Promise<void>;
}
syncSession()Hook for syncing session data between local and remote storage.
function MyComponent() {
const sync = syncSession();
useEffect(() => {
sync(); // Sync session on mount
}, [sync]);
}
The package provides a robust storage system that automatically syncs data between:
local, syncing, synced, error)import { useSubscribeDevStorage } from '@subscribe.dev/react';
function UserSettings() {
const [settings, setSettings, syncStatus] = useSubscribeDevStorage('user-settings', {
notifications: true,
autoSave: false,
theme: 'system'
});
const updateNotifications = (enabled: boolean) => {
setSettings({
...settings,
notifications: enabled
});
};
return (
<div>
<div>Sync Status: {syncStatus}</div>
<label>
<input
type="checkbox"
checked={settings.notifications}
onChange={(e) => updateNotifications(e.target.checked)}
/>
Enable Notifications
</label>
</div>
);
}
The package includes built-in subscription management with modal-based upgrade flows.
import { useSubscribeDevAuth } from '@subscribe.dev/react';
function FeatureGate({ children }) {
const { isSubscribed, subscribe, subscriptionLoading } = useSubscribeDevAuth();
if (subscriptionLoading) {
return <div>Loading subscription status...</div>;
}
if (!isSubscribed) {
return (
<div>
<h3>Premium Feature</h3>
<p>This feature requires a subscription.</p>
<button onClick={subscribe}>
Subscribe Now
</button>
</div>
);
}
return <>{children}</>;
}
This package is written in TypeScript and provides comprehensive type definitions.
type SyncStatus = 'local' | 'syncing' | 'synced' | 'error';
interface SubscribeDevContextValue {
client: SubscribeDevClient | null;
token: string | null;
isSignedIn: boolean;
queryClient: QueryClient;
subscriptionModalUrl: string | null;
setSubscriptionModalUrl: (url: string | null) => void;
}
bun run build # Build for development
bun run build:publish # Build for publishing
bun run dev # Build in watch mode
bun run test # Run tests
bun run typecheck # Type checking only
bun run lint # Lint source code
MIT
This package is part of the SubscribeDev monorepo:
FAQs
React hooks and components for SubscribeDev - provides context and hooks for managing AI predictions with billing and rate limiting
The npm package @subscribe.dev/react receives a total of 310 weekly downloads. As such, @subscribe.dev/react popularity was classified as not popular.
We found that @subscribe.dev/react demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.

Security News
Socket CTO Ahmad Nassri shares practical AI coding techniques, tools, and team workflows, plus what still feels noisy and why shipping remains human-led.

Research
/Security News
A five-month operation turned 27 npm packages into durable hosting for browser-run lures that mimic document-sharing portals and Microsoft sign-in, targeting 25 organizations across manufacturing, industrial automation, plastics, and healthcare for credential theft.