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

everventure-face-recognition-sdk

v0.0.5

Published

React hook for face recognition using face-api.js with API integration support

Readme

@everventure/face-recognition-sdk

A React hook for face recognition using face-api.js with API integration support.

Installation

npm install everventure-face-recognition-sdk face-api.js

Quick Start

1. Setup Local Models

Copy models to your app's public folder:

cp -r node_modules/everventure-face-recognition-sdk/public/models ./public/

2. Configure API Key

Set your API key before using the hook:

import { setApiKey } from 'everventure-face-recognition-sdk';

// Set your API key
setApiKey('your-api-key-here');

3. Use the Hook

import { useFaceRecognition } from 'everventure-face-recognition-sdk';

function App() {
  const {
    videoRef,
    canvasRef,
    isLoading,
    isReady,
    status,
    register,
    recognize,
  } = useFaceRecognition({
    autoStart: true,        // Auto-start video (default: true)
    modelPath: '/models',   // Path to models (default: '/models')
  });

  const handleRegister = async () => {
    const result = await register('John Doe');
    
    if (result.success) {
      console.log('✅ Registered!', result.message);
    } else {
      console.error('❌ Error:', result.message);
    }
  };

  const handleRecognize = async () => {
    // With default threshold (0.6)
    const result = await recognize();
    
    // Or with custom threshold
    // const result = await recognize(0.8);
    
    if (result.success && result.match) {
      console.log('✅ Recognized:', result.name);
    } else {
      console.log('❌ No match:', result.message);
    }
  };

  return (
    <div>
      <video ref={videoRef} width={640} height={480} autoPlay muted />
      <canvas ref={canvasRef} width={640} height={480} />
      
      <button onClick={handleRegister} disabled={!isReady || isLoading}>
        Register Face
      </button>
      <button onClick={handleRecognize} disabled={!isReady || isLoading}>
        Recognize Face
      </button>
      
      <div>{status}</div>
    </div>
  );
}

API Reference

setApiKey(key: string)

Set the API key for all API requests. The key will be sent in the X-API-Key header.

import { setApiKey } from 'everventure-face-recognition-sdk';

setApiKey('your-api-key-here');

useFaceRecognition(options?)

React hook for face recognition functionality.

Options

interface UseFaceRecognitionOptions {
  autoStart?: boolean;  // Auto-start video stream (default: true)
  modelPath?: string;   // Path to local models (default: '/models')
}

Returns

{
  // Refs
  videoRef: RefObject<HTMLVideoElement>;
  canvasRef: RefObject<HTMLCanvasElement>;
  
  // State
  isLoading: boolean;   // Models are loading
  isReady: boolean;     // Ready to use
  error: string | null; // Error message
  status: string;       // Status message
  
  // Functions
  startVideo: () => Promise<boolean>;
  stopVideo: () => void;
  register: (name: string) => Promise<RegisterResult>;
  recognize: (threshold?: number) => Promise<RecognizeResult>;
  detectFace: () => Promise<number[] | null>;
  setStatus: (status: string) => void;
}

register(name: string)

Register a face with a name. Sends data to the API.

const result = await register('John Doe');

// Returns:
interface RegisterResult {
  success: boolean;
  message: string;
  userId?: string;
  error?: string;
}

recognize(threshold?: number)

Recognize a face from video stream. Sends data to the API.

// With default threshold (0.6)
const result = await recognize();

// With custom threshold
const result = await recognize(0.8);

// Returns:
interface RecognizeResult {
  success: boolean;
  match: boolean;
  name?: string;
  distance?: number;
  message?: string;
  error?: string;
}

Note: The threshold parameter controls the similarity threshold for face matching. Lower values (e.g., 0.4) are more lenient and may match less similar faces, while higher values (e.g., 0.8) are stricter and require more similar faces. The default value is 0.6 if not provided.

License

MIT