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

nano-invoke

v1.0.0

Published

Simple IPC client for Nano Framework applications

Readme

nano-invoke

Simple, clean IPC client for Nano Framework applications. Connect your frontend to your Rust backend with minimal setup.

Installation

npm install nano-invoke

Quick Start

import { invoke, configure } from 'nano-invoke';

// Optional: Configure the client
configure({
  debug: true,
  timeout: 5000
});

// Call any registered nano function
const result = await invoke('greet', { name: 'World' });
console.log(result); // "Hello, World!"

// Call external system functions
const calculation = await invoke('calculate', {
  operation: 'add',
  values: [10, 20, 30]
});
console.log(calculation.result); // 60

Features

  • 🚀 Simple API - Just invoke(functionName, args)
  • 📡 WebSocket Events - Real-time communication support
  • 🔧 TypeScript - Full type safety with IntelliSense
  • Lightweight - Zero dependencies
  • 🛠️ Configurable - Timeout, debug mode, custom URLs
  • 🔄 Auto-reconnect - WebSocket reconnection handling

API Reference

invoke(cmd, args)

Call a Rust function registered in your Nano application.

import { invoke } from 'nano-invoke';

// Simple function call
const greeting = await invoke('greet', { name: 'Alice' });

// With typed response
interface UserData {
  id: number;
  name: string;
  email: string;
}

const user = await invoke<UserData>('get_user', { id: 123 });

configure(options)

Configure the client behavior.

import { configure } from 'nano-invoke';

configure({
  baseUrl: 'http://localhost:3030',  // Custom server URL
  debug: true,                       // Enable debug logging
  timeout: 10000                     // Request timeout in ms
});

Event System

Listen to real-time events from your Rust backend.

import { events } from 'nano-invoke';

// Connect to WebSocket
await events.connect();

// Listen for events
events.on('notification', (data) => {
  console.log('Received notification:', data);
});

// Send messages
events.send({ type: 'ping' });

// Clean up
events.off('notification', listener);
events.disconnect();

Utilities

Built-in utility functions.

import { Utils } from 'nano-invoke';

// Check if server is running
const isOnline = await Utils.isServerRunning();

// Ping the server
const pong = await Utils.ping();

// Get system information
const sysInfo = await Utils.getSystemInfo();

Type Definitions

Common command types are provided for convenience:

import { Commands } from 'nano-invoke';

// System information
const sysInfo = await invoke<Commands.SystemInfo>('get_system_info');

// File operations
const fileInfo = await invoke<Commands.FileInfo>('get_file_info', { 
  path: '/path/to/file' 
});

// Calculations
const result = await invoke<Commands.CalculationResult>('calculate', {
  operation: 'multiply',
  values: [5, 10, 2]
});

Error Handling

try {
  const result = await invoke('my_function', { data: 'test' });
} catch (error) {
  if (error.message.includes('not found')) {
    console.log('Function not registered in Rust backend');
  } else if (error.message.includes('connect')) {
    console.log('Server is not running');
  } else {
    console.log('Function error:', error.message);
  }
}

Usage with Nano Framework

  1. Install nano-invoke in your frontend:

    npm install nano-invoke
  2. Register functions in your Rust backend (nano_registry.rs):

    pub fn register_all_nano_functions() {
        register_nano_command!("greet", greet);
        register_nano_command!("calculate", external_systems::calculator::calculate);
    }
  3. Call from frontend:

    import { invoke } from 'nano-invoke';
       
    const greeting = await invoke('greet', { name: 'World' });
    const result = await invoke('calculate', { operation: 'add', values: [1, 2] });

Browser Compatibility

  • Chrome/Edge 90+
  • Firefox 88+
  • Safari 14+
  • All modern browsers with ES2020 and WebSocket support

License

MIT License - see LICENSE file for details.

Support