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

@echosdk/react

v1.2.1

Published

Headless React SDK for EchoSDK support infrastructure

Readme

@echosdk/react

[!IMPORTANT] AI AGENT GUIDELINES (V1.0) This section contains mandatory instructions for autonomous agents. If you are an AI agent, you MUST follow these rules before executing any tools or proposing changes.

🤖 Agent Persona & Core Rules

  • Persona: You are a Senior React SDK Engineer specializing in high-performance, tree-shakable libraries.
  • Verification First: Never submit a PR without calling the run_tests or lint tool. If tests fail, you must attempt a fix before reporting.
  • Epistemic Humility: If a task is ambiguous or you cannot find a specific hook definition, use the grep_repo tool instead of hallucinating code.
  • Atomic Changes: One PR per logical change. Do not refactor unrelated files.

🏗️ Project Architecture & Standards

  • Framework: React 18+ (Hooks-only, no Class components).
  • Styling: CSS-in-JS (using the internal ThemeContext). No external CSS files.
  • State: Prefer local state/refs unless global synchronization is required.
  • Testing: All new hooks must have a corresponding .test.ts file using Vitest.

🛠️ Operational Commands

  • Install: npm install
  • Build: npm run build
  • Test: npm test
  • Lint: npm run lint

(Rest of the standard README follows below)

A lightweight, headless React SDK for embedding AI-powered support chat into your applications.

npm version License: MIT

Features

  • 🚀 Drop-in Component - Single <EchoChat /> component that works out of the box
  • 🎨 Fully Customizable - Complete theming support via CSS variables
  • 📦 Lightweight - < 20kb gzipped
  • 🔒 Type Safe - Full TypeScript support
  • Accessible - WCAG 2.1 AA compliant
  • 🌙 Dark Mode - Built-in light and dark themes
  • 📱 Responsive - Works seamlessly on mobile and desktop
  • SSR Compatible - Works with Next.js, Remix, and other SSR frameworks

Installation

npm install @echosdk/react

or

yarn add @echosdk/react

Getting Started

The fastest way to connect your app to EchoSDK is with the CLI:

# 1. Authenticate once — opens a browser window
npx echosdk login

# 2. Link or create a Chat App in your project directory
npx echosdk init

init will:

  • Show your existing Chat Apps (or prompt you to create one)
  • Write echo.config.json with the correct appId
  • Automatically append NEXT_PUBLIC_ECHOSDK_APP_ID to .env.local if the file exists

Then install the SDK and drop in the component:

npm install @echosdk/react
import { EchoChat } from '@echosdk/react';
import '@echosdk/react/dist/style.css';

// appId comes from echo.config.json / NEXT_PUBLIC_ECHOSDK_APP_ID
<EchoChat appId="your-app-id" />

Other CLI commands:

| Command | Description | |---|---| | npx echosdk login | Authenticate via browser (one-time) | | npx echosdk init | Generate echo.config.json for this project | | npx echosdk whoami | Show the logged-in account | | npx echosdk logout | Remove stored credentials |


Quick Start (manual)

If you already have an appId from the EchoSDK dashboard:

import { EchoChat } from '@echosdk/react';
import '@echosdk/react/dist/style.css';

function App() {
  return (
    <div>
      <h1>My App</h1>
      <EchoChat appId="your-app-id" />
    </div>
  );
}

Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | appId | string | required | Your EchoSDK application ID | | apiUrl | string | https://echosdk.com | Custom API endpoint | | theme | 'light' \| 'dark' \| 'auto' | 'auto' | Color theme | | position | 'bottom-right' \| 'bottom-left' \| 'top-right' \| 'top-left' | 'bottom-right' | Chat bubble position | | primaryColor | string | #3B82F6 | Primary brand color | | placeholder | string | 'Type your message...' | Input placeholder text | | greeting | string | 'Chat with us' | Chat window title | | userName | string | - | User's name | | userEmail | string | - | User's email | | metadata | object | - | Additional context data | | onMessage | (message: Message) => void | - | Message callback | | onError | (error: Error) => void | - | Error callback |

Security

appId — public identifier, safe for client-side use

appId is a public application identifier, not a secret credential. It is safe to hardcode or expose via a NEXT_PUBLIC_ environment variable in Next.js:

# .env.local
NEXT_PUBLIC_ECHOSDK_APP_ID=your-app-id
<EchoChat appId={process.env.NEXT_PUBLIC_ECHOSDK_APP_ID!} />

apiKey — secret credential, server-side only

EchoSDKClient accepts an optional apiKey that, when provided, is sent as a Bearer token in the Authorization header. This is a real secret.

Never place apiKey in a NEXT_PUBLIC_ variable or any client-side bundle.

Use it only in server-side contexts (e.g. a Next.js Route Handler that proxies chat requests), with a server-only environment variable:

# .env.local — never exposed to the browser
ECHOSDK_API_KEY=sk-...
// app/api/echo/route.ts — server-side only
import { EchoSDKClient } from '@echosdk/react';

const client = new EchoSDKClient({
  appId: process.env.NEXT_PUBLIC_ECHOSDK_APP_ID!,  // public — NEXT_PUBLIC_ is fine
  apiKey: process.env.ECHOSDK_API_KEY,              // secret — no NEXT_PUBLIC_ prefix
});

| Credential | What it is | Safe in client bundle? | Recommended env var | |---|---|---|---| | appId | Public app identifier | ✅ Yes | NEXT_PUBLIC_ECHOSDK_APP_ID | | apiKey | Secret Bearer token | ❌ No | ECHOSDK_API_KEY |

Theming

Customize the appearance using CSS variables:

<EchoChat
  appId="your-app-id"
  theme="dark"
  primaryColor="#8B5CF6"
  style={{
    '--echo-border-radius': '8px',
    '--echo-font-family': 'Inter, sans-serif',
  } as React.CSSProperties}
/>

Available CSS Variables

--echo-primary-color
--echo-background
--echo-surface
--echo-text-primary
--echo-text-secondary
--echo-border
--echo-border-radius
--echo-font-family
/* ... and more */

Advanced Usage

Using Hooks

import { useChat } from '@echosdk/react';

function CustomChat() {
  const [state, actions] = useChat('your-app-id');

  return (
    <div>
      <button onClick={actions.toggleChat}>Toggle Chat</button>
      <div>Messages: {state.messages.length}</div>
    </div>
  );
}

Event Callbacks

<EchoChat
  appId="your-app-id"
  onMessage={(message) => {
    console.log('New message:', message);
  }}
  onError={(error) => {
    console.error('Chat error:', error);
  }}
/>

TypeScript

Full TypeScript support with exported types:

import type { Message, ChatState, EchoChatProps } from '@echosdk/react';

Browser Support

  • Chrome (last 2 versions)
  • Firefox (last 2 versions)
  • Safari (last 2 versions)
  • Edge (last 2 versions)

License

MIT © EchoSDK

Links