Architecture
How Fanta’s app shell, design engine, source files, and MCP connect.
Fanta’s desktop executable is built by the fanta Cargo package and named fanta. fig_viewer connects the design UI, canvas, project persistence, and local MCP server to the vendored design engine.
| Area | Source |
|---|---|
| App shell and executable | crates/fanta |
| Design UI, source reload, export, MCP | crates/fig_viewer |
| Agent operation types and guidelines | crates/design_surface |
| Scene graph and edit operations | crates/fanta-doc |
.fnx parser and printer | crates/fanta-fnx |
Project layout and .fant format | crates/fanta-format |
| Figma import | crates/fanta-fig-interop |
| Canvas, rendering, text, human tools | fanta-canvas, fanta-render, fanta-text, fanta-tools |
| Presentation engine | crates/fanta-present |
A project contains fanta.json, .fnx source under pages/ and components/, managed JSON metadata, assets, an AGENTS.md seed, and a fanta.md design specification. Layout v5 stores a variant set in components/<set>/set.json with each member in a child folder; standalone components keep their own component folder. The reader accepts v4 sets and migrates them on the next save. Canvas operations autosave to source; valid source changes reload the canvas; Git tracks the folder. The Code workspace validates the active page or component's FNX and paired JSON against the project before writing them. Structural canvas saves retain supported authored FNX fields and comments on surviving nodes; a lossy destructive change reports a preservation error instead of silently rewriting the source.
The external MCP server runs in the app over a private Unix socket. fanta --mcp-stdio discovers the socket and bridges a client to the focused design. The 13 registered tools use the shared design_surface provider; batch_design streams 43 typed DesignOp values. Content edits form one undoable transaction and roll back if an operation fails; selection and viewport changes are not transactional. batch_get projects requested nodes as a summary, editable style, or raw data; raw requires exact node IDs. The bridge can receive --user-data-dir to target the running instance. The older fanta-app / fanta-ai crate map and fixed HTTP port do not describe this checkout.