Title: Hi HN! We&#x27;re Jared and Gabe (YC W18), the founders of Pagedraw (<a href="https:&#x2F;&#x2F;pagedraw.io" rel="nofollow">https:&#x2F;&#x2F;pagedraw.io</a>). Pagedraw is a UI builder that turns mockups into React code.<p>Pagedraw lets you annotate mockups with extra information (like how to connect to the backend, resize for different screens, etc.) to get full, presentational, React Components. They’re React Components just like any others, so they can be interleaved freely with handwritten ones. They don’t require any new dependencies and work well with any existing JSX build system.<p>You can import the mockups from Sketch or Figma, or draw them from scratch in Pagedraw.<p>Working as full stack devs, we constantly had to do this translation by hand. It was our least favorite part of our jobs, since the creative work had already been done by the mockup designer. It&#x27;s so repetitive and mechanical that we decided to stop hand-coding divs and css and write a program to do it instead.<p>There have been many attempts to automate this stuff in the past. For 20 years, people have been trying to solve the problem with tools like Dreamweaver, Frontpage, and so on. Broadly speaking, they tended to fall into one of two buckets, each with their own problems.  In one corner are tools like Dreamweaver, which can produce correct code but have to expose some of the underlying HTML model, making their users play a puzzle game to do something as simple as move an object around. In the other corner are freeform design tools that generate position:absolute code.  That doesn’t work if you care about working on different screen sizes, or reflowing the layout around variable-length content as simple as “hello &lt;username&gt;”.<p>We think the problem is that you have to look at it like a compiler. Past tools never fully worked because they tried to unify two fundamentally different mental models: the designer’s mental model of a free form canvas like Sketch or Photoshop, and the DOM’s mental model of &lt;div&gt; followed by a &lt;p&gt; followed by an &lt;img&gt; and so on. What always happens is one of two things: either the computer’s mental model is imposed on the designer, or the designer’s mental model is imposed on the computer. The former results in a clunky design tool, and the latter results in position:absolute.<p>What we do instead is recognize that these are two fundamentally different models. Designers work with Sketch by saying “put this button at this pixel”. We can let them do that and still generate flexbox code without positon:absolute, and let everything resize and reflow correctly. Pagedraw does it by inferring constraints from the relative geometries in the mockup. For example, if object A is to the right of object B, we infer it should always remain to the right, regardless of resizing or content reflowing. Sometimes, the developer does have to ask the designer about their intent regarding resizing, which is why Pagedraw also needs you to annotate that information.  We then compile those constraints, inferred and annotated, into HTML layout mechanisms like inline-block and flexbox.<p>It turns out that a lot of other nice things follow from a compiler-like architecture. For one, we separate codegen correctness from codegen prettiness by cleaning up the generated code in discrete optimization passes. Another is the ability to easily retarget for AngularJS, Backbone, React Native, and so on by just swapping the compiler backend. We even have some nice editor features that fell out from hacking a Lispy interpreter onto our internal representation.<p>We’re excited to see what you all think and hear about your experiences in this area! You can try it at <a href="https:&#x2F;&#x2F;pagedraw.io&#x2F;" rel="nofollow">https:&#x2F;&#x2F;pagedraw.io&#x2F;</a>
Upvote: