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

react-zero-ai

v0.1.0

Published

React hooks for on-device AI — image classification, sentiment analysis, embeddings. Zero uploads, full privacy.

Readme


Imagine dropping an entire AI model straight into your React component with a single hook. No expensive backend servers to spin up. No API keys to leak. No CORS nightmare. Just pure, offline-capable AI running directly in your user's browser at 60fps.

react-zero-ai gives you production-ready Transformers.js models wrapped in beautiful, buttery-smooth React Hooks. All inference runs entirely on a background Web Worker thread, meaning your UI never blocks, even when doing heavy ML computations.

🤯 Why React developers are going crazy over this:

  • Zero Config: npm install react-zero-ai and you are done. No Webpack configuring, no WASM nightmare.
  • Main Thread === Unblocked: We automatically spawn a background Web Worker pool. Your React tree stays silky smooth while ML models crunch gigabytes of data.
  • 100% Free: Run unlimited inferences. No OpenAI billing. No Hugging Face API limits. Compute is offloaded to your users' devices.
  • Total Privacy: The data never leaves the browser. Perfect for analyzing sensitive PII, internal documents, or private images.

🚀 Quick Start

npm install react-zero-ai

1. 💬 Sentiment Analysis

Analyze text sentiment instantly as the user types.

import { useSentimentAnalysis } from 'react-zero-ai';

function ReviewBox() {
  const { analyze, isReady, isLoading } = useSentimentAnalysis();
  const [result, setResult] = useState(null);

  if (isLoading) return <div>Downloading AI Model...</div>;

  return (
    <div>
      <textarea 
        onChange={async (e) => setResult(await analyze(e.target.value))} 
        placeholder="Type a review..."
      />
      {result && <span>{result.sentiment} (Confidence: {result.confidence})</span>}
    </div>
  );
}

2. 🧠 Semantic Embeddings (Vector Search)

Build local semantic search without a vector database! Find related sentences or documents purely offline.

import { useEmbeddings } from 'react-zero-ai';

function OfflineSearch() {
  const { findSimilar, isReady } = useEmbeddings();
  const candidates = ["How to reset password", "Contact support", "Pricing limits"];
  
  const search = async (query) => {
    const results = await findSimilar(query, candidates, 3);
    console.log(results); // [{ text: "How to reset password", score: 0.89 }, ...]
  };

  return <button onClick={() => search("I forgot my login")}>Search</button>;
}

3. 🖼️ Image Classification

Drop an image in, get predictions out. Support for any Hugging Face Vision Transformer model.

import { useImageClassifier } from 'react-zero-ai';

function Dropzone() {
  const { classify, isReady } = useImageClassifier({ topk: 3 });

  const onFileDrop = async (file) => {
    const { results } = await classify(file);
    console.log(results); // [{ label: "Golden Retriever", score: 0.95 }, ...]
  };

  return <input type="file" onChange={(e) => onFileDrop(e.target.files[0])} />;
}

4. 🎯 Object Detection

Draw bounding boxes around objects in images.

import { useObjectDetection } from 'react-zero-ai';

function ObjectScanner() {
  const { detect, isReady } = useObjectDetection();

  const scan = async (imageUrl) => {
    const { objects } = await detect(imageUrl);
    objects.forEach(obj => {
      console.log(`Found ${obj.label} at`, obj.box);
    });
  };
}

🛠️ Advanced: Bring Your Own Model

By default we use highly optimized, tiny models. But react-zero-ai lets you slot in ANY model from the Hugging Face hub:

const { analyze } = useSentimentAnalysis({ 
  model: "cardiffnlp/twitter-roberta-base-sentiment-latest" 
});

⚠️ Important Setup (Cross-Origin Isolation)

For maximum performance, Web Workers require SharedArrayBuffer support. You must configure your bundler to inject COOP/COEP headers.

Vite (vite.config.ts)

export default defineConfig({
  plugins: [
    {
      name: 'configure-response-headers',
      configureServer: (server) => {
        server.middlewares.use((_req, res, next) => {
          res.setHeader('Cross-Origin-Embedder-Policy', 'require-corp');
          res.setHeader('Cross-Origin-Opener-Policy', 'same-origin');
          next();
        });
      },
    }
  ]
});

Next.js and Webpack guides coming soon.

📄 License

MIT © Local AI React Team