Thank you for contributing to MeshCentral (flamingo-stack/meshcentral). This guide covers code style conventions, the pull request process, commit message format, and the review checklist.
All development discussion, questions, and coordination happen on the OpenMSP Slack, not GitHub Issues or Discussions.
- OpenMSP Community: https://www.openmsp.ai/
- Join Slack: https://join.slack.com/t/openmsp/shared_invite/zt-36bl7mx0h-3~U2nFH6nqHqoTPXMaHEHA
Before starting work on a significant feature or bug fix, discuss it on Slack first to avoid duplicated effort and to align with the project roadmap.
- Fork the repository: https://github.com/flamingo-stack/meshcentral
- Clone your fork:
git clone https://github.com/YOUR_USERNAME/meshcentral.git
cd meshcentral- Add the upstream remote:
git remote add upstream https://github.com/flamingo-stack/meshcentral.git- Install dependencies:
npm install- Create a feature branch (see branch naming below)
Use the following naming conventions for branches:
| Type | Pattern | Example |
|---|---|---|
| Feature | feature/short-description |
feature/webauthn-passkeys |
| Bug fix | fix/short-description |
fix/relay-session-timeout |
| Refactor | refactor/short-description |
refactor/db-abstraction |
| Documentation | docs/short-description |
docs/amt-setup-guide |
| Security | security/short-description |
security/path-traversal-fix |
Rules:
- Use lowercase letters and hyphens only (no underscores, no spaces)
- Keep descriptions short and meaningful (3–5 words)
- Never commit directly to
main
MeshCentral is written in vanilla JavaScript (Node.js, CommonJS modules). There is no transpilation step.
| Rule | Detail |
|---|---|
| Indentation | 4 spaces (no tabs) |
| Line endings | LF (\n) — not CRLF |
| Quotes | Single quotes for strings |
| Semicolons | Always use semicolons |
'use strict' |
Required at the top of every module |
var vs const/let |
Use const/let for new code; var in existing modules for consistency |
| Max line length | 256 characters (matches existing codebase) |
Follow the factory function pattern used throughout the codebase:
'use strict';
/**
* @description Brief description of the module
* @param {Object} parent - MeshCentral parent server object
*/
function CreateMyModule(parent) {
const obj = {};
obj.someMethod = function () {
// Implementation
};
return obj;
}
module.exports = { CreateMyModule };Add a JSDoc file header to new server-side modules:
/**
* @description What this module does
* @author Your Name
* @license Apache-2.0
*/
'use strict';- Use
//for single-line comments - Use
/* ... */for block comments - Document public functions and non-obvious logic
- Avoid comments that merely restate the code
Use the following commit message format:
type(scope): short summary in present tense
Optional body paragraph explaining the WHY, not the WHAT.
Wrap at 72 characters.
Optional footer:
Refs: #issue-number (if applicable)
| Type | When to Use |
|---|---|
feat |
New feature |
fix |
Bug fix |
security |
Security fix |
refactor |
Code restructuring without behavior change |
docs |
Documentation only changes |
test |
Adding or updating tests |
chore |
Build system, dependency updates |
perf |
Performance improvement |
webserver— Changes towebserver.jsmeshagent— Changes tomeshagent.jsdb— Changes todb.jsrfb— Changes to noVNC RFB stackxterm— Changes to Xterm terminalplugin— Changes to plugin systemamt— Changes to Intel AMT modulesopenframe— Changes to OpenFrame plugin
feat(openframe): add deviceStatus endpoint with tenant isolation
fix(meshrelay): prevent relay session leak on abrupt disconnect
security(webserver): validate upload temp path against allowed roots
docs(webauthn): document replay attack counter validation
- Sync with upstream
main:
git fetch upstream
git rebase upstream/main- Run the test suite:
node agents/testsuite.js
# Expected exit code: 2- Manually test your changes against a local running server:
node meshcentral.js --port 8443 --redirport 8080 --debug 2- Review your diff for unintended changes:
git diff upstream/main- Push your branch:
git push origin feature/your-branch-name-
Open a Pull Request at: https://github.com/flamingo-stack/meshcentral/pulls
-
Fill in the PR template:
## Summary
Brief description of what this PR does.
## Changes
- List of specific changes made
## Testing
How was this tested? (manual, test suite, specific scenarios)
## Security Considerations
Any security implications? (new auth, file access, crypto, etc.)
## Related Discussion
Slack thread or discussion link (if applicable)
Reviewers will check the following. Ensure your PR passes before requesting review:
- Logic is correct and handles edge cases
- No regressions to existing functionality
- Error handling is present for all failure paths
- No hardcoded secrets, passwords, or API keys
- File path operations use safe path resolution
- Multi-tenant isolation enforced where applicable
- CORS headers explicitly set on new HTTP routes
- WebAuthn counter validated and updated after assertion
- User input validated before use in DB queries or filesystem ops
- Follows 4-space indentation convention
-
'use strict'present in all new.jsfiles - Factory function pattern used for new server modules
- No unnecessary
console.log()left in production paths - New public functions documented with comments
- Diagnostic test suite passes (
node agents/testsuite.jsexits with code2) - Manual testing completed against a running local server
- New functionality manually verified end-to-end
- Compatible with Node.js 16+ (no Node 18+ exclusive APIs without fallback)
- No breaking changes to the
config.jsonformat without migration notes - Plugin hooks not broken for existing plugins
- Database operations work with the default NeDB backend
If you are contributing a new plugin, follow the OpenFrame plugin (plugins/openframe.js) as a reference:
- Place plugin files under
plugins/ - Use
hook_setupHttpHandlersto register Express routes - Apply CORS headers to all responses
- Implement tenant domain isolation using
deriveTenantDomain - Return
404(not403) for cross-tenant resource access
MeshCentral is licensed under the Apache-2.0 License. By contributing, you agree that your contributions will be licensed under the same license.
All new files must include the license header:
/**
* @description Module description here
* @license Apache-2.0
*/