This guide covers setting up a productive development environment for working on MeshCentral.
| Tool | Minimum Version | Install |
|---|---|---|
| Node.js | 16.0.0+ | nodejs.org |
| npm | 8.0.0+ | Bundled with Node.js |
| Git | 2.x+ | git-scm.com |
Using nvm (Node Version Manager) is the recommended approach for managing Node.js versions on Linux/macOS:
# Install nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
# Reload shell
source ~/.bashrc
# Install Node.js LTS
nvm install --lts
nvm use --lts
# Verify
node --version
npm --versionOn Windows, use nvm-windows or download the installer from nodejs.org.
VS Code is the recommended editor for MeshCentral development due to strong Node.js support and the ecosystem of JavaScript extensions.
Download: code.visualstudio.com
Install these extensions for the best experience:
| Extension | ID | Purpose |
|---|---|---|
| ESLint | dbaeumer.vscode-eslint |
JavaScript linting |
| Prettier | esbenp.prettier-vscode |
Code formatting |
| GitLens | eamodio.gitlens |
Enhanced Git history |
| REST Client | humao.rest-client |
Test HTTP/REST endpoints |
| Node.js Extension Pack | waderyan.nodejs-extension-pack |
Node.js tooling bundle |
| Handlebars | andrejunges.handlebars |
Template file syntax highlighting |
| DotENV | mikestead.dotenv |
.env file support |
Install all extensions at once:
code --install-extension dbaeumer.vscode-eslint
code --install-extension esbenp.prettier-vscode
code --install-extension eamodio.gitlens
code --install-extension humao.rest-client
code --install-extension andrejunges.handlebars
code --install-extension mikestead.dotenvCreate .vscode/settings.json in the repository root:
{
"editor.tabSize": 4,
"editor.insertSpaces": true,
"editor.formatOnSave": false,
"files.eol": "\n",
"files.encoding": "utf8",
"javascript.suggest.autoImports": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[javascript]": {
"editor.formatOnSave": false
},
"eslint.enable": true
}Create .vscode/launch.json to enable debug launches:
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch MeshCentral",
"program": "${workspaceFolder}/meshcentral.js",
"args": [],
"cwd": "${workspaceFolder}",
"console": "integratedTerminal",
"skipFiles": ["<node_internals>/**"]
},
{
"type": "node",
"request": "launch",
"name": "Launch MeshCentral (debug)",
"program": "${workspaceFolder}/meshcentral.js",
"args": ["--debug=1"],
"cwd": "${workspaceFolder}",
"console": "integratedTerminal",
"skipFiles": ["<node_internals>/**"]
}
]
}Press F5 in VS Code to start MeshCentral with the debugger attached.
WebStorm has excellent Node.js support out of the box:
- Open the project directory
- Go to Preferences → Languages & Frameworks → Node.js
- Set the Node.js interpreter to your installed version
- Run configurations are auto-detected from
package.json
For terminal-based development, install:
# Node.js LSP support via nvim-lspconfig
# Uses typescript-language-server or vscode-js-debug
npm install -g typescript typescript-language-serverCreate a .env file at the repository root for local overrides (do not commit this file):
# Development environment variables
# Port overrides (avoids needing root for ports <1024)
MESHCENTRAL_PORT=8443
MESHCENTRAL_REDIRPORT=8080
# OpenFrame plugin settings
MESH_DIR=/opt/mesh
MESH_DEVICE_GROUP=dev-group
# Debug output level (0-5)
# Pass via CLI: node meshcentral.js --debug=3Note: MeshCentral reads environment variables prefixed with
MESHCENTRAL_automatically and maps them to their corresponding CLI argument names (e.g.,MESHCENTRAL_PORTsets--port).
MeshCentral defaults to ports 443 and 80, which require root privileges on Linux. For development, use higher ports:
# Using environment variables
MESHCENTRAL_PORT=8443 MESHCENTRAL_REDIRPORT=8080 node meshcentral.js
# Or pass as CLI arguments
node meshcentral.js --port 8443 --redirport 8080Or grant Node.js the capability to bind low ports without root:
sudo setcap 'cap_net_bind_service=+ep' $(which node)After completing the environment setup, verify everything works:
# In the cloned repository directory
node --version # Should print v16.0.0 or higher
npm --version # Should print 8.x or higher
npm install # Should complete without errors
node meshcentral.js --help # Should print MeshCentral usage infoNow continue to the Local Development Guide to run MeshCentral locally.