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

@rajeev02/edge-ai

v0.2.1

Published

Edge AI / On-Device ML Toolkit — OCR, face detection, voice commands, document scanner, smart crop

Readme

@rajeev02/edge-ai

npm version license

On-device ML toolkit with Indian ID card OCR (Aadhaar/PAN/DL), model pipeline (TFLite/CoreML/ONNX/WASM), and voice AI in 11 Indian languages.

Part of Rajeev SDK — cross-platform infrastructure libraries for building apps that work everywhere.

Why use this?

  • Indian ID OCR — Extract and validate Aadhaar, PAN, Driving License from scanned text. Verhoeff checksum for Aadhaar.
  • ML model pipeline — Register, load, and run TFLite / CoreML / ONNX / WASM models with a unified API
  • Voice AI — Parse voice commands in 11 Indian languages (Hindi, Tamil, Bengali, Telugu, Marathi, Gujarati, Kannada, Malayalam, Odia, Punjabi, English)
  • Intent detection — "pay 500 to Rajeev" → { intent: "pay", entities: { amount: "500", recipient: "Rajeev" } }
  • GPU acceleration — Optional GPU backend for TFLite and CoreML models
  • Privacy-first — All processing happens on device. No data sent to cloud servers.

⚠️ Important: ML Runtimes & OCR Engine Required

This library provides ML pipeline management, text parsing utilities, and voice intent matching. It does NOT include ML models, OCR engines, or speech recognition.

| What the library does | What YOU must provide | | ------------------------------------------------- | --------------------------------------------------- | | Parse OCR text to extract PAN/Aadhaar/DL numbers | OCR engine to convert images → text first | | Validate Aadhaar (Verhoeff checksum), PAN format | Nothing — works standalone | | Model lifecycle management (register/load/unload) | TFLite, CoreML, or ONNX runtime + model files | | Rule-based voice intent parsing (11 languages) | Speech-to-text engine to convert audio → text first |

OCR functions (extractPanNumber, extractAadhaarNumber, detectDocumentType) accept pre-extracted text strings — you must first convert images to text using an OCR engine:

| Platform | Recommended OCR engine | | -------------- | ---------------------------------------------------------------------------------------------- | | iOS | Apple Vision Framework | | Android | Google ML Kit Text Recognition | | Cross-platform | Tesseract.js (web/WASM) |

ML pipeline manages model state (register → load → ready → unload) but actual inference must be implemented via native ML runtimes on each platform.

Voice AI parses text commands using regex-based intent detection — it does not record or transcribe audio. Feed it text from a speech-to-text engine like Google Speech-to-Text or Whisper.

Platform Support

| Platform | Engine | Status | | ---------- | ---------- | ------ | | iOS 16+ | TypeScript | ✅ | | Android 7+ | TypeScript | ✅ |

Installation

npm install @rajeev02/edge-ai

Peer Dependencies

  • react >= 18.3.0
  • react-native >= 0.84.0 (optional)

Quick Start

Indian ID OCR

import {
  detectDocumentType,
  extractPanNumber,
  extractAadhaarNumber,
  validatePan,
  validateAadhaar,
  getScanningTips,
} from "@rajeev02/edge-ai";

// Detect document type from OCR text
const docType = detectDocumentType("Income Tax Department PAN ABCPE1234F");
// → "pan"

// Extract PAN
const pan = extractPanNumber("Name: Rajeev PAN: ABCPE1234F DOB: 01/01/1990");
// → "ABCPE1234F"

// Extract masked Aadhaar
const aadhaar = extractAadhaarNumber("Aadhaar: 1234 5678 9012");
// → "XXXX XXXX 9012"

// Validate
validatePan("ABCPE1234F"); // → true
validateAadhaar("123456789012"); // → true (Verhoeff checksum)

// Get scanning tips for users
getScanningTips("aadhaar");
// → ["Place the card on a flat surface", "Ensure all four corners are visible", ...]

ML Model Pipeline

import { ModelManager } from "@rajeev02/edge-ai";

const mm = new ModelManager();

// Register a model
mm.register({
  id: "face_detect",
  name: "Face Detection",
  modelPath: "models/face.tflite",
  backend: "tflite",
  useGpu: true,
});

// Load into memory
await mm.load("face_detect");
console.log(mm.isReady("face_detect")); // → true

// Get model info
const info = mm.getModelInfo("face_detect");
// → { id, name, status: "ready", backend, sizeBytes, loadTimeMs }

// Unload when done
mm.unload("face_detect");

Voice AI

import { parseVoiceIntent, SUPPORTED_VOICE_LANGUAGES } from "@rajeev02/edge-ai";

// Parse natural language commands
const intent = parseVoiceIntent("pay 500 to Rajeev", "en");
// → { intent: "pay", confidence: 0.95, entities: { amount: "500", recipient: "Rajeev" }, language: "en" }

const hindiIntent = parseVoiceIntent("Rajeev ko 500 bhejo", "hi");
// → { intent: "pay", confidence: 0.92, entities: { amount: "500", recipient: "Rajeev" }, language: "hi" }

// 11 supported languages
console.log(SUPPORTED_VOICE_LANGUAGES);
// → ["en", "hi", "ta", "bn", "te", "mr", "gu", "kn", "ml", "or", "pa"]

Supported Document Types

| Type | Detection Keywords | Extraction | | --------------- | ------------------------------- | -------------------------- | | Aadhaar | "UIDAI", "Aadhaar" | Number (masked), name, DOB | | PAN | "Income Tax", "PAN" | PAN number, name, DOB | | Driving License | "Driving", "License", "DL" | DL number, name, validity | | Voter ID | "Election Commission" | Voter ID, name | | Passport | "Passport", "Republic of India" | Passport number, name |

API Reference

| Export | Type | Description | | --------------------------- | ---------- | ----------------------------------- | | detectDocumentType() | function | Detect Indian ID type from OCR text | | extractAadhaarNumber() | function | Extract masked Aadhaar number | | extractPanNumber() | function | Extract PAN number | | validatePan() | function | Validate PAN format | | validateAadhaar() | function | Validate Aadhaar (Verhoeff) | | getScanningTips() | function | Get user-facing scanning tips | | ModelManager | class | ML model lifecycle management | | parseVoiceIntent() | function | Parse voice commands to intents | | SUPPORTED_VOICE_LANGUAGES | string[] | List of supported languages |

Full Documentation

📖 Complete API docs with model config and voice AI

License

MIT © 2026 Rajeev Kumar Joshi