Hugo Hacker News

Why not generate React code from Figma? (a.k.a. why did PageDraw YC18 fail?)

Jefro118 2021-08-17 18:41:33 +0000 UTC [ - ]

I'm working on this with https://pygma.app. I was too quite surprised that no one has done a better job of this yet. One obvious issue is that Figma works in absolute positions and this is generally a bad way of writing CSS, but this is mostly overcome with some simple heuristics. At the moment my product is more like Overlay, which produces code that is visually consistent but often not semantic or what the designer would have intended. I think this can largely be solved with machine learning, computer vision in particular. Uizard seems like the most impressive product in this regard but their use case is slightly different.

Another problem is that most product teams don't just need to generate code once but also keep it in sync with Figma. As far as I can tell, no one has solved the syncing problem in either direction particularly well. I actually think syncing from React -> Figma is not fundamentally difficult but you need to build a big hairy compiler to deal with any React + styling code which would be a PITA. Going in the other direction is more fundamentally difficult I think, probably needs very good machine learning as well.

Also, always love to hear more details about precisely what's so painful and boring about the way you deal with it now?

robertnowell 2021-08-17 23:20:34 +0000 UTC [ - ]

Cool to hear about this

jokethrowaway 2021-08-17 15:38:20 +0000 UTC [ - ]

This is painfully visible in big web agencies with tons of clients.

The flow of designs to be turned into code is relentless, it's almost like a factory.

The reason this doesn't get solved is that you'll always need a developer to smooth the edges, making it responsive, check things work properly everywhere.

There is just too much cruft in the web for full proper automation and there are plenty of frontend developers who barely know how to code but knows how to write React component at a relatively low price.

For individual product companies the effort to create something like this would be too big. Adopting an emergent third party solution instead of throwing frontenders at the problem would be a risky proposition.

Agencies would be the perfect candidate for buying something like this but the cost of developers can easily be passed down to the customer - and if they're big enough to have a lot of clients, they make money because of their brand, not because they're particularly cheap.

I don't think we'll see a solution to this before General Artificial Intelligence; the incentives for building a custom solution for this problem are low and the cost is relatively high.

Maybe if the web as we know were to become simpler / standardised (imagine having native views with native components configured by web services, instead of the wild west of an html page) this could become doable.

robertnowell 2021-08-17 23:25:51 +0000 UTC [ - ]

Interesting, do you have experience with web agency work? I've never thought about the challenges they face, but they must face this challenge all the time

jokethrowaway 2021-08-18 13:59:08 +0000 UTC [ - ]

Yes, I worked with some of them and I have close friends running them.

They definitely have this problem all the time.

Imagine having n PM from big brands who need to build some websites / landing pages and don't want to commit their own development resources (either they don't have them, or they do).

Agencies generally have internal project managers to match the clients and extract requirements.

A common pattern is to have some developers and designers on the payroll (but the pay is not great, it's hard to get good talent) and a few contractors you worked with on the side for more exotic projects (eg. if a client wants a 3d website).

The designers come up with the designs. Sometimes the client will have their own design.

Often times the design + some notes on the side can replace a standard requirements documents.

After that the designs are sent to the developers who convert it into code and deploy, usually with some sort of CMS (WordPress is still pretty popular, Django as well).

The project gets demoed and adjustments / bugfixing starts.

Etheryte 2021-08-16 19:21:28 +0000 UTC [ - ]

There have been attempts at tools like this more or less as long as I can remember. The earliest one I recall seeing was Adobe Photoshop exporting sliced designs, but I'm sure there were similar takes earlier too. There are two main issues that are more or less universal: generating reasonable code, and drawing the rest of the owl. The first part does not need much explanation, teaching a machine to generate reasonable code that's understandably structured is akin to teaching a machine to program in general. Context is hard and the output of such programs is generally a big mess. The second problem is drawing the rest of the owl [0]. Wiring up a frontend to a backend is not a trivial task, and one that I would argue to date does not have solid universal solutions. There are many companies and libraries trying to address this in different ways, but they all come with their own pains. Asking a tool to nail down both of the above issues is a very, very tall order and I don't expect anyone to succeed for the general case anytime soon. I do think great progress can be made in narrower scopes though.

[0] https://knowyourmeme.com/memes/how-to-draw-an-owl

robertnowell 2021-08-16 23:13:59 +0000 UTC [ - ]

I appreciate the thoughtful response.

Wiring up a frontend to a backend isn't a trivial task, but is pretty typical software engineering. If part of the work (the ui) could be done for you, wouldn't that be a clear value-add?

Etheryte 2021-08-17 16:22:29 +0000 UTC [ - ]

Yes and no. For the literal first prototype you get out of the door, yes, having some baseline UI work done for you would be nice. For the sake of the argument, let's assume that the code generated by said tool is at least somewhat reasonably structured so refactoring the code isn't a nightmare either. You wire the UI up to some data and get it out of the door to get some feedback. The problem comes after that initial step — you show the first prototype to some test users or stake holders and figure out what needs to change. Integrating the now changed output of the updated UI with the code you already have will no longer be trivial. So long as the prototype is lean, this will be manageable for some time, but sooner or later it will not. The problem is that for most projects, the initial prototype stage is a very miniscule part of the whole product lifetime. Getting one prototype for cheap can be good, but there are UI prototyping tools that can do this. Using those tools instead of trying to reapply the updated output to your now-existing code base will most likely be less work.

In general I do think that tools in this niche will mature over time, but in my very subjective opinion, they won't be the holy grail of cutting down development time. Most of the time, the hard part of software development is the long haul, not the initial kickoff.

robertnowell 2021-08-17 23:24:03 +0000 UTC [ - ]

Ah, so what you're saying is that a big problem that dev+design teams will encounter is that they need to be able to iterate on designs together, so a real solution here would need to be able to integrate updates to the design into the codebase (and possibly vice versa). Am I understanding your point correctly?

Etheryte 2021-08-18 08:55:59 +0000 UTC [ - ]

Yes, exactly. This is a problem that many teams already struggle with when doing this manually, e.g. which design constraints are shared and which are unique. Context is hard to put into machine language and I see the above issue as one of the main hurdles in this space.

sdrinf 2021-08-17 01:40:23 +0000 UTC [ - ]

What I find particularly funny, looking at the big-picture capability of "designer tool generating extendable code", this was basically available since... visual studio 2005? Yet, no one have found a business model for interfacing figma-react reliably at scale.

OTOH, for the capability itself, you might want to look at https://reactstudio.com/ .

quickthrower2 2021-08-17 08:41:03 +0000 UTC [ - ]

The original ASP.NET of 2002ish had drag and drop interface design like VB6! Although the rails MVC model won out, for simple apps it wasn’t a bad way to develop. It had some pains though, by trying to follow desktop so closely it required a large amount of state data flowing up and down from the page.

plasmic 2021-08-16 18:52:47 +0000 UTC [ - ]

Yeah, we're working on this at Plasmic:

https://www.plasmic.app/

(Our users include ex-PageDraw/Anima users.)

hcho 2021-08-16 21:14:57 +0000 UTC [ - ]

I suspect, genarating components from designs is a pain point for narrow subsection of companies which use React. I also suspect those which have this problem are not in a place to pay. Startups with limited runways, agencies with shoestring budgets are not the most lucrative.

jtchang 2021-08-16 21:22:33 +0000 UTC [ - ]

Because the issue is the interactions between the components and not the components themselves.

mpbeauj 2021-08-17 15:26:12 +0000 UTC [ - ]

Ding ding