Skip to content

Installation ​

Codefend requires Node.js 18.0.0 or newer on your development computer, including when you process another language. It produces source files; it does not add a Node.js runtime to your C#, Python, or Arduino program.

Choose an installation ​

Your projectRecommended approach
Arduino, C#, C/C++, Python, Java, or another project without npm dependenciesInstall the Codefend CLI globally once and use codefend.
A Node.js or TypeScript projectInstall Codefend locally as a development dependency and use npx codefend or an npm script.
A Vite, esbuild, Rollup, or Webpack buildInstall the corresponding plugin locally in that project.

Other languages: install globally ​

For a standalone Arduino sketch, C# application, Python script, or similar project:

sh
npm install --global codefend
codefend --version

The command is available across your projects. You do not need to create package.json or package-lock.json just to run Codefend there.

After creating your configuration, run from the directory containing .codefendrc.json:

sh
codefend --obfuscate

See the language examples and Arduino guide for complete source/configuration workflows.

Node.js projects: install locally ​

From an existing Node.js project's root:

sh
npm install --save-dev codefend
npx codefend --version

This records Codefend alongside the project's other development tools. Commit the package manifest and lockfile to share the selected version with your team. For a new npm project, run npm init -y first.

Run the local CLI with:

sh
npx codefend --obfuscate

An npm script can call codefend directly because npm adds local package executables to its command path:

json
{
  "scripts": {
    "obfuscate": "codefend --obfuscate"
  }
}

Then run npm run obfuscate. This is a package.json fragment to merge into your existing scripts.

Existing build and CI workflows ​

Add obfuscation before compiling, packaging, or distributing the generated source, then run the generated program's tests. For a repeatable CI setup, even a non-Node.js project can choose a local development dependency and lockfile, install it with npm ci, and run npx codefend --obfuscate.

For bundler integrations, install the corresponding plugin locally so the build configuration can import it:

BundlerPluginSetup guide
Vitevite-plugin-codefendVite guide
esbuildesbuild-plugin-codefendesbuild guide
Rolluprollup-plugin-codefendRollup guide
Webpackwebpack-plugin-codefendWebpack guide

Your bundler may require newer Node.js versions independently of Codefend. Use an actively maintained Node.js release for development. Contributors running this documentation site's tools need Node.js 22.18.0 or newer; that is separate from Codefend's runtime requirement.