Launch HN: Pagedraw (YC W18) – Compile UI Mockups to React Code
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.
You can import the mockups from Sketch or Figma, or draw them from scratch in Pagedraw.
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's so repetitive and mechanical that we decided to stop hand-coding divs and css and write a program to do it instead.
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 <username>”.
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 <div> followed by a <p> followed by an <img> 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.
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.
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.
We’re excited to see what you all think and hear about your experiences in this area! You can try it at https://pagedraw.io/
[+] [-] cryodesign|8 years ago|reply
I'm using the latest version of Firefox... what features does Chrome have that FF hasn't?
I get it's early stage, so you might have just done a blanket 'If not Chrome show message' check.
If the latest version of FF can support, I would do a more fine grained check.
Will check with Chrome later...
[+] [-] aczerepinski|8 years ago|reply
So luckily they can fix this issue by re-generating their site, using their site.
[+] [-] raphaelrk|8 years ago|reply
Super excited for the Figma + React-native support, I think ~20% of my time this past month was converting our designer's figma sketches into react native!
[+] [-] tmzt|8 years ago|reply
I'm also looking at this problem, but coming to it from a different angle. I'm not a designer, and I'm not at home in Sketch. I'm looking at developers that can take a very well designed and coded HTML page, where the designer themselves has built the interaction design in whatever they feel comfortable in. I'm looking at a model of taking those pages and adapting them in a similar way, into React - or other framework - driven applications.
This comes later. I'm starting with a simple template language that can capture a component-driven design in quick to iterate, programming-in-the-large style. The compiler builds both a backend app which renders HTML that's ready to be infused with reactive goodness without an unsightly flash of re-rendered content.
I'm a one-person show, cranking out a playground site which is now open at https://playground.isymtope.org
[+] [-] baronjensen|8 years ago|reply
[+] [-] jpochtar|8 years ago|reply
[+] [-] notheguyouthink|8 years ago|reply
[+] [-] pavlov|8 years ago|reply
I've worked on React Studio (https://reactstudio.com), which is pretty similar. We also used the compiler metaphor to describe it. The original codegen targets were iOS + Obj-C and Android + Java, and later we built Tizen + C (at a customer's request on their bill) and then React + JS in an attempt to reach a larger audience through a free app. My regret is that we ended up with a sprawling native Mac codebase at a time when a lightweight cloud solution would be more suitable for the average interested potential customer. Oh well. It seemed like the right choice back when generating Xcode projects was the target...
If you don't mind the question, what's your monetization strategy? Right now Pagedraw looks to be completely free, and that's where we ended up with React Studio too. Business-wise, the only thing that's sort of worked for React Studio has been to make customized enterprise editions for large customers. I'm curious if you have something in mind that doesn't involve enterprise sales hell :)
[+] [-] whoisjuan|8 years ago|reply
The reason why I ask is that I tried importing several semi-complex but not uncommon (structure wise) files and I got an error saying that I should make sure that the file is correctly formed.
That right away is bad UX. If the designers need to reformat or change the behavior of their files, then they need to be part of the user journey. Right now there's nothing of that as far as I can tell.
[+] [-] jpochtar|8 years ago|reply
Probably a bug on our side. Could you try emailing the Sketch file to [email protected] and we'll see if we can debug it?
[+] [-] lwhi|8 years ago|reply
Having said that, this looks like it could provide a great starting point for development.
Do you see this product as a tool for developers or a tool for designers to publish their creations directly to the web?
[+] [-] jpochtar|8 years ago|reply
Pagedraw is not a code free tool. It never will be. I don't think it's possible either.
Programming needs to happen in language. Even if you did something like Scratch, (to which I prefer typing,) you still need the arbitrary constructs of language in order to express whatever you want.
Pagedraw is not programming, which only works because we don't really think HTML and CSS are either.
You will absolutely still need to write code to make novel algorithms and custom business logic until the AGI revolution comes. Pagedraw is meant to be used side by side with code implementing the business logic, state management, and anything else novel about your app. Pagedraw will take over more and more of the non-turing complete parts.
Today, with Pagedraw you write state management and API code just like you did before.
> Do you see this product as a tool for developers or a tool for designers to publish their creations directly to the web?
Yes. Both, eventually :) Today the product is a strict replacement for HTML and CSS, so it's something a developer would use to bring designs into production after the designer's done with them.
[+] [-] redindian75|8 years ago|reply
The tool has great potential, if u can address the UX market than the dev market. Devs have many many tools they wont give up, but we do not have any hybrid browser based tools which can take a Figma/Sketch and wire it with logic (maybe Ionic Creator)
[+] [-] zackbrown|8 years ago|reply
Haiku focuses on connecting UX designers with developers through shared version histories (git & npm), on a foundation of animated & interactive code components. Haiku supports Vue, plus React, native iOS and native Android.
[+] [-] shermablanca|8 years ago|reply
https://www.reactathon.com
[+] [-] acemarke|8 years ago|reply
[+] [-] jpochtar|8 years ago|reply
[+] [-] athesyn|8 years ago|reply
[+] [-] yodon|8 years ago|reply
The name in the UI is Text 4, the prop is text3 and the css class is text_4.
That said, I’m totally in love. Can I just ask for Typescript generation, please? (UPDATE: My god it’s already there in the full version - Thank you!)
[+] [-] jpochtar|8 years ago|reply
https://documentation.pagedraw.io/data-binding/
[+] [-] yodon|8 years ago|reply
[+] [-] wgerard|8 years ago|reply
> 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's so repetitive and mechanical that we decided to stop hand-coding divs and css and write a program to do it instead
This is definitely repetitive and annoying, just to add another data point to your own. I think people fundamentally want excellent WYSIWYG tools, it's just that the implementation leaves a lot to be desired usually (e.g. Frontpage). Really glad to see someone take another swing at this.
Quick nitpick: One of the links on your homepage ("Learn more") is broken (https://documentation.pagedraw.io/worfklow, looks like it's missing a trailing slash)
[+] [-] jpochtar|8 years ago|reply
[+] [-] fnando|8 years ago|reply
Internet Explorer all over again. ️
[+] [-] dan1234|8 years ago|reply
[+] [-] jpochtar|8 years ago|reply
[+] [-] ggg9990|8 years ago|reply
[+] [-] unknown|8 years ago|reply
[deleted]
[+] [-] monkmartinez|8 years ago|reply
[+] [-] urda|8 years ago|reply
[+] [-] damienn|8 years ago|reply
[+] [-] aj_g|8 years ago|reply
> You can import the mockups from Sketch or Figma
How do I import Figma designs? I tried the Sketch import, doesn't work through that.
Excited to use this. Congrats on your launch.
[+] [-] jaequery|8 years ago|reply
It would be helpful to know what those limitations are before spending too much time and only to find out it won't work for us.
[+] [-] jpochtar|8 years ago|reply
We give you controls to annotate your design with layout behaviors. The css we generate is 100% accurate to the constraints you specify, but our constraint system doesn't capture 100% of desired layouts (yet!)
We have 2 ways for you to control responsiveness: A flexbox-y constraint system, and media queries (Screen Size Groups). They're roughly the same controls html/css give you, though hopefully presented in a cleaner manner.
[+] [-] nojvek|8 years ago|reply
Dunno how possible it is, but I would definitely pay for a vscode plugin to have a native app like experience.
Design -> Code is definitely a big problem. Creation time is one, but updating should be easy too.
Also I would love a reverse, code -> Design output as well, so it's a two way tweaking experience, where both design and code are always in sync. i.e React -> Sketch
[+] [-] pault|8 years ago|reply
[+] [-] gablg1|8 years ago|reply
[+] [-] nojvek|8 years ago|reply
Do you have plans to open source the backend ? So devs over time can make it even smarter for all sorts of use cases ?
Open source and profitable are orthogonal things. You can still be profitable and build a solid product with a raving community.
[+] [-] jpochtar|8 years ago|reply
We're huge on backwards compatibility (and think everyone should be), which is why we don't want to expose something we haven't stabilized yet. We'll have a way to export our just-before-codegen internal representation (shame on me for forgetting the PL term) once it settles down a bit. It's very much like a DOM, so there's not too much craziness there.
We'll be launching a bunch more backends in the coming weeks, so there's a good chance we'll have first-party support for your favorite framework anyway :)
[+] [-] k__|8 years ago|reply
I often get a new version of a sketch file now and then and would need to import that new version while keeping/updating the old components I already have
[+] [-] jpochtar|8 years ago|reply
We're pretty proud of the mechanism (it fell out almost for free from our live collaboration mechanism!) and will almost certainly blog about it when we have time.
https://documentation.pagedraw.io/sketch/#bring-in-future-in...
[+] [-] ranyefet|8 years ago|reply
How does it work with CSS?
[+] [-] jpochtar|8 years ago|reply
[+] [-] ezconnect|8 years ago|reply
[+] [-] jpochtar|8 years ago|reply
Unfortunately, while most of the editor works in all browsers, getting full support is really hard. We're doing a lot of things that get pretty deep in the browser, so we wanted to lock things down as much as possible.
We almost were electron-only to ensure consistency, and can still give you the electron app today. We felt it was better to launch with Chrome + Electron than just Electron for an optional installation-free experience, which is why we only support Chrome.
I'm personally really sorry as an engineer that we don't support Firefox, Safari, and other browsers yet. It's on our roadmap :)
[+] [-] akatechis|8 years ago|reply
[+] [-] gablg1|8 years ago|reply
[+] [-] typeformer|8 years ago|reply
[+] [-] shawn-butler|8 years ago|reply
I couldn't find any reference to this in your documentation. Exactly how easy and/or do you have any samples projects I can check out? ReactNative would be my primary use and I assume alot of other potential users as well.
[+] [-] gablg1|8 years ago|reply