### Quick Start Commands Source: https://github.com/alexknowshtml/drawbridge/blob/main/README.md Commands to clone, build, and start the Drawbridge server and frontend. ```bash git clone https://github.com/alexknowshtml/drawbridge.git cd drawbridge npm install npm run build npm start # Starts API server on :3062, WebSocket on :3061 npx serve dist # Serve the frontend on :3000 (or any static file server) ``` -------------------------------- ### Install Drawbridge Skill Source: https://github.com/alexknowshtml/drawbridge/blob/main/README.md Commands to copy the Drawbridge skill file into the project's .claude/skills/ directory. ```bash # From your project root mkdir -p .claude/skills/drawbridge cp /path/to/drawbridge/skills/SKILL.md .claude/skills/drawbridge/SKILL.md ``` ```bash mkdir -p .claude/skills/drawbridge cp drawbridge/skills/SKILL.md .claude/skills/drawbridge/SKILL.md ``` -------------------------------- ### GET /api/session/:id Source: https://github.com/alexknowshtml/drawbridge/blob/main/README.md Get current session state (elements, appState, viewport). ```APIDOC ## GET /api/session/:id ### Description Get current session state (elements, appState, viewport). ### Method GET ### Endpoint /api/session/:id ### Parameters #### Path Parameters - **id** (string) - Required - The session identifier. ``` -------------------------------- ### GET /api/sessions Source: https://github.com/alexknowshtml/drawbridge/blob/main/README.md List all active sessions with element and client counts. ```APIDOC ## GET /api/sessions ### Description List all active sessions with element and client counts. ### Method GET ### Endpoint /api/sessions ``` -------------------------------- ### GET /health Source: https://github.com/alexknowshtml/drawbridge/blob/main/README.md Health check returning session and client counts. ```APIDOC ## GET /health ### Description Health check returning session and client counts. ### Method GET ### Endpoint /health ``` -------------------------------- ### GET /api/session/:id/files Source: https://github.com/alexknowshtml/drawbridge/blob/main/README.md Get file metadata for a session (CDN URLs, mime types). ```APIDOC ## GET /api/session/:id/files ### Description Get file metadata for a session (CDN URLs, mime types). ### Method GET ### Endpoint /api/session/:id/files ### Parameters #### Path Parameters - **id** (string) - Required - The session identifier. ``` -------------------------------- ### GET /api/session/:id Source: https://github.com/alexknowshtml/drawbridge/blob/main/skills/SKILL.md Retrieves the current elements for the specified session. ```APIDOC ## GET /api/session/:id ### Description Get current elements for the specified session. ### Method GET ### Endpoint /api/session/:id ### Parameters #### Path Parameters - **id** (string) - Required - The session name identifier. ``` -------------------------------- ### GET /api/session/:id/files/:fileId Source: https://github.com/alexknowshtml/drawbridge/blob/main/README.md Proxy download of a stored image. ```APIDOC ## GET /api/session/:id/files/:fileId ### Description Proxy download of a stored image. Serves the file from DO Spaces through the server to avoid CORS issues. ### Method GET ### Endpoint /api/session/:id/files/:fileId ### Parameters #### Path Parameters - **id** (string) - Required - The session identifier. - **fileId** (string) - Required - The file identifier. ``` -------------------------------- ### Bind Arrows to Shapes Source: https://github.com/alexknowshtml/drawbridge/blob/main/skills/SKILL.md Use the start and end properties with target element IDs to maintain connections when shapes are moved. Do not use internal binding properties. ```json { "type": "arrow", "id": "a1", "x": 300, "y": 150, "width": 200, "height": 0, "points": [[0,0],[200,0]], "endArrowhead": "arrow", "start": { "id": "box1" }, "end": { "id": "box2" } } ``` -------------------------------- ### Set viewport via POST Source: https://github.com/alexknowshtml/drawbridge/blob/main/README.md Updates the camera position and zoom level for the session. ```bash curl -X POST http://localhost:3062/api/session/demo/viewport \ -H "Content-Type: application/json" \ -d '{"x": 0, "y": 0, "width": 800, "height": 600}' ``` -------------------------------- ### Container and Service Deployment Source: https://github.com/alexknowshtml/drawbridge/blob/main/README.md Commands for deploying Drawbridge using podman-compose or systemd. ```bash podman-compose up -d # Builds and starts on port 5050 ``` ```bash systemctl --user enable drawbridge.service systemctl --user start drawbridge.service ``` -------------------------------- ### Render diagrams to SVG or PNG Source: https://github.com/alexknowshtml/drawbridge/blob/main/skills/SKILL.md Commands to render .excalidraw files or live session data into image formats using the provided render script. ```bash # From .excalidraw file (skeleton or resolved elements both work) npx tsx scripts/render.ts input.excalidraw output.png npx tsx scripts/render.ts input.excalidraw output.svg # From a live session curl -s http://localhost:3062/api/session/SESSION_NAME | \ python3 -c "import json,sys; d=json.load(sys.stdin); json.dump({'type':'excalidraw','version':2,'source':'https://excalidraw.com','elements':d['elements'],'appState':{'viewBackgroundColor':'#ffffff','gridSize':None},'files':{}}, open('/tmp/diagram.excalidraw','w'))" npx tsx scripts/render.ts /tmp/diagram.excalidraw /tmp/diagram.png ``` -------------------------------- ### Push elements to Excalidraw Live via HTTP API Source: https://github.com/alexknowshtml/drawbridge/blob/main/skills/SKILL.md Use the HTTP API to send elements to a live session. Ensure the session name is correctly specified in the URL. ```bash curl -s -X POST http://localhost:3062/api/session/SESSION_NAME/elements \ -H "Content-Type: application/json" \ -d '{"elements": [...]}' ``` -------------------------------- ### Upload file via POST Source: https://github.com/alexknowshtml/drawbridge/blob/main/README.md Uploads an image file to DO Spaces; requires valid Spaces credentials. ```bash curl -X POST http://localhost:3062/api/session/demo/files \ -H "Content-Type: application/json" \ -d '{"fileId": "abc123", "dataURL": "data:image/png;base64,...", "mimeType": "image/png"}' ``` -------------------------------- ### Project Directory Structure Source: https://github.com/alexknowshtml/drawbridge/blob/main/README.md Visual representation of the project file organization and core components. ```text drawbridge/ server.js # Express + WebSocket server lib/ spaces-client.js # DO Spaces upload client data/ # Persisted session data (auto-created) src/ App.tsx # React frontend with Excalidraw component main.tsx # React entry point scripts/ render.ts # Playwright-based PNG/SVG renderer generate-env.sh # Generate .env from credential store skills/ SKILL.md # Claude Code skill (copy to .claude/skills/drawbridge/) index.html # Frontend shell vite.config.ts # Vite build configuration ``` -------------------------------- ### POST /api/session/:id/viewport Source: https://github.com/alexknowshtml/drawbridge/blob/main/README.md Set the camera position and zoom level. ```APIDOC ## POST /api/session/:id/viewport ### Description Set the camera position and zoom level. ### Method POST ### Endpoint /api/session/:id/viewport ### Parameters #### Path Parameters - **id** (string) - Required - The session identifier. ``` -------------------------------- ### Define system architecture with zones Source: https://github.com/alexknowshtml/drawbridge/blob/main/skills/SKILL.md Creates a diagram featuring a labeled zone container and connected architectural components. ```json [ { "type": "text", "id": "title", "x": 200, "y": 10, "text": "System Architecture", "fontSize": 28 }, { "type": "rectangle", "id": "zone-fe", "x": 80, "y": 60, "width": 300, "height": 200, "backgroundColor": "#dbe4ff", "fillStyle": "solid", "roundness": { "type": 3 }, "strokeColor": "#4a9eed", "strokeWidth": 1, "opacity": 35 }, { "type": "text", "id": "zone-fe-label", "x": 100, "y": 66, "text": "Frontend", "fontSize": 16, "strokeColor": "#1971c2" }, { "type": "rectangle", "id": "app", "x": 120, "y": 100, "width": 200, "height": 80, "roundness": { "type": 3 }, "backgroundColor": "#a5d8ff", "fillStyle": "solid", "label": { "text": "React App", "fontSize": 20 } }, { "type": "arrow", "id": "a1", "x": 320, "y": 140, "width": 150, "height": 0, "points": [[0,0],[150,0]], "endArrowhead": "arrow", "label": { "text": "REST API", "fontSize": 14 } }, { "type": "rectangle", "id": "api", "x": 470, "y": 100, "width": 200, "height": 80, "roundness": { "type": 3 }, "backgroundColor": "#d0bfff", "fillStyle": "solid", "label": { "text": "API Server", "fontSize": 20 } } ] ``` -------------------------------- ### POST /api/session/:id/files Source: https://github.com/alexknowshtml/drawbridge/blob/main/README.md Upload an image file to DO Spaces (requires Spaces credentials). ```APIDOC ## POST /api/session/:id/files ### Description Upload an image file to DO Spaces (requires Spaces credentials). ### Method POST ### Endpoint /api/session/:id/files ### Parameters #### Path Parameters - **id** (string) - Required - The session identifier. ``` -------------------------------- ### Append elements to session via POST Source: https://github.com/alexknowshtml/drawbridge/blob/main/README.md Adds new elements to an existing canvas for progressive drawing. ```bash curl -X POST http://localhost:3062/api/session/demo/append \ -H "Content-Type: application/json" \ -d '{"elements": [...]}' ``` -------------------------------- ### Define three-tier architecture with zones Source: https://github.com/alexknowshtml/drawbridge/blob/main/README.md Demonstrates grouping elements within a visual zone and connecting components across tiers. ```json [ { "type": "text", "id": "title", "x": 200, "y": 10, "text": "System Architecture", "fontSize": 28 }, { "type": "rectangle", "id": "zone-fe", "x": 80, "y": 60, "width": 300, "height": 200, "backgroundColor": "#dbe4ff", "fillStyle": "solid", "roundness": { "type": 3 }, "strokeColor": "#4a9eed", "strokeWidth": 1, "opacity": 35 }, { "type": "text", "id": "zone-fe-label", "x": 100, "y": 66, "text": "Frontend", "fontSize": 16, "strokeColor": "#1971c2" }, { "type": "rectangle", "id": "app", "x": 120, "y": 100, "width": 200, "height": 80, "roundness": { "type": 3 }, "backgroundColor": "#a5d8ff", "fillStyle": "solid", "label": { "text": "React App", "fontSize": 20 } }, { "type": "arrow", "id": "a1", "x": 320, "y": 140, "width": 150, "height": 0, "points": [[0,0],[150,0]], "endArrowhead": "arrow", "start": { "id": "app" }, "end": { "id": "api" }, "label": { "text": "REST API", "fontSize": 14 } }, { "type": "rectangle", "id": "api", "x": 470, "y": 100, "width": 200, "height": 80, "roundness": { "type": 3 }, "backgroundColor": "#d0bfff", "fillStyle": "solid", "label": { "text": "API Server", "fontSize": 20 } } ] ``` -------------------------------- ### Structure for .excalidraw files Source: https://github.com/alexknowshtml/drawbridge/blob/main/skills/SKILL.md The required JSON structure for saving elements as an .excalidraw file. ```json { "type": "excalidraw", "version": 2, "source": "https://excalidraw.com", "elements": [ /* your elements array */ ], "appState": { "viewBackgroundColor": "#ffffff", "gridSize": null }, "files": {} } ``` -------------------------------- ### Push Elements via HTTP API Source: https://github.com/alexknowshtml/drawbridge/blob/main/README.md Use curl to send a POST request with element data to a specific session. ```bash curl -X POST http://localhost:3062/api/session/my-session/elements \ -H "Content-Type: application/json" \ -d '{ "elements": [ { "type": "rectangle", "id": "b1", "x": 100, "y": 100, "width": 200, "height": 80, "roundness": { "type": 3 }, "backgroundColor": "#a5d8ff", "fillStyle": "solid", "label": { "text": "Hello World", "fontSize": 20 } } ] }' ``` -------------------------------- ### Define Background Zones Source: https://github.com/alexknowshtml/drawbridge/blob/main/README.md Create semi-transparent rectangles to group elements, placing them first in the array for correct z-ordering. ```json { "type": "rectangle", "id": "zone1", "x": 80, "y": 80, "width": 540, "height": 400, "backgroundColor": "#d3f9d8", "fillStyle": "solid", "roundness": { "type": 3 }, "strokeColor": "#22c55e", "strokeWidth": 1, "opacity": 35 } ``` -------------------------------- ### Define Arrow Labels Source: https://github.com/alexknowshtml/drawbridge/blob/main/README.md Attach text to an arrow, which will be centered along the path. ```json { "type": "arrow", "id": "a1", "x": 300, "y": 150, "width": 200, "height": 0, "points": [[0,0],[200,0]], "endArrowhead": "arrow", "label": { "text": "API call", "fontSize": 16 } } ``` -------------------------------- ### Define Arrows Source: https://github.com/alexknowshtml/drawbridge/blob/main/README.md Create arrows using point offsets and specify the arrowhead style. ```json { "type": "arrow", "id": "a1", "x": 300, "y": 150, "width": 200, "height": 0, "points": [[0,0],[200,0]], "endArrowhead": "arrow" } ``` -------------------------------- ### Define Multi-line Labels Source: https://github.com/alexknowshtml/drawbridge/blob/main/README.md Use newline characters within the label text to trigger automatic container resizing. ```json { "type": "rectangle", "id": "task1", "x": 50, "y": 50, "width": 200, "height": 90, "roundness": { "type": 3 }, "backgroundColor": "#ffc9c9", "fillStyle": "solid", "label": { "text": "Fix login bug\nP0 - Critical\n3 users affected", "fontSize": 16 } } ``` -------------------------------- ### Define Background Zones Source: https://github.com/alexknowshtml/drawbridge/blob/main/skills/SKILL.md Group elements using low-opacity rectangles and separate text elements for labels. ```json { "type": "rectangle", "id": "zone1", "x": 80, "y": 80, "width": 540, "height": 400, "backgroundColor": "#d3f9d8", "fillStyle": "solid", "roundness": { "type": 3 }, "strokeColor": "#22c55e", "strokeWidth": 1, "opacity": 35 } ``` ```json { "type": "text", "id": "zone1-label", "x": 100, "y": 86, "text": "Frontend Layer", "fontSize": 16, "strokeColor": "#15803d" } ``` -------------------------------- ### Progressive Drawing Order Source: https://github.com/alexknowshtml/drawbridge/blob/main/README.md Defines the sequence for streaming elements to the viewer to ensure a natural building animation. ```text background zone -> shape -> its arrows -> next shape -> its arrows -> ... ``` -------------------------------- ### POST /api/session/:id/append Source: https://github.com/alexknowshtml/drawbridge/blob/main/README.md Add elements to existing canvas (progressive drawing). ```APIDOC ## POST /api/session/:id/append ### Description Add elements to existing canvas (progressive drawing). ### Method POST ### Endpoint /api/session/:id/append ### Parameters #### Path Parameters - **id** (string) - Required - The session identifier. ``` -------------------------------- ### POST /api/session/:id/elements Source: https://github.com/alexknowshtml/drawbridge/blob/main/skills/SKILL.md Replaces all elements in the specified session with the provided elements array. ```APIDOC ## POST /api/session/:id/elements ### Description Replaces all elements in the specified session. ### Method POST ### Endpoint /api/session/:id/elements ### Parameters #### Path Parameters - **id** (string) - Required - The session name identifier. ``` -------------------------------- ### Replace session elements via POST Source: https://github.com/alexknowshtml/drawbridge/blob/main/README.md Replaces all elements in a specified session using a JSON payload. ```bash curl -X POST http://localhost:3062/api/session/demo/elements \ -H "Content-Type: application/json" \ -d '{"elements": [...]}' ``` -------------------------------- ### POST /api/session/:id/append Source: https://github.com/alexknowshtml/drawbridge/blob/main/skills/SKILL.md Appends new elements to the existing elements in the specified session. ```APIDOC ## POST /api/session/:id/append ### Description Adds elements to existing session elements. ### Method POST ### Endpoint /api/session/:id/append ### Parameters #### Path Parameters - **id** (string) - Required - The session name identifier. ``` -------------------------------- ### Define Standalone Text Source: https://github.com/alexknowshtml/drawbridge/blob/main/skills/SKILL.md Use for titles or annotations. Note that x represents the left edge of the text element. ```json { "type": "text", "id": "t1", "x": 150, "y": 50, "text": "System Architecture", "fontSize": 28 } ``` -------------------------------- ### Define two connected labeled boxes Source: https://github.com/alexknowshtml/drawbridge/blob/main/skills/SKILL.md Creates a diagram with two rectangular nodes connected by an arrow. ```json [ { "type": "rectangle", "id": "b1", "x": 100, "y": 100, "width": 200, "height": 100, "roundness": { "type": 3 }, "backgroundColor": "#a5d8ff", "fillStyle": "solid", "label": { "text": "Start", "fontSize": 20 } }, { "type": "arrow", "id": "a1", "x": 300, "y": 150, "width": 150, "height": 0, "points": [[0,0],[150,0]], "endArrowhead": "arrow", "start": { "id": "b1" }, "end": { "id": "b2" } }, { "type": "rectangle", "id": "b2", "x": 450, "y": 100, "width": 200, "height": 100, "roundness": { "type": 3 }, "backgroundColor": "#b2f2bb", "fillStyle": "solid", "label": { "text": "End", "fontSize": 20 } } ] ``` -------------------------------- ### Undo last operation via POST Source: https://github.com/alexknowshtml/drawbridge/blob/main/README.md Reverts the last operation by replaying the append-only log minus the final entry. ```bash curl -X POST http://localhost:3062/api/session/demo/undo ``` -------------------------------- ### Define an Arrow with a Label Source: https://github.com/alexknowshtml/drawbridge/blob/main/skills/SKILL.md Annotate arrows by including a label object within the arrow definition. ```json { "type": "arrow", "id": "a1", "x": 300, "y": 150, "width": 200, "height": 0, "points": [[0,0],[200,0]], "endArrowhead": "arrow", "label": { "text": "API call", "fontSize": 16 } } ``` -------------------------------- ### POST /api/session/:id/clear Source: https://github.com/alexknowshtml/drawbridge/blob/main/skills/SKILL.md Clears the canvas for the specified session. ```APIDOC ## POST /api/session/:id/clear ### Description Clears the canvas for the specified session. ### Method POST ### Endpoint /api/session/:id/clear ### Parameters #### Path Parameters - **id** (string) - Required - The session name identifier. ``` -------------------------------- ### Define an Arrow Source: https://github.com/alexknowshtml/drawbridge/blob/main/skills/SKILL.md Arrows use points defined as offsets from the element's x,y coordinates. ```json { "type": "arrow", "id": "a1", "x": 300, "y": 150, "width": 200, "height": 0, "points": [[0,0],[200,0]], "endArrowhead": "arrow" } ``` -------------------------------- ### Define Camera Control Source: https://github.com/alexknowshtml/drawbridge/blob/main/README.md Use a cameraUpdate element to automatically frame the viewport to a specific area. ```json { "type": "cameraUpdate", "x": 0, "y": 0, "width": 800, "height": 600 } ``` -------------------------------- ### Define a Labeled Shape Source: https://github.com/alexknowshtml/drawbridge/blob/main/README.md Add a label object to rectangle, ellipse, or diamond shapes for auto-centered text and container resizing. ```json { "type": "rectangle", "id": "r1", "x": 100, "y": 100, "width": 200, "height": 80, "roundness": { "type": 3 }, "backgroundColor": "#a5d8ff", "fillStyle": "solid", "label": { "text": "API Server", "fontSize": 20 } } ``` -------------------------------- ### Define a Labeled Shape Source: https://github.com/alexknowshtml/drawbridge/blob/main/skills/SKILL.md Use the label property to auto-center text within shapes like rectangles, ellipses, or diamonds. Always include roundness type 3 for rounded corners. ```json { "type": "rectangle", "id": "r1", "x": 100, "y": 100, "width": 200, "height": 80, "roundness": { "type": 3 }, "backgroundColor": "#a5d8ff", "fillStyle": "solid", "label": { "text": "API Server", "fontSize": 20 } } ``` -------------------------------- ### POST /api/session/:id/undo Source: https://github.com/alexknowshtml/drawbridge/blob/main/skills/SKILL.md Undoes the last operation performed in the specified session. ```APIDOC ## POST /api/session/:id/undo ### Description Undo last operation in the specified session. ### Method POST ### Endpoint /api/session/:id/undo ### Parameters #### Path Parameters - **id** (string) - Required - The session name identifier. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.