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

@nimbus-sh/react

v0.1.3

Published

React component for embedding a Nimbus terminal in your app. <NimbusTerminal /> is a typed iframe wrapper with token + tenant props.

Readme

@nimbus-sh/react

<NimbusTerminal /> — drop a Nimbus terminal into any React app.

Install

npm install @nimbus-sh/react @nimbus-sh/sdk react

react is a peer-dep (>=18) so the embedder's React copy is the only one loaded.

Quickstart

import { NimbusTerminal } from '@nimbus-sh/react';
import { useEffect, useState } from 'react';

export function App() {
  const [token, setToken] = useState<string | null>(null);

  useEffect(() => {
    // Embedder's own endpoint mints the token from JWT_SECRET in env.
    fetch('/api/auth/mint', { method: 'POST',
      body: JSON.stringify({ tenant: 'acme', sub: 'alice' }) })
      .then(r => r.json())
      .then(({ token }) => setToken(token));
  }, []);

  if (!token) return <div>Loading…</div>;
  return (
    <NimbusTerminal
      endpoint="https://my-nimbus.workers.dev"
      token={token}
      tenant="acme"
      sub="alice"
      onReady={() => console.log('session attached')}
      style={{ width: '100%', height: 500 }}
    />
  );
}

Props

| Prop | Type | Required | Default | What | |---|---|---|---|---| | endpoint | string | ✓ | — | Base URL of your Nimbus deploy. | | token | string | ✓ | — | JWT from issueNimbusToken. | | tenant | string | ✓ | — | Embedder metadata; keep it aligned with the token's tn claim. The Worker trusts the token. | | sub | string | | — | Embedder metadata; keep it aligned with the token's sub claim when present. | | sessionId | string | | — | Attach to existing session. Absent → mint via /new. | | onReady | () => void | | — | Fired when WS connects + first prompt visible. | | onError | (e: NimbusTerminalError) => void | | — | Fired on session-side errors. | | style | CSSProperties | | {width:'100%',height:'100%'} | Inline iframe styles. | | className | string | | — | Extra class on the iframe. | | sandbox | string | | allow-scripts allow-same-origin allow-downloads allow-forms allow-popups | iframe sandbox attribute. | | title | string | | Nimbus terminal | Accessibility title. |

Imperative handle

import { useRef } from 'react';
import { NimbusTerminal, type NimbusTerminalRef } from '@nimbus-sh/react';

const ref = useRef<NimbusTerminalRef>(null);

<NimbusTerminal ref={ref} … />
<button onClick={() => ref.current?.reload()}>Reset session</button>

ref.current exposes:

  • reload() — force-fetch the iframe.
  • getUrl() — current attach URL.
  • getElement() — the underlying <iframe> HTMLElement.

Headless: useNimbusSession()

For embedders that want their own UI:

import { useNimbusSession } from '@nimbus-sh/react';

function MyTerm({ token }: { token: string }) {
  const { ready, attachUrl, error } = useNimbusSession({
    endpoint: 'https://my-nimbus.workers.dev',
    token,
    tenant: 'acme',
  });
  if (error)              return <div>Error: {error.message}</div>;
  if (!ready || !attachUrl) return <div>Loading…</div>;
  return <iframe src={attachUrl} style={{ width: '100%', height: 400 }} />;
}

Why an iframe (not direct DOM render)?

Three reasons:

  1. The xterm shell ships once from Nimbus — no per-embedder bundle bloat.
  2. Cross-origin isolation: embedder JS can't snoop the WebSocket.
  3. The shell handles keybinding/resize/CSP-quirks natively; we don't want to duplicate that logic in a React component.

Nimbus currently embeds the hosted terminal shell through an iframe.

MIT.