README.md (3977B)
1 > [!CAUTION] 2 > ## UI BUG: TERMINAL OVERFLOW ON DESKTOP 3 > 4 > **Affected Pages:** [C++](https://compiler.amit.is-a.dev/cpp) and [Python](https://compiler.amit.is-a.dev/python). 5 > *(Note: The [C](https://compiler.amit.is-a.dev/c) compiler is currently unaffected.)* 6 > 7 > **Issue:** On PCs and Tablets, extremely long lines of code push the terminal section completely off-screen to the right. This does not affect mobile users, as the terminal is positioned below the editor. 8 > 9 > **Planned Fixes:** 10 > * **Auto-Wrap:** Implementing `overflow-wrap` or `white-space: pre-wrap` to keep code within bounds. 11 > * **Resizable Divider:** Adding a draggable slider to manually restore the layout. 12 > 13 > **Status:** Investigating layout constraints for the C++ and Python environments. 14 > 15 > **TO DEVELOPERS:** 16 > If you'd like to fix this, please **fork the repository**, apply your changes (e.g., CSS wrapping or a divider script), and **submit a Pull Request**. I appreciate the help! 17 18 19 # Cloud Code Compiler 20 21 > **A real-time, low-latency code execution platform.** > Built with raw WebSockets, Python `aiohttp`, and a custom C/C++ runner. 22 23 ## 🚀 Live Demo 24 25 [**Try the Compiler**](https://compiler.amit.is-a.dev/) 26 27 ## ⚡ Key Features 28 29 * **Real-time I/O**: Uses WebSockets to stream output character-by-character, allowing for interactive programs (e.g., `input()` in Python or `std::cin` in C++). 30 31 * **Multi-Language Support**: 32 33 * 🐍 **Python 3**: With **Auto-Pip** technology (detects imports and installs packages on the fly). 34 35 * ⚙️ **C / C++**: Full GCC/G++ compilation with standard stream handling. 36 37 * **Cyberpunk UI**: A retro-futuristic, responsive interface built with Tailwind CSS and Xterm.js. 38 39 * **Low Latency**: Persistent connections avoid the overhead of repeated HTTP requests. 40 41 ## 🛠 Tech Stack 42 43 | Component | Technology | 44 | ----- | ----- | 45 | **Frontend** | HTML5, Tailwind CSS, Xterm.js (WebSockets) | 46 | **Backend** | Python 3.10, `aiohttp`, `asyncio` | 47 | **Compilers** | GCC 11, G++, CPython | 48 | **Deployment** | Docker (Planned), Linux Host | 49 50 ## 🏗 Architecture 51 52 ### **The Backend (`backend.py`)** 53 54 The core is an asynchronous Python server using `aiohttp`. It upgrades HTTP requests to WebSocket connections. 55 56 * **Session Handling**: Each tab gets a unique session. 57 58 * **Execution**: Spawns `subprocess` threads to run user code safely on the host. 59 60 * **Stream Redirection**: Captures `stdout` and `stderr` pipes and pushes them to the frontend in real-time. 61 62 ### **The Frontend** 63 64 * **Editor**: A custom `textarea` overlay for code input. 65 66 * **Terminal**: `xterm.js` renders ANSI escape codes (colors) and handles user input during execution. 67 68 ## 📦 Installation & Setup 69 70 ### Prerequisites 71 72 * Python 3.10+ 73 74 * GCC / G++ Compiler 75 76 * Linux/MacOS (Recommended) or Windows (WSL) 77 78 ### 1. Clone the Repository 79 80 ```bash 81 git clone [https://github.com/notamitgamer/cloud-compiler.git](https://github.com/notamitgamer/cloud-compiler.git) 82 cd cloud-compiler 83 ``` 84 85 ### 2. Install Dependencies 86 87 ```bash 88 pip install -r requirements.txt 89 ``` 90 91 ### 3. Run the Backend Server 92 93 ```bash 94 python backend.py 95 ``` 96 97 *The server will start on port 8080 (or the port defined in `backend.py`).* 98 99 ## 🛡 Disclaimer & Liability 100 101 This compiler is a **demonstration project** created by a Computer Science undergraduate. 102 103 * **Security**: Code is currently executed on the host machine without sandboxing. Do not run malicious code. 104 105 * **Liability**: **Amit Dutta** assumes no responsibility for any data loss, security breaches, or damages resulting from the use of this code. Use at your own risk. 106 107 * **Rights**: The author reserves the right to modify or take down the service at any time. 108 109 ## 👨💻 Author 110 111 **Amit Dutta** 112 113 * 🎓 CS Undergraduate (19 y/o) 114 115 * 🌐 [amit.is-a.dev](https://amit.is-a.dev) 116 117 * 🐙 [GitHub](https://github.com/notamitgamer) 118 119 * 📧 [amitdutta4255@gmail.com](mailto:amitdutta4255@gmail.com) 120 121 *Built with ❤️ and ☕ in Kolkata, India.*