A secure, Docker-based remote code execution engine for Node.js supporting Python, C++, Java, and JS.
npm install codexeCodexe is a secure, lightweight, multi-language remote code execution (RCE) engine for Node.js.
It uses isolated Docker containers to safely run untrusted user code.
Perfect for building:
- Online Judges
- Skill Assessment Platforms
- Hackathon Portals
- Learning Management Systems (LMS)
---
- Multi-Language Support: Python 3, C, C++, Java 17, JavaScript (Node.js)
- Secure by Default: Runs in ephemeral Docker containers with --network none
- Cross-Platform: Works on Windows, WSL2, Linux, and macOS
- Auto-Cleanup: Removes temp files and containers automatically
- Zero Config: Handles compilation and execution seamlessly
---
``bash``
npm install codexe
Using scoped version:
`bash`
npm install @pratik-patil-369/codexe
* Docker Desktop or Docker Engine (running)
* Node.js v16+
---
`javascript
const { executeCode } = require('codexe');
async function run() {
// 1. Execute Python
console.log("Running Python...");
const pythonResult = await executeCode(
'python',
'print(f"Hello {input()}!")',
'World' // stdin
);
console.log(pythonResult);
// Output: { status: 'Success', output: 'Hello World!' }
// 2. Execute C++
console.log("Running C++...");
const cppCode =
#include
int main() {
int x;
std::cin >> x;
std::cout << "Square is: " << x * x;
return 0;
}
;
const cppResult = await executeCode('cpp', cppCode, '5');
console.log(cppResult);
// Output: { status: 'Success', output: 'Square is: 25' }
}
run();
`
---
| Identifier | Language | Docker Image |
| ------------ | --------- | ------------------------------- |
| python | Python 3 | python:3.9-alpine |javascript
| | Node.js | node:18-alpine |cpp
| | C++ (GCC) | gcc:latest |c
| | C (GCC) | gcc:latest |java
| | Java 17 | eclipse-temurin:17-jdk-alpine` |
---
Codexe uses a Docker-per-request model:
* Fresh Container per Execution
* 128MB RAM Limit
* Network Disabled
* Read-Only System Paths
* Immediate Container Cleanup
---
Contributions are welcome!
Want to add Rust, Go, or enhanced sandboxing?
Open an issue or submit a PR.