Overview
Discover what makes CNCjs powerful
CNCjs is a lightweight, full‑stack web interface that exposes the real‑time state and control of popular CNC firmware such as **Grbl**, **Marlin**, **Smoothieware**, and **TinyG**. From a developer’s point of view, it is essentially a Node.js HTTP/WS server that translates low‑level serial commands into a modern, responsive UI. The application is built with **Electron** for desktop deployments and serves the same code base to browsers, enabling cross‑platform consistency. The serial layer is abstracted behind a `serialport` driver, which supports USB, Bluetooth RFCOMM, and serial‑to‑WiFi modules (e.g., XBee), making it trivial to connect to a controller over the network.
Runtime
Frontend
Persistence
Serial Communication
Overview
CNCjs is a lightweight, full‑stack web interface that exposes the real‑time state and control of popular CNC firmware such as Grbl, Marlin, Smoothieware, and TinyG. From a developer’s point of view, it is essentially a Node.js HTTP/WS server that translates low‑level serial commands into a modern, responsive UI. The application is built with Electron for desktop deployments and serves the same code base to browsers, enabling cross‑platform consistency. The serial layer is abstracted behind a serialport driver, which supports USB, Bluetooth RFCOMM, and serial‑to‑WiFi modules (e.g., XBee), making it trivial to connect to a controller over the network.
Architecture
- Runtime: Node.js (v4+ recommended) running an Express‑based HTTP server coupled with Socket.IO for bi‑directional communication.
- Frontend: Vue.js (or plain JS in older releases) with WebGL powered 3D visualization via Three.js, delivering a dro‑style readout and tool‑path rendering.
- Persistence: Optional, non‑relational storage (SQLite or JSON files) for user preferences, macro scripts, and widget configurations.
- Serial Communication:
serialportlibrary abstracts the underlying OS serial drivers; multiple concurrent HTTP clients can share a single serial connection thanks to an internal queueing system. - Desktop Packaging: Electron bundles the Node runtime and Chromium, enabling offline operation on Windows, macOS, and Linux while still exposing a local web socket endpoint for external integrations.
Core Capabilities
- Real‑time G‑code parsing: CNCjs parses incoming G‑code streams, exposing a live feed of machine position, spindle speed, and status flags.
- Command API: A RESTful
/api/commandsendpoint accepts MDI commands, while WebSocket messages allow sending arbitrary G‑code strings or control packets. - Event bus: Clients can subscribe to machine events (
$G,$I, etc.) via Socket.IO, enabling custom dashboards or logging services. - Custom widgets: A plugin system based on ES6 modules lets developers inject new UI components that can interact with the API, expose additional data, or control external devices.
- Pendant support: Stand‑alone “pendants” can be built using the
cncjs-pendant-boilerplate, exposing a minimal UI or just raw command streams over WebSocket, ideal for handheld controllers.
Deployment & Infrastructure
CNCjs is designed to run on modest hardware: a Raspberry Pi 3, a laptop, or any server with Node.js installed. It can be containerized with Docker (official images exist) and orchestrated via Kubernetes or Docker‑Compose. The application is stateless except for optional local storage, so horizontal scaling is straightforward—multiple instances can be load‑balanced behind a reverse proxy while sharing the same serial device through a shared network mount or USB over IP. For high‑availability, developers can expose the WebSocket endpoint over TLS and use JWT authentication to secure remote access.
Integration & Extensibility
- Webhooks: CNCjs can emit HTTP POST requests on machine events, allowing integration with CI/CD pipelines or monitoring dashboards.
- API hooks: Custom middleware can intercept Socket.IO messages, enabling developers to inject safety checks or transform commands before they reach the controller.
- Plugin SDK: The widget boilerplate exposes lifecycle hooks (
init,destroy) and a shared state store, making it trivial to build complex dashboards (e.g., real‑time temperature monitoring or tool‑change workflows). - Pendant APIs: The pendant boilerplate provides a thin wrapper around the main API, so developers can create custom handheld interfaces that send MDI commands or stream live G‑code.
Developer Experience
Documentation is organized across the GitHub Wiki and inline code comments, with a dedicated “User Guide” that also serves as an API reference. The community is active on GitHub Discussions and Discord, offering rapid support for integration questions. Configuration is primarily driven by a config.json file and environment variables, allowing CI/CD pipelines to tweak serial port paths, authentication tokens, or UI themes without code changes. The open‑source license (MIT) removes barriers to commercial use, and the modular architecture encourages experimentation without risking core stability.
Use Cases
- Embedded CNC stations: Deploy CNCjs on a Raspberry Pi to create a low‑cost, web‑based control panel for hobbyist or small‑batch production lines.
- Remote monitoring: Expose the WebSocket API over VPN or TLS to allow engineers to monitor spindle health, tool wear, and position from a mobile device.
- Custom manufacturing dashboards: Build proprietary widgets that pull sensor data from the machine’s serial output and display it alongside production metrics.
- Pendant development: Use the pendant boilerplate to create handheld controllers for field service technicians, enabling quick tool changes or emergency stops.
Advantages
- Performance: Node.js’ event‑loop handles serial I/O with minimal latency, making CNCjs suitable for high‑speed machining.
- Flexibility: The plugin and widget systems allow developers to tailor the UI or extend functionality without touching core code.
- Licensing: MIT license eliminates cost and legal hurdles, encouraging adoption in both open‑source and commercial environments.
- Community & Support: A vibrant
Open SourceReady to get started?
Join the community and start self-hosting CNCjs today
Related Apps in other
Immich
Self‑hosted photo and video manager
Syncthing
Peer‑to‑peer file sync, no central server
Strapi
Open-source headless CMS for modern developers
reveal.js
Create stunning web‑based presentations with HTML, CSS and JavaScript
Stirling-PDF
Local web PDF editor with split, merge, convert and more
MinIO
Fast, S3-compatible object storage for AI and analytics
Weekly Views
Repository Health
Information
Tags
Explore More Apps
Nullboard
Compact, offline kanban board for quick task management
Directory Lister
Browse and share web folders with zero configuration
Bitcart
Self‑hosted crypto payment processor with zero fees
docassemble
Automated guided interviews and document assembly
Git Annex
Manage large files with Git without storing content in the repo
Flarum
Fast, lightweight community forum software