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

juncture-server

v3.0.0

Published

A module for creating a bridge between React and Node.js applications, enabling graphical user interfaces for Node.js apps with real-time communication

Downloads

33

Readme

Juncture

Juncture is a JavaScript module that bridges React with Node.js applications, providing graphical user interfaces for Node.js apps with real-time communication capabilities.

Features

  • Easy integration with Express server
  • Real-time communication using Socket.IO
  • Unified package for both server and client components
  • Modular imports for server-only or client-only usage
  • State management with file persistence
  • Event broadcasting and subscription

Installation

npm install juncture

Basic Usage

Setting Up the Server with Default State

import { Juncture } from "juncture";

let defaultState = {
  counter: 0,
  message: "",
};

const app = new Juncture(3000, defaultState);
const bridge = app.bridge;

// Simple command handler
bridge.registerHandler("greet", async (args) => {
  const greeting = `Hello, ${args.name}!`;
  app.setState({ ...app.state, message: greeting });
  return greeting;
});

// Stream example
bridge.registerHandler("count", async (args) => {
  const { countTo } = args;
  for (let i = 1; i <= countTo; i++) {
    app.setState({ ...app.state, counter: i });
    bridge.broadcast("counterUpdate", i);
    await new Promise((resolve) => setTimeout(resolve, 1000));
  }
  return "Counting completed!";
});

app.start();

Frontend (React)

// utils/bridge.js
import { ReactBridge } from "juncture/client";
// or import { ReactBridge } from "juncture";

const bridge = new ReactBridge("http://localhost:3000");
export default bridge;

Then, use the bridge in your React components:

import React, { useState, useEffect } from "react";
import bridge from "../utils/bridge";

function App() {
  const [message, setMessage] = useState("");
  const [counter, setCounter] = useState(0);

  const handleGreeting = () => {
    bridge
      .execute("greet", { name: "World" })
      .then(setMessage)
      .catch(console.error);
  };

  const handleCounting = () => {
    bridge
      .execute("count", { countTo: 5 })
      .then(console.log)
      .catch(console.error);
  };

  useEffect(() => {
    bridge.on("counterUpdate", (data) => {
      setCounter(data);
    }, () => {
      console.log("Counter updates completed");
    });

    return () => {
      bridge.off("counterUpdate");
    };
  }, []);

  return (
    <div>
      <button onClick={handleGreeting}>Greet</button>
      <p>{message}</p>
      <button onClick={handleCounting}>Start Counting</button>
      <p>Current count: {counter}</p>
    </div>
  );
}

export default App;

Import Options

Juncture provides flexible import options:

// Import everything
import { Juncture, ExpressBridge, ReactBridge } from "juncture";

// Import only server components
import { Juncture, ExpressBridge } from "juncture/server";

// Import only client components
import { ReactBridge } from "juncture/client";

API

Juncture

Constructor

new Juncture(port = 3000, defaultState = {}, config = {})
  • port: The port the server will run on (default: 3000)
  • defaultState: Initial state (default: {})
  • config: Configuration options
    • maxListeners: Maximum number of event listeners (default: 10)
    • staticFolder: Folder for static files (default: "/public")

Methods

  • start(): Starts the server
  • setState(newState): Updates the state
  • loadStateFromFile(): Loads state from file
  • saveStateToFile(): Saves state to file

ExpressBridge

Methods

  • registerHandler(command, handler): Registers a new command handler
  • broadcast(event, data): Broadcasts an event to all connected clients

ReactBridge

Constructor

new ReactBridge(url)
  • url: URL of the Juncture server

Methods

  • execute(command, args): Executes a command on the server
  • on(event, callback, done): Listens for an event with optional completion callback
  • off(event): Stops listening for an event

Examples

Check the sample directory for complete examples:

  • sample/server.js: Example server implementation
  • sample/client.js: Example client implementation

License

MIT