Skip to content

Commit ffb48e1

Browse files
Merge pull request #18 from devlopersabbir/docs
[docs] wrote docs about complete explain
2 parents 295d543 + 706eab6 commit ffb48e1

1 file changed

Lines changed: 68 additions & 31 deletions

File tree

README.md

Lines changed: 68 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,65 @@
1-
# Code Executor Backend
1+
<h1 align="center">🚀 ExecuteMe – Run Code Instantly and Securely</h1>
22

3-
A robust and secure backend service for executing user-submitted code in isolated Docker containers. This project provides an API endpoint to receive code snippets in various programming languages and runs them within dedicated, resource-limited Docker environments, returning the execution output.
3+
**[ExecuteMe](https://executeme.vercel.app)** is a powerful and minimalistic online code execution platform that allows developers to write, run, and test code in multiple programming languages instantly and securely — all within the browser.
44

5-
## ✨ Features
6-
7-
- **Multi-Language Support:** Execute code written in Python, Node.js, and Java out-of-the-box. Easily extensible to support more languages.
8-
9-
- **Docker Isolation:** Each code execution runs in its own ephemeral Docker container, ensuring process isolation and preventing interference between different code submissions.
10-
11-
- **Resource Limiting:** Configurable memory and CPU limits for each execution to prevent resource exhaustion from malicious or inefficient code.
12-
13-
- **API-Driven:** Simple RESTful API endpoint for seamless integration with frontend applications or other services.
14-
15-
- **Temporary File Handling:** Manages temporary directories and files for each execution, ensuring clean-up after completion.
16-
17-
## 🚀 Technologies Used
18-
19-
- **Node.js:** The primary backend language, utilizing Express.js for the API.
20-
21-
- **Express.js:** Fast, unopinionated, minimalist web framework for Node.js.
22-
23-
- **Docker:** Containerization platform used for isolating code execution environments.
24-
25-
- **Python:** Supported language for code execution.
26-
27-
- **Java (OpenJDK):** Supported language for code execution.
28-
29-
- **uuid:** For generating unique identifiers for temporary execution directories.
30-
31-
## 📋 Prerequisites
5+
Whether you're experimenting with a new idea or teaching code, ExecuteMe gives you a real-time, sandboxed environment that works out of the box.
326

7+
## ✨ Features
8+
- **⚡ Instant Code Execution** – Run your code in real-time with just one click
9+
- **🔒 Secure Sandbox** – Ensures your code runs in a safe, isolated environment
10+
- **🧠 Multi-language Support** – Supports a growing list of languages including:
11+
- 🐍 Python
12+
- 🟨 JavaScript
13+
- 🟦 TypeScript
14+
- ☕ Java
15+
- 💙 Kotlin
16+
- **🎨 Full Syntax Highlighting** – Modern and readable code editor with theme support
17+
- **🖥️ Responsive UI** – Works smoothly across all devices
18+
- **🌐 Live User Activity** – Shows active coders in real-time
19+
- **💾 Open Source** – Freely available to use, modify, and contribute
20+
21+
## 🛠️ Built With
22+
- **⚛️ NextJs** – For frontend and tailwindcss for designing user interface
23+
- **🧰 Monaco Editor** – Powerful web-based code editor (from VS Code)
24+
- **🌍 Node.js + Express** – Backend service for execution management
25+
- **🔄 Docker** – Containerized code execution
26+
- **📡 Socket.IO** – Real-time connection to track active users
27+
- **📁 NodeCache** – In-memory cache for managing live sessions
28+
- **🔐 Custom Docker Images** – Tailored environments per language
29+
30+
## 🧩 Architecture & Execution Challenges
31+
Designing ExecuteMe required solving real-world challenges in scalability, isolation, and memory/resource management:
32+
33+
## ⚙️ On-Demand Container Execution
34+
- 📦 Each execution triggers a **new Docker container**, isolated per language and user
35+
- 🧾 Code is saved temporarily in a unique `UUID` directory (e.g., `/temp/<uuid>`)
36+
- 🧼 After execution, both the **container and the temporary code directory** are destroyed automatically
37+
- ✅ Ensures **complete statelessness** and no leftover data between runs
38+
39+
## 🧠 Memory & CPU Management
40+
- 🧠 Containers are limited via flags:
41+
--memory=512m and --cpus=0.5
42+
- 🔁 Ensures no user can overuse system resources
43+
- 🧹 Automatic cleanup after every run helps maintain low disk and memory usage
44+
45+
## 🔁 Concurrent Execution Handling
46+
- ⏱️ Uses `async/await` and `promisify(exec)` to avoid blocking the event loop
47+
- ⚡ Handles **multiple user requests at the same time**, spawning separate containers for each
48+
- 🛠️ Every language is handled via its own custom-built Docker image (`executor-python`, `executor-java`, etc.)
49+
50+
## 🔒 Security Isolation
51+
- 🔐 Code runs in **completely sandboxed containers** with:
52+
- No access to host machine
53+
- No persistent file system or shared memory
54+
- 🚫 Containers are removed after use with --rm to prevent abuse
55+
- ✅ Each language has its own minimal, locked-down Docker image
56+
57+
## 👥 Real-Time User Tracking
58+
- 📡 `Socket.IO + NodeCache` manage user connections in real-time
59+
- 👀 Displays current active users to the frontend
60+
- ♻️ Cleans up cache on disconnect to prevent stale connections
61+
62+
## 📋 Prerequisites - For contribution
3363
Before you get started, ensure you have the following installed on your system:
3464

3565
- [**Docker**](https://docs.docker.com/get-docker/): Docker Engine and Docker Compose (Docker Desktop includes both).
@@ -50,13 +80,20 @@ Before you get started, ensure you have the following installed on your system:
5080
4. Make your changes, write tests, and ensure code quality.
5181
5. Open a Pull Request with a clear description of your work.
5282

83+
## 📄 License
84+
85+
This project is licensed under the MIT License - see the [LICENSE](/LICENSE) file for details.
86+
5387
### Support the Project:
5488

5589
If `executeme` helps you or your project, consider showing your support. Your contributions help maintain and improve this tool for the entire developer community!
5690

5791
- **Sponsor on GitHub:** [https://github.com/sponsors/devlopersabbir](https://github.com/sponsors/devlopersabbir)
5892
- **Buy Me a Coffee:** [https://buymeacoffee.com/devlopersabbir](https://buymeacoffee.com/devlopersabbir)
5993

60-
## 🏁 Conclusion
94+
### Specially Thanks 💕
95+
<a href="https://github.com/devlopersabbir/executeme/graphs/contributors">
96+
<img src="https://contrib.rocks/image?repo=devlopersabbir/executeme" />
97+
</a>
6198

62-
`executeme` offers a powerful, secure, and flexible solution for executing code in a sandboxed environment. By leveraging Docker, it provides the isolation needed for production use cases while remaining easy to integrate and extend. Give it a try for your next project that requires dynamic code execution!
99+
Made with [contrib.rocks](https://contrib.rocks).

0 commit comments

Comments
 (0)