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

@termuijs/dev-server

v0.1.7

Published

File-watching dev server for TermUI that restarts your app on save

Readme

@termuijs/dev-server

File-watching dev server for TermUI apps. Save a file, restart the app. Turnaround is under 200ms in most cases.

Install

npm install --save-dev @termuijs/dev-server

Usage

# If you used create-termui-app, it's already wired up:
npm run dev

# Run directly:
npx termui-dev --entry src/index.tsx

How it works

The dev server runs your application as a Bun child process. A FileWatcher monitors the configured source directories for changes to .ts, .tsx, .js, .jsx, .tss, and termui.config files.

When a change is detected:

  1. The watcher captures the file event.
  2. Rapid consecutive saves are coalesced through a short debounce window.
  3. The dev server records the reload event and sends a reload IPC message to the running child process.
  4. The child process gets a short grace period to perform cleanup.
  5. The current process is terminated gracefully (with a force-kill fallback if necessary).
  6. A fresh Bun child process is spawned using the same entry file.
  7. A temporary reload banner is displayed, and development continues automatically.

This approach provides fast feedback while avoiding stale processes and incomplete cleanup between reloads.

CLI flags

| Flag | Default | What it does | |------|---------|-------------| | --entry <path> | Auto-detected | Entry file to run | | --watch <glob> | src/** | Files to watch | | --debounce <ms> | 200 | Wait time after the last change |

Auto entry detection

Without --entry, the server checks these paths in order:

src/index.tsx
src/index.ts
src/main.tsx
src/main.ts
index.tsx
index.ts

Environment variables

| Variable | Value | Purpose | |----------|-------|---------| | TERMUI_DEV | "1" | Enables development-specific behavior such as debug overlays, verbose logging, and other development helpers. | | NODE_ENV | "development" | Indicates that the application is running in development mode. |

Example:

if (process.env.TERMUI_DEV === '1') {
    // Enable development-only features
}

Troubleshooting

Changes are not reloading

  • Make sure you started your app with npm run dev or termui-dev.
  • Verify that the modified files are inside the watched directories.
  • The watcher only reacts to supported source and configuration files.

The app does not restart

  • Save the file completely before expecting a reload.
  • Check for syntax errors that might prevent the child process from starting.
  • Restart the dev server if the watcher was interrupted unexpectedly.

Environment variables are missing

The dev server automatically starts the child process with:

  • TERMUI_DEV=1
  • NODE_ENV=development

You normally do not need to set these manually.

Devtools inspector

The dev server includes a runtime inspector that shows your widget tree, hook state, and timer pool health. Connect to it on the default port while your app runs.

All new widget types are supported: Grid, Skeleton, Tree, JSONView, DiffView, CommandPalette, NotificationCenter, StreamingText, ChatMessage, and ToolCall.

Custom setup example

You can customize the dev server by specifying your own entry file and debounce interval.

termui-dev --entry src/index.tsx --debounce 300

Example programmatic setup:

import { DevServer } from '@termuijs/dev-server';

const server = new DevServer({
    rootDir: process.cwd(),
    entry: 'src/index.tsx',
    watchDirs: ['src', 'themes'],
    debounce: 300
});

server.start();

Graceful shutdown

Ctrl+C sends SIGTERM to the dev server, which forwards it to the child process and waits for a clean exit.

Documentation

Full docs at www.termui.io/docs/guides/dev-server.

License

MIT