A recreation of the tldraw computer built with React, TypeScript, and the tldraw SDK. This interactive web application allows users to create visual instruction chains using text nodes and instruction nodes connected by arrows, with OpenAI integration for intelligent processing.
- Visual Node Interface: Create and connect text nodes and instruction nodes
- Chain Execution: Build complex instruction chains that execute sequentially
- OpenAI Integration: Leverage ChatGPT API for intelligent text processing and structured responses
- Real-time Updates: See results instantly as output nodes are populated with AI-generated content
- Interactive Canvas: Built on the tldraw SDK for smooth drawing and editing experience
- Add Nodes: Place text nodes (input data) and instruction nodes (processing commands) on the canvas
- Connect with Arrows: Draw arrows to connect text nodes to instruction nodes, creating data flow. Make sure you have text node that the instruction outputs to
- Execute Instructions: When an instruction node runs, it:
- Collects all connected text node inputs
- Combines instruction and input texts into a prompt
- Sends the prompt to OpenAI's ChatGPT API
- Receives structured response and injects it into an output text node
- Chain Processing: Execute any instruction in a chain to automatically run all downstream instructions
- Frontend: Vite + React + TypeScript
- Drawing Engine: tldraw SDK
- AI Integration: OpenAI SDK
- Dependencies: dependency-graph + additional utilities
- Package Manager: Yarn
- Node.js (v16 or higher)
- Yarn package manager
- OpenAI API key
-
Clone the repository
git clone https://github.com/your-username/tldraw-computer-repo.git cd tldraw-computer-repo -
Install dependencies
yarn install
-
Set up environment variables
Create a
.envfile in the root directory:cp .env.example .env
Add your OpenAI API key to the
.envfile:VITE_OPENAI_API_KEY=your_openai_api_key_here -
Ensure .gitignore is configured
Verify that
.envis listed in your.gitignorefile to protect your API key:.env
-
Start the development server
yarn dev
-
Open your browser Navigate to the URL shown in your terminal (typically
http://localhost:5173) -
Start Creating
- Add text nodes for your input data
- Add instruction nodes for processing commands
- Connect them with arrows to define data flow
- Click on instruction nodes to execute and see AI-generated results
yarn dev- Start development serveryarn build- Build for productionyarn preview- Preview production buildyarn lint- Run ESLintyarn type-check- Run TypeScript compiler check
We welcome contributions! Please feel free to submit issues and pull requests.
This project is licensed under the MIT License - see the LICENSE file for details.
- tldraw for providing the excellent drawing SDK
- OpenAI for the ChatGPT API
- The original tldraw computer for inspiration
.env file or share your OpenAI API key publicly. Always keep your API credentials secure.
