Graphql-js: Why Node and not HHVM?

Created on 29 Oct 2015  路  21Comments  路  Source: graphql/graphql-js

Hi,

What was the reasoning by the Facebook team to go with a Node back-end implementation as a reference system instead of using HHVM and Hack?

Scott

Most helpful comment

Our internal Facebook version of GraphQL is built in Hack, and we're working to get it into a state where we can open source it, ideally later next year. We decided to build a reference implementation for the new GraphQL spec in JavaScript for a couple reasons:

1) There is a huge JavaScript community, it's one of the most commonly known languages, and it's very easy to get a JavaScript environment up and running to test things. This is ideal for a reference implementation which is likely to be ported to many other languages by the community.

2) GraphQL is not just a server runtime but also a suite of client utilities. At Facebook we use JavaScript for a lot of our client tools, and it's very convenient when building tools that can run in a browser. Having a single reference implementation which can power both a server and client tools is very compelling.

3) It's very easy to get a JavaScript server up for free using Parse's cloud code. This allows us to illustrate new examples very quickly.

Ultimately we wish for GraphQL's server to be implemented in just about every language people care to use for building web services. Hack/PHP is obviously an important one for Facebook and the web community, and one we hope to include soon.

All 21 comments

Yes, but 80%+ of web backends are built with PHP. To port from Hack to PHP (or the other way around) would be a whole lot easier and would probably mean a lot more community support for the project.

http://w3techs.com/technologies/overview/programming_language/all

JS at 0.2% against PHP at 81.5%!!!

And, Facebook has its roots in PHP. I also believe this project has the potential to end up causing a lot of PHP infrastructures to be modernized.

Scott

Our internal Facebook version of GraphQL is built in Hack, and we're working to get it into a state where we can open source it, ideally later next year. We decided to build a reference implementation for the new GraphQL spec in JavaScript for a couple reasons:

1) There is a huge JavaScript community, it's one of the most commonly known languages, and it's very easy to get a JavaScript environment up and running to test things. This is ideal for a reference implementation which is likely to be ported to many other languages by the community.

2) GraphQL is not just a server runtime but also a suite of client utilities. At Facebook we use JavaScript for a lot of our client tools, and it's very convenient when building tools that can run in a browser. Having a single reference implementation which can power both a server and client tools is very compelling.

3) It's very easy to get a JavaScript server up for free using Parse's cloud code. This allows us to illustrate new examples very quickly.

Ultimately we wish for GraphQL's server to be implemented in just about every language people care to use for building web services. Hack/PHP is obviously an important one for Facebook and the web community, and one we hope to include soon.

Hack/PHP is obviously an important one for Facebook and the web community, and one we hope to include soon.

This is great news. Thanks for answering. And hopefully, the Hack/PHP version will be out a bit sooner than the end of next year. I certainly am hoping so. :smile:

Scott

@leebyron Any update on HackLang implementation of GraphQL?

This is something we're actively working on now. We don't have a time frame for a date to release code, and we're still in the early phase of having a version that is detached from the particulars of Facebook's internal working and spec compliant. The plan is to publish this sometime later this year ideally.

Thanks for the update Lee.

For anyone interested in something that is available now, there is a PHP version.

https://github.com/webonyx/graphql-php

Still in beta though, but looks fairly promising.

Scott

@leebyron - could it be possible to get an update?

Scott

This is something we're actively working on right now for our internal use, but there's currently no time frame for an open source release. The team is interested in an open source release in the future, perhaps later this year.

Yeah I heard something similar about HHVM release for Windows and it has been 3 years since :stuck_out_tongue_winking_eye: . So, better not count on this

Any chance on getting an update on the public release of this Hack version? @leebyron We are getting closer to the end of the year? 馃槃

Scott

There's no planned time frame for an open source HHVM server, though the team is still interested in doing so at some point in the future.

Ok, Thanks for the quick response. All I can say is, I think an HHVM version would put both HHVM and GraphQL much more in the open source spotlight from a PHP community perspective.

Scott

@leebyron - any Updates?

(@锟O侊浚@)

So everyone else knows, I've given up on a Facebook driven HHVM reference GraphQL server solution and also on PHP in general for my backend with GraphQL. (and despite the hard work of others doing a good PHP GraphQL implementation). There is just soooo much more work and cool things being done on the Node front for GraphQL, I couldn't resist.

Scott

any Updates?

@ae1080, @1331Inv, @smolinari and any others who may be interested. We still don't have any concrete dates to announce related to an HHVM open source release, however we continue to be interested in making that happen. Jan Jergus recently gave a talk on what we've been focused on over the last couple of years on the HHVM side, as well as what we're working on right now and some forward-looking discussion. Check out the video here.

Thanks for the update Greg (@wincent). As I mentioned above, I'm now in the node world for the backend and am quite happy. In fact, it is pretty cool only needing to work in one language. 馃槃

Scott

For what it's worth, I'm still interested in the HHVM version.

Any plans to open-source the Hack/PHP implementation? Is this the used version inside Facebook?

Hey guys! Is it still in your plans to open source the implementation? Thanks, graphql's awesome!

I highly doubt they will @vmsp, since they haven't already. It's been over 2 years......

Just go with Node. It's great and getting better by leaps and bounds. JavaScript as a backend language with Node is just as powerful as PHP without needing to have any extra asynchronous bits (Hack/HHVM), because it's built into Node from the start.

Scott

Was this page helpful?
0 / 5 - 0 ratings

Related issues

itajaja picture itajaja  路  3Comments

bhough picture bhough  路  3Comments

adriano-di-giovanni picture adriano-di-giovanni  路  3Comments

swist picture swist  路  4Comments

matthewgertner picture matthewgertner  路  4Comments