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

@pubuduth-aplicy/chat-ui

v2.1.92

Published

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.

Readme

@pubuduth-aplicy/chat-ui

A flexible and easy-to-use React chat UI component.

Description

@pubuduth-aplicy/chat-ui provides a complete chat interface that can be easily integrated into any React application. It includes features like real-time messaging, user presence, and a customizable interface. The component is built with TypeScript, React, and Zustand for state management.

Installation

To install the package, use npm or yarn:

npm install @pubuduth-aplicy/chat-ui

or

yarn add @pubuduth-aplicy/chat-ui

Usage

To use the chat component, you need to initialize the configuration, wrap your application with the ChatProvider, and then render the Chat component.

1. Initialize the Configuration

First, you need to initialize the chat configuration at the entry point of your application (e.g., index.tsx or main.tsx).

// src/main.tsx
import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './App';
import { initChatConfig } from '@pubuduth-aplicy/chat-ui';

// Initialize the chat configuration
initChatConfig({
  apiUrl: 'YOUR_API_URL', // Your backend API URL
  role: 'user', // Optional: 'user' or 'admin'
});

ReactDOM.createRoot(document.getElementById('root')!).render(
  <React.StrictMode>
    <App />
  </React.StrictMode>,
);

2. Wrap with ChatProvider

Next, wrap your component tree with ChatProvider. This provider manages the chat state and WebSocket connection.

// src/App.tsx
import { ChatProvider, Chat } from '@pubuduth-aplicy/chat-ui';

function App() {
  const userId = 'CURRENT_USER_ID'; // The ID of the currently logged-in user

  return (
    <ChatProvider userId={userId}>
      <div className="App">
        {/* Your other components */}
        <Chat />
      </div>
    </ChatProvider>
  );
}

export default App;

3. Render the Chat Component

Finally, render the <Chat /> component wherever you want the chat interface to appear.

Configuration

initChatConfig(config)

This function initializes the chat component's configuration. It must be called once before any chat components are rendered.

Parameters:

  • config (object):
    • apiUrl (string, required): The base URL of your chat backend. The WebSocket connection will be derived from this URL.
    • role (string, optional): The role of the user, e.g., 'user' or 'admin'.

API Reference

<ChatProvider />

This component provides the chat context to its children.

Props:

  • userId (string, required): The unique identifier for the current user.
  • children (ReactNode, required): The child components. The <Chat /> component must be a descendant of ChatProvider.

<Chat />

This component renders the main chat interface. It takes no props.

Development

To set up the project for local development:

  1. Clone the repository:

    git clone https://github.com/pubuduth-aplicy/chat-ui.git
    cd chat-ui
  2. Install dependencies:

    npm install
  3. Run the development server: This project uses Vite. To run the development server, you can add a dev script to your package.json:

    "scripts": {
      "dev": "vite",
      "build": "tsc",
      "prepare": "npm run build"
    }

    Then run:

    npm run dev

Building

To build the component for production, run the following command. This will transpile the TypeScript code.

npm run build

For a full production build, you should use vite build. You can add this to your package.json:

"scripts": {
  "build:vite": "vite build"
}

License

This project is licensed under the ISC License.