1.0.4 • Published 7 months ago
@fxi/shiny-manager v1.0.4
@fxi/shiny-manager
A Node.js package for managing R Shiny application processes with a programmable reverse proxy. It provides a web interface to view and interact with Shiny apps, with features like health monitoring and process management.
Quick Start for Development
Clone and install dependencies
git clone https://github.com/fxi/shiny-manager.git cd shiny-manager npm installBuild the project
npm run buildThis builds the client-side code and prepares the server-side modules.
Run the demo app
npm run test:rThis launches the demo Shiny app on http://localhost:8080.
Development Workflow
The project has two main components that need to be built and run together:
- Client-side code (in
/client/): Browser interface with Socket.IO - Server-side code (in
/src/): Node.js server that manages R processes
Development Process
- Make changes to client code (in
/client/) - Build the project to update the distribution files:
npm run build - Test your changes with the demo app:
npm run test:r
Important: Always run
npm run buildafter making changes to client code. The build process copies the client build to thedist/publicdirectory, which is served by the Node.js server.
Features
- Launch and manage R Shiny processes
- Dynamic proxy routing with WebSocket support
- Process lifecycle management and health monitoring
- Status overlay for connection, health checks, and disconnection states
- Socket.IO integration for real-time communication
Usage
Command Line
# Install globally
npm install -g @fxi/shiny-manager
# Start a Shiny app (default port 8080)
shiny-manager ./path/to/app.R
# Start on a specific port
shiny-manager ./path/to/app.R 3000
# Set a custom title
shiny-manager --title "My Shiny App" ./path/to/app.R
# Show help
shiny-manager --helpProgrammatic Usage
import { ProgrammableProxy } from '@fxi/shiny-manager/proxy.js';
import { Session } from '@fxi/shiny-manager/session.js';
// Create a proxy
const proxy = new ProgrammableProxy();
// Create and initialize a session
const session = new Session(socket, proxy, '/path/to/app.R');
await session.init();
// Clean up when done
session.destroy();Project Structure
src/: Server-side Node.js codeclient/: Client-side code (browser interface)build/: Build scriptsdist/: (Generated) Distribution filesdemo/: Demo Shiny app for testingtest/: Test files
Requirements
- Node.js >= 18.0.0
- R with Shiny installed
License
MIT