Skip to content

kno-raziel/sand-canvas

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Sand πŸ–οΈ

AI-Native Design Tool β€” Open-source visual communication between humans and AI agents.

License: MIT

Agent designs β†’ Screenshot β†’ Agent codes. Human reviews β†’ Notes β†’ Agent iterates.

Sand is an AI-first design tool where designs render actual React components. Unlike traditional design tools that use vector primitives, Sand renders real UI library components (daisyUI, your own design system) on an infinite canvas β€” what you see is literally what gets built.

πŸ“Έ Screenshots

Light Mode Dark Mode
Editor Light Editor Dark
Component Panel

Component Panel

✨ Features

  • 🎨 Real Component Rendering β€” Designs use actual React components, not visual approximations
  • πŸ€– 13 MCP Tools β€” Full AI agent integration via Model Context Protocol (stdio)
  • πŸ“¦ Adapter System β€” Bring your own UI library (daisyUI included, add any React lib)
  • πŸ“Έ Screenshot Capture β€” Production-quality PNG exports for agent-driven code generation
  • πŸ’¬ Notes & Comments β€” Human ↔ Agent feedback loop with threaded conversations
  • πŸ“ Flexbox Layout β€” Auto-layout with gap, padding, alignment, fill_container sizing
  • 🎭 Themes & Variables β€” Design tokens with multi-theme support (dark/light)
  • ↩️ Undo/Redo β€” Full history with Immer patches
  • πŸ“± Responsive Design β€” Multiple breakpoint screens (Desktop/Tablet/Mobile)
  • πŸ—‚οΈ File Format β€” .sand JSON files, Git-friendly, Zod-validated

πŸš€ Quick Start

git clone https://github.com/kno-raziel/sand-canvas.git
cd sand-canvas
pnpm install
pnpm --filter @sand/editor dev   # Editor at http://localhost:4003

πŸ“¦ Packages

Package Description
@sand/core Headless document engine β€” Zod schemas, node types, adapter interface, CSS-Class Engine
@sand/mcp-server MCP stdio server with 13 tools for AI agent integration
@sand/adapter-daisyui daisyUI component adapter β€” 14 components across 8 categories
@sand/editor Vite + React canvas editor with @xyflow/react

πŸ—οΈ Architecture

Sand Architecture

Key Design Decisions

  • Sand never generates code. Code generation is the agent's responsibility.
  • Designs render actual React components β€” what you see is what gets built.
  • Screenshots are the primary output β€” higher quality rendering β†’ better agent code.
  • Notes/comments close the feedback loop between human intent and agent execution.
  • Bring your own UI library β€” adapters integrate any component library.

πŸ€– MCP Tools

Sand includes a complete MCP server with 13 tools:

Tool Type Description
get_editor_state Read Active document, open files, schema version
batch_get Read Read nodes by ID or search patterns
batch_design Write Insert/Update/Delete/Copy/Replace/Move/Generate operations
open_document Utility Open or create .sand files
get_screenshot Read DOM-to-PNG capture via WebSocket bridge
snapshot_layout Read Layout rectangles with problem detection
get_variables / set_variables Read/Write Design token and theme definitions
find_empty_space Utility Find available canvas space
search_unique_properties Read Find unique property values across a subtree
replace_matching_properties Write Bulk-replace property values
get_guidelines Read Design guidelines by topic
reply_conversation Write Reply to comment threads

🧩 Creating Your Own Adapter

Sand's adapter system lets you integrate any React component library. Each adapter provides:

  1. A list of components with their prop schemas
  2. A render function for each component
  3. Default prop values

The daisyUI adapter uses the CSS-Class Engine β€” components are just ~10 lines of declarative data:

{
  name: "Button",
  element: "button",
  baseClass: "btn",
  modifiers: {
    variant: { prefix: "btn-", values: ["primary", "secondary", "accent"] },
    size: { prefix: "btn-", values: ["xs", "sm", "md", "lg"] },
  },
  booleans: { outline: { class: "btn-outline" } },
  content: "label",
}

For React component libraries, use the React Wrapper adapter pattern β€” see @sand/core docs.

πŸ“ File Format

Sand uses .sand files β€” JSON documents validated with Zod:

{
  "version": 1,
  "variables": { /* design tokens, themes */ },
  "children": [
    {
      "id": "screen-1",
      "type": "frame",
      "name": "Dashboard",
      "width": 1440, "height": 900,
      "layout": "vertical",
      "children": [
        { "id": "title", "type": "text", "content": "Hello Sand!" },
        { "id": "btn", "type": "ref", "ref": "daisyui-button" }
      ]
    }
  ]
}

πŸ› οΈ Tech Stack

Layer Technology
Canvas @xyflow/react v12+
UI React 19
State Zustand + Immer
Schema Zod
Styling Tailwind CSS 4 + daisyUI 5
MCP @modelcontextprotocol/sdk (stdio)
Screenshots html-to-image
Build Vite 7

🀝 Contributing

See CONTRIBUTING.md for setup instructions, coding guidelines, and how to add components or create adapters.

πŸ“œ License

MIT β€” Free for personal and commercial use.


Sand is inspired by Pencil.dev, the proprietary AI design tool. Sand is the open-source MIT alternative with one key differentiator: designs render actual React components.

About

Sand πŸ–οΈ β€” AI-Native Design Editor for component-driven development. Visual communication between humans and AI agents.

Topics

Resources

License

Contributing

Stars

1 star

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages