Back to services

CNCjs

Web interface for CNC milling controllers running Grbl, Smoothieware, or TinyG.

View alternatives to CNCjs
Suggest edit
Open source
Self-hostable
MIT
Recent reviews

Alternatives

Tech stack

No tech stack added yet. Sign in to suggest some

Introduction

CNCjs is an open-source web interface for controlling CNC milling machines. It connects to controllers running Grbl, Smoothieware, or TinyG firmware. It can run on a Raspberry Pi or on any laptop with Node.js installed. There are several ways to make the serial connection to a control board such as an Arduino:

  • USB serial
  • Bluetooth serial module
  • Serial-to-WiFi module (such as XBee or USR-WIFI232-T)

The project is released under the MIT License.

Key Features

  • Support for multiple controllers: Grbl / Grbl-Mega, Smoothieware, TinyG / g2core
  • Desktop app: available for Linux, macOS, and Windows
  • 3D visualization: preview the toolpath after loading G-code
  • Shared connections: multiple HTTP clients can connect to the same serial port at the same time
  • Responsive interface: also usable on small screens such as phones narrower than 720px
  • Customizable workspace: the widget layout can be adjusted to your needs
  • Accounts, commands, and events: add user accounts, define custom system commands (such as update, restart, and shutdown), and trigger actions on events
  • Macros: can be defined in the configuration file
  • Peripherals and input: supports keyboard shortcuts and the Contour ShuttleXpress controller
  • Z-axis probe (Z-Probe)
  • Watch directory: monitors a specified directory for changes to G-code files
  • Multilingual interface: including Simplified Chinese, Traditional Chinese, Japanese, German, French, Russian, and more

Pendant Extensions

The project officially provides several Pendant projects that let you operate the machine from other devices:

  • cncjs-pendant-boilerplate (template)
  • cncjs-pendant-ps3 (PS3 controller)
  • cncjs-pendant-tinyweb (lightweight web interface)
  • cncjs-pendant-keyboard (keyboard)

Target Users and Use Cases

Suitable for DIY makers, CNC engraver or milling machine hobbyists, and small workshops. A common setup is to place a Raspberry Pi next to the machine as an always-on control host, then use the browser on a computer, tablet, or phone to load G-code remotely and monitor the machining process.

Installation and Usage

1. Install Node.js

Node.js must be installed first, and the official recommendation is to manage versions with nvm. Note: the version support table on the official website's home page is rather outdated (mainly Node.js 4–7), so before installing, it's best to check the official documentation or the GitHub repository for the requirements of the current version.

2. Install globally with npm

It is recommended to install as a non-root user; otherwise, the serialport module may fail to install properly on platforms such as the Raspberry Pi:

npm install -g cncjs

If you must install as root, add the --unsafe-perm option:

sudo npm install --unsafe-perm -g cncjs

3. Start the service

cnc

After it starts, open http://hostname:8000/ in a browser. Common options:

OptionPurpose
-pSet the port
-wSpecify the watch directory
-mMount static files (such as Pendant pages)
--allow-remote-accessAllow remote access
--access-token-lifetimeSet the access token lifetime

4. Upgrade

npm install -g cncjs@latest

Use cnc -V to check the current version.

Configuration file

The command-line options above can also be written to ~/.cncrc (JSON format) in your home directory. This file can also define custom commands, events, macros, and users.

Technical Requirements

  • Runtime environment: Node.js, on Raspberry Pi, Linux, macOS, or Windows
  • Browsers: Chrome, Edge, Firefox, Opera, Safari (IE is not supported)
  • Hardware: a CNC controller running supported firmware

Notable Points

  • It does not include CAM functionality, so you need to prepare G-code separately. The project recommends jscut, a browser-based CAM tool, for converting SVG to G-code.
  • The repository's examples directory contains sample G-code that you can use for a trial run.