codexe
v1.0.0
Published
A secure, Docker-based remote code execution engine for Node.js supporting Python, C++, Java, and JS.
Maintainers
Readme
🚀 Codexe — Code Execution Engine
Codexe 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)
✨ Features
- 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
📦 Installation
npm install codexeUsing scoped version:
npm install @pratik-patil-369/codexe⚠️ Prerequisites
- Docker Desktop or Docker Engine (running)
- Node.js v16+
🛠️ Usage
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 <iostream>
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();🌍 Supported Languages
| 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 |
🏗️ Architecture & Security
Codexe uses a Docker-per-request model:
- Fresh Container per Execution
- 128MB RAM Limit
- Network Disabled
- Read-Only System Paths
- Immediate Container Cleanup
🤝 Contributing
Contributions are welcome! Want to add Rust, Go, or enhanced sandboxing? Open an issue or submit a PR.
