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 🙏

© 2025 – Pkg Stats / Ryan Hefner

web3bio-profile-kit

v0.1.35

Published

React hooks for querying ENS, Farcaster, Lens and Web3 universal profiles

Readme

Web3.bio Profile Kit

A lightweight React hooks library for easily integrating Web3 profile data from Ethereum / ENS, Basenames, Farcaster, Lens, Linea Name Service, Solana / SNS, and more into your apps.

Overview

Web3.bio Profile Kit provides React hooks for querying the Web3.bio Profile API, which offers unified profile data across multiple Web3 platforms. This library makes it easy to fetch user profiles, name service information, and domain data.

More information about the Web3.bio Profile API can be found in the document.

Installation

npm install web3bio-profile-kit @tanstack/react-query
# or
yarn add web3bio-profile-kit @tanstack/react-query
# or
pnpm add web3bio-profile-kit @tanstack/react-query

Setup

This library is built on TanStack Query (formerly React Query). You need to set up the QueryClientProvider in your application:

import { QueryClient, QueryClientProvider } from '@tanstack/react-query';

// Create a client
const queryClient = new QueryClient();

function App() {
  return (
    <QueryClientProvider client={queryClient}>
      {/* Your application components */}
    </QueryClientProvider>
  );
}

API Key

The Profile API is free, but usage without API keys includes rate limiting mechanisms to ensure fair usage and prevent abuse. If you need an API Key, you can obtain one by contacting Web3.bio via Twitter (X) or Telegram group.

You can set your API key using environment variables:

WEB3BIO_API_KEY=your_api_key
# or
REACT_APP_WEB3BIO_API_KEY=your_api_key
# or
NEXT_PUBLIC_WEB3BIO_API_KEY=your_api_key
# or
VITE_WEB3BIO_API_KEY=your_api_key

Usage

Query Profile Data

Platform-Specific Profile Queries

import { useProfile } from "web3bio-profile-kit";

function ProfileComponent() {
  // Query with explicit platform format
  const { data, isLoading, error } = useProfile("ens,vitalik.eth");

  // Or simplified format without the platform prefix
  // const { data, isLoading, error } = useProfile("vitalik.eth");
  // Or with Ethereum address
  // const { data, isLoading, error } = useProfile("ethereum,0x123...");
  // Or Farcaster, Lens, Basenames, Linea names and more

  if (isLoading) return <div>Loading...</div>;
  if (error) return <div>Error: {error.message}</div>;

  return (
    <div>
      <h1>{data?.displayName || data?.identity}</h1>
      {data?.avatar && <img src={data.avatar} alt="Profile" />}
      <p>{data?.description}</p>
    </div>
  );
}

Universal Profile Queries

import { useUniversalProfile } from "web3bio-profile-kit";

function UniversalProfileComponent() {
  // Query by any identity format - ENS domain, Farcaster handle, etc.
  const { data, isLoading, error } = useUniversalProfile("vitalik.eth");

  // Or with any other identity
  // const { data, isLoading, error } = useUniversalProfile("dwr.eth.farcaster");
  // const { data, isLoading, error } = useUniversalProfile("0x123...");

  if (isLoading) return <div>Loading...</div>;
  if (error) return <div>Error: {error.message}</div>;

  return (
    <div>
      <h1>{data?.displayName || data?.identity}</h1>
      {data?.avatar && <img src={data.avatar} alt="Profile" />}
      <p>{data?.description}</p>
    </div>
  );
}

Query Name Service Data

Platform-Specific Name Service Queries

import { useNS } from "web3bio-profile-kit";

function NameServiceComponent() {
  const { data, isLoading } = useNS("ens,vitalik.eth");

  if (isLoading) return <div>Loading...</div>;

  return (
    <div>
      <h2>{data?.displayName}</h2>
      <p>Address: {data?.address}</p>
    </div>
  );
}

Universal Name Service Queries

import { useUniversalNS } from "web3bio-profile-kit";

function UniversalNameServiceComponent() {
  // Works with any identity format
  const { data, isLoading } = useUniversalNS("vitalik.eth");

  if (isLoading) return <div>Loading...</div>;

  return (
    <div>
      <h2>{data?.displayName}</h2>
      <p>Address: {data?.address}</p>
    </div>
  );
}

Query Domain Data

import { useDomain } from "web3bio-profile-kit";

function DomainComponent() {
  const { data, isLoading } = useDomain("vitalik.eth");

  if (isLoading) return <div>Loading...</div>;

  return (
    <div>
      <h2>{data?.identity}</h2>
      <p>Resolved address: {data?.resolvedAddress}</p>
      <p>Owner address: {data?.ownerAddress}</p>
    </div>
  );
}

Batch Profile Query

import { useBatchProfile } from "web3bio-profile-kit";

function BatchProfileComponent() {
  const { data, isLoading } = useBatchProfile([
    "vitalik.eth",
    "stani.lens"
  ]);

  // You can also use useNS for batch queries
  // const { data, isLoading } = useBatchNS([
  //   "vitalik.eth",
  //   "stani.lens"
  // ]);

  if (isLoading) return <div>Loading...</div>;

  return (
    <div>
      {Array.isArray(data) && data.map(profile => (
        <div key={profile.identity}>
          <h3>{profile.displayName}</h3>
          <p>{profile.description}</p>
        </div>
      ))}
    </div>
  );
}

Advanced Usage: TanStack Query Features

You can use all TanStack Query features with our hooks:

import { useProfile } from "web3bio-profile-kit";

function AdvancedProfileComponent() {
  const [searchTerm, setSearchTerm] = useState("");

  const {
    data,
    isLoading,
    error,
    isFetching,
    refetch,
    isRefetching
  } = useProfile(searchTerm, {
    // React Query options
    enabled: searchTerm.length > 0,
    staleTime: 5 * 60 * 1000, // 5 minutes
    refetchOnWindowFocus: false,
    onSuccess: (data) => {
      console.log("Profile loaded:", data);
    },
    onError: (error) => {
      console.error("Failed to load profile:", error);
    }
  });

  return (
    <div>
      <input
        type="text"
        value={searchTerm}
        onChange={(e) => setSearchTerm(e.target.value)}
        placeholder="Enter ENS, address, or handle"
      />

      <button onClick={() => refetch()} disabled={isRefetching}>
        Refresh
      </button>

      {isLoading ? (
        <div>Loading...</div>
      ) : error ? (
        <div>Error: {error.message}</div>
      ) : data ? (
        <div>
          <h2>{data.displayName}</h2>
          {data.avatar && <img src={data.avatar} alt="Profile" />}
          {isFetching && <span>Refreshing...</span>}
        </div>
      ) : null}
    </div>
  );
}

Supported Identity Formats

  • ENS domains: name.eth
  • Ethereum addresses: 0x123...
  • Farcaster: username.farcaster
  • Lens profiles: username.lens
  • And many more!

You can also use the explicit format platform,identity for clarity:

  • ens,vitalik.eth
  • ethereum,0x123...
  • farcaster,dwr.eth
  • lens,stani.lens

API Reference

Hooks

useProfile(identity, options?)

Fetches comprehensive profile data including social links and avatar.

useUniversalProfile(identity, options?)

Fetches comprehensive universal profile data including social links and avatar across multiple platforms.

useNS(identity, options?)

Fetches basic name service data (similar to ENS lookups).

useUniversalNS(identity, options?)

Fetches basic universal name service data across multiple platforms.

useDomain(identity, options?)

Fetches detailed domain information including resolution data.

useBatchProfile(identity, options?)

Fetches comprehensive profile data for multiple identities in a single request.

useBatchNS(identity, options?)

Fetches basic name service data for multiple identities in a single request.

Arguments

| Parameter | Type | Description | |-----------|------|-------------| | identity | string or string[] | Identity to query or array of identities for batch queries | | options | object | Optional configuration with TanStack Query options plus apiKey |

Return Values

All hooks return a TanStack Query result object with:

| Property | Type | Description | |-----------|------|-------------| | data | object or null | The profile data when successful | | isLoading | boolean | true during the fetch operation | | error | Error or null | Error object if the request failed | | refetch | function | Function to manually trigger a refetch | | ... | ... | Other TanStack Query result properties |

License

MIT