How devhelpr/code-flow-canvas works
Project type and purpose
• This is a full-stack monorepo for a browser-based visual programming system ("Codeflowcanvas") that lets users build, run, and export “flows” (node graphs) in vanilla JS/TS.
• It uses an Nx/Lerna monorepo to manage multiple shared libraries and two “apps”:
• apps/vps-web – the main front-end SPA (Vite + TS + DOM components + web workers for execution)
• apps/vps-api – a small Deno service that can serve HTML or static assets via REST endpoints
File structure
• Top-level orchestrator: nx.json, lerna.json, package.json, tsconfig.base.json
• apps/ – two runnable targets:
• vps-web: Vite/React-like SPA, Playwright and Vitest tests, custom Babel JSX plugin, web-workers in src/app/ai-flow-engine-worker, IndexedDB storage.
• vps-api: Deno service, entry main.ts, HTML-from-API endpoint.
• libs/ – six distinct packages providing core architecture:
• visual-programming-system: core canvas, state machines, thumbs/geometry, reactivity, themes
• web-flow-executor: business-logic engine that interprets/executes a flow JSON at runtime
• app-canvas: glue code to render flows, host command handlers, importers/exporters (OCIF, Tldraw), follow-path animations
• dom-components: a tiny framework for web components/atoms
• media-library: asset management library
• ocif: import/export schema support
• tools/, .github/workflows: CI (build, test), CD (npm publish, deploy to Cloudflare via wrangler)
README
• Confirms it’s a “Generic Visual programming system using vanilla DOM and JS.”
• Running instructions (npm start → Vite dev of vps-web; Deno for vps-api).
• No DB or external 3rd-party dependency beyond optional AI or file hosting.
1. Monorepo Orchestrator
– Nx / Lerna / GitHub Actions
2. Shared Libraries
– visual-programming-system
– web-flow-executor
– app-canvas
– dom-components
– media-library
– ocif
3. Frontend (apps/vps-web)
– Vite dev server / build
– Browser
– Web Worker (ai-flow-engine-worker)
– IndexedDB storage provider
– UI pages / flows / test harness
4. Backend (apps/vps-api)
– Deno HTTP server
– html-from-api endpoint
5. CI/CD & Deployment
– GitHub Actions (ci.yml, deploy.yml)
– Wrangler (Cloudflare Workers)
– npm registry (package publish)
b. Relationships & data flow
• Monorepo → builds/publishes libs & apps
• apps/vps-web imports Shared Libraries (visual-programming-system, web-flow-executor, app-canvas, dom-components, media-library, ocif)
• Browser UI ↔ Web Worker for heavy flow execution
• Browser UI ↔ IndexedDB for flow persistence
• apps/vps-api ↔ static assets or flow definitions (optional hosting)
• CI pipeline triggers build & deploy of apps and libs → Cloudflare / npm
c. Architectural patterns & principles
– Monorepo modularization: well-scoped TS packages with isolated tsconfig & vite.config
– Layered UI: DOM components (dom-components) → Canvas host (app-canvas) → Core rendering & execution (visual-programming-system + web-flow-executor)
– Worker offload: heavy compute in ai-flow-engine-worker
– Import/Export abstraction: OCIF schema library
– IndexedDB abstraction for persistence
d. Key technologies & frameworks
– Nx / Lerna, TypeScript, Vite, Babel (custom JSX), Deno, Vitest, Playwright
– Web components / vanilla DOM for UI, Web Workers for concurrency, IndexedDB for storage
– OCIF & tldraw exporters