TA
Talabov/Code_runner_api
Flask API to execute Python code and return results. Lightweight and Docker-ready.
Code Runner API (Python Sandbox)
Production-ready Flask API for secure, sandboxed Python code execution.
Includes rate-limiting, Docker, strong code validation, logging, modular structure — всё, что надо для продакшена и продажи.
🚀 Features
- Safe Python code execution in a temp-file sandbox
- Strict validation (blocks os, subprocess, sys, и прочую дичь)
- Rate limiting (anti-abuse, 3 per minute)
- Docker-ready, clean project structure
- Simple API, easy integration
- Logging (прозрачные логи для аудита)
- Полностью совместим с Postman, curl, любым front-end
📦 Endpoints
POST /run
Request:
{
"code": "print('hello, world!')"
}Response:
{
"stdout": "hello, world!",
"stderr": "",
"returncode": 0
}⏱️ Rate limits
/run: 3 per minute per IP
⚡ Quick Start
Docker (recommended)
docker build -t code-runner-api .
docker run -d -p 5000:5000 code-runner-apiLocal
pip install -r requirements.txt
python app.py🖼️ Screenshots
cmd_server_start.png— Сервер запущенcmd_running_api.png— Живые логи APIpostman_success.png— Успешный запрос через Postman
💡 You can see real examples on the Gumroad gallery.
💼 Ready-to-Use Version
You can get a ZIP version with all files, setup instructions, .env.example, and more:
📬 Contact
Need this in another stack (Node.js, Go, etc)?
Contact: talabov.ali72@gmail.com
Telegram: @talabovali
Note: Pricing may vary depending on complexity and target stack.
Ready for production and monetization. 100% tested.
On this page
Contributors
Created May 27, 2025
Updated June 29, 2025