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

emoji-recsys

v0.1.6

Published

[![npm](https://img.shields.io/npm/v/emoji-recsys)](https://www.npmjs.com/package/emoji-recsys)

Downloads

48

Readme

emoji-recsys

npm

Live demo at emoji-recsys.vercel.app.

Semantic emoji search for React. Type a word or phrase, get the most relevant emojis back.

Uses precomputed embeddings for 1,906 emojis and all-MiniLM-L6-v2 via Transformers.js for query embedding. Runs entirely in the browser.

Built on the approach from entity-db — an in-browser vector database using Transformers.js for semantic search.

Install

pnpm i emoji-recsys

React 18+ is a peer dependency.

Usage

import { useEmojiRecommendations } from "emoji-recsys";

function EmojiPicker() {
  const { results, loading, error } = useEmojiRecommendations("happy celebration", 5);

  if (error) return <div>Failed to load: {error.message}</div>;
  if (loading) return <div>Loading...</div>;

  return (
    <div>
      {results.map((r) => (
        <span key={r.emoji} title={r.name}>
          {r.emoji}
        </span>
      ))}
    </div>
  );
}

Hooks

All hooks return { results, loading, error } (or { result, loading, error } for the singular variant). loading is true while a query is in progress. error is null on success, or an Error if the model fails to load.

useEmojiRecommendations(query: string, n?: number): { results: EmojiResult[]; loading: boolean; error: Error | null }

Returns the top n emojis (default 5) most semantically similar to query. Returns [] while loading or if query is empty.

useEmojiRecommendation(query: string): { result: EmojiResult | null; loading: boolean; error: Error | null }

Returns the single best emoji match.

useCustomSubsetEmojiRecommendations(query: string, n: number, vocabulary: string[]): { results: EmojiResult[]; loading: boolean; error: Error | null }

Same as useEmojiRecommendations, but only searches within the provided emoji subset.

const { results, loading } = useCustomSubsetEmojiRecommendations("weather", 3, ["☀️", "🌧️", "❄️", "🌈", "⛈️"]);

Utilities

preloadModel(): Promise<void>

Pre-warms the embedding model so the first query is fast. Call this early (e.g., on app mount) if you want to avoid a delay on the first search.

import { preloadModel } from "emoji-recsys";

useEffect(() => { preloadModel(); }, []);

getAllEmojis(): Promise<string[]>

Returns all 1,906 emoji characters that have precomputed vectors.

Types

interface EmojiResult {
  emoji: string;  // the emoji character
  name: string;   // Unicode name (e.g., "grinning face")
  score: number;  // cosine similarity (0–1, higher = better match)
}

Example app

See test-emoji-recsys for a working Next.js example.

How it works

  1. At build time, every emoji's Unicode name is embedded into a 384-dimensional vector using all-MiniLM-L6-v2. These vectors ship with the package.
  2. At runtime, your query string is embedded using the same model (loaded once, cached in the browser — ~23MB on first load).
  3. Cosine similarity is computed between the query vector and all emoji vectors, and the top N results are returned.

Rebuilding vectors

To update the emoji set or re-embed with a different model:

pnpm build:vectors  # precompute embeddings
pnpm build          # bundle the package

License

MIT