

C++ Notebook is a modern, high-performance, interactive code playground for C++ developers, students, and hobbyists. Drawing inspiration from Google Colab and Jupyter Notebooks, it allows you to run independent C++ code cells, view real-time compilation and execution outputs, stream interactive standard input (stdin), and compile using standard C++17, C++20, or C++23 configurations.
🌐 Live Web Version: cpp-notebook.rapiddocs.in
The application runs in two modes:
- Desktop Application: A local-first client built on Tauri, utilizing your machine's local g++ compiler.
- Web Version: A browser-based version that connects securely to a remote sandbox runner to execute C++ code without installing anything locally. You can try the live version directly at cpp-notebook.rapiddocs.in.
- Interactive Cell Environment: Create, drag-and-drop, clone, and execute independent code blocks or formatted Markdown notes.
- Real-Time Interactive Stdin: Pipe user input (cin, scanf) dynamically to your running programs via an integrated console interface.
- Cross-Platform Architecture: Powered by a decoupled frontend that switches between Tauri IPC invoke calls (local execution) and WebSockets (remote sandbox).
- Custom Standards: Swap between c++17, c++20, and c++23 standards on-the-fly.
- Developer Appreciation & Support: Built-in modal next to the help settings panel containing repository links and developer support options.
- Aesthetic Glassmorphism UI: Beautiful, premium dark/light mode designs featuring smooth transitions and micro-animations.
graph TD
A[Frontend: React + TS] -->|Desktop Mode| B[Tauri IPC / Rust Bridge]
A -->|Web Mode| C[WebSocket Client]
B -->|Local System| D[Local Compiler: g++]
C -->|Secure Network| E[Remote Backend Service]
E -->|Sandboxed Process| F[Linux Subprocess / g++]
Loading
🚀 Local Development Setup
1. OS-Specific Prerequisites
To run or build the desktop version, your system needs Node.js, the Rust toolchain, and the g++ compiler installed.
- Node.js: Download and run the installer from Node.js Official Website.
- C++ Compiler (g++):
- Download MSYS2 from msys2.org and run the installer.
- Open MSYS2 UCRT64 terminal and install the toolchain:
pacman -S mingw-w64-ucrt-x86_64-gcc
- Add C:\msys64\ucrt64\bin to your Windows system Environment Variable PATH.
- Tauri Dependencies:
- Download and run the Rust installer from rustup.rs.
- Install Build Tools for Visual Studio 2022 from visualstudio.microsoft.com and select the Desktop development with C++ workload.
- Node.js: Install via Homebrew: brew install node.
- C++ Compiler & Tauri Dependencies:
- Open terminal and install Xcode Command Line Tools:
- Install Rust:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
- Optional (Real GCC instead of Apple Clang): brew install gcc.
🐧 Linux (Ubuntu / Debian)
- Node.js: Install via your package manager or NodeSource.
- C++ Compiler, Tauri & GUI Libraries:
- Run the following command to install the required GTK, WebKit, and build tools:
sudo apt update
sudo apt install -y build-essential curl wget file libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev libwebkit2gtk-4.1-dev
- Rust:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
-
Clone the Repository:
git clone https://github.com/regionalduck/cpp-notebook.git
cd cpp-notebook
-
Install Dependencies:
-
Run Development Server:
- For Web Version (Browser):
- For Desktop Application (Tauri):
-
Build Production Packages:
- Frontend Web Bundle:
- Desktop App Binaries (macOS, Windows, Linux):
🌐 Remote Backend Runner Deployment
The remote sandbox executor lives inside the /backend folder. It is designed to containerize and execute user code securely.
Quick Deploy to Render or Railway
This project is configured with a Dockerfile that works out-of-the-box on Render or Railway.
- Create a new Web Service pointing to your repository.
- Set the Root Directory to backend.
- The build system will automatically compile the Docker container, run the health check endpoint, and expose the WebSocket server.
- Copy your live URL (e.g. https://cpp-notebook-backend.onrender.com/).
- Change the prefix to wss:// (e.g. wss://cpp-notebook-backend.onrender.com).
- Add it to your .env file:
VITE_REMOTE_RUNNER_URL=wss://cpp-notebook-backend.onrender.com
Running the Backend Locally
cd backend
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
python server.py
🔒 Security Practices & Sandbox Limits
To protect servers hosting the remote backend, backend/server.py implements the following safeguards:
- Unprivileged User: The container runs under a locked-down sandbox Linux user with zero superuser access.
- CPU Limits: Terminated automatically if a C++ process consumes > 10 seconds of raw CPU time (stops infinite loops).
- Memory Caps: Capped at 128 MB RAM per execution to prevent out-of-memory crash attacks.
- Process Limits: Max 20 processes to protect against fork-bombs.
- Ephemeral Disk Cleaning: All compiled files, binaries, and source scripts are stored in temporary virtual directories and deleted instantly once execution ends.
This project is licensed under the MIT License - see the LICENSE file for details.