Yahoo dives deeper down the Node.js rabbit hole with open-source Mojito

Today, Yahoo is open-sourcing Mojito, a bit of software that uses JavaScript and Node.js to run a single codebase on both the client and server side.

Mojito is one of a few Node-centric projects Yahoo’s been brewing. Collectively called Cocktails, they embrace cutting-edge technologies and platforms in a way that is surprising if you haven’t been following developer news from Yahoo over the past couple of years.

Yahoo started dabbling in Cocktails a while ago. Bruno Fernandez-Ruiz, Yahoo’s platform vice president, has called Cocktails “a bunch of tricks to make web applications feel native.”

Today’s release, Mojito, is a first step in that direction.

“There are some JavaScript frameworks out there, and some of them focus on the server side, some run on the client side,” said Fernandez-Ruiz in a recent phone conversation with VentureBeat. “And we’ve been saying for some time that we want people to be able to run the same code on the client side and on the server side.”

From the Yahoo developer blog:

  • Mojito is all JavaScript, that’s good. JavaScript is the single most widely available programming language today, and that’s something worth taking advantage of.
  • Mojito is a true MVC framework, that’s better! MVC is a battle-tested design pattern, having proven its usefulness in desktop apps, in server-side apps, in, today, rich client-side applications. Those who ignore MVC… often reinvent it.
  • But the best part of Mojito is its ability to “blur” the client/server boundary, to let you write you code that runs on the client, or the server. Or both.

The reason, said Fernandez-Ruiz, is all about performance and how mobile web pages are rendered for smartphone users. It’s about speed, and it’s also about experience. “The reality is, if you go around looking at websites on an iPhone, you realize that many web pages just don’t work well,” he said. “Things are partially loaded, sometimes you get blank pages. Most of the time, this is because JavaScript that is downloaded never gets to run on the client … On the desktop, you can get away with murder, but on mobile, it’s another story.”

When mobile users are constantly testing the limits of their 3G networks, the exec said, it adds up to a really crappy experience for everyone.

Mojito is part of Yahoo’s concerted effort to help developers work with mobile users and with mobile networks in mind.

Mojito is just one Cocktail. Manhattan is another; it’s a Node.js hosted environment for Mojito. Apps can be wrapped in a native shell and shipped to the iTunes App Store or the Android Market or simply run in a browser, and Manhattan helps to speed up the user experience access across high- and low-speed networks and to run apps on platforms that don’t have full HTML5/CSS3 support.

Other Cocktails under development right now include Greyhound and Screwdriver; Yahoo has no official word yet on what those products will do or when they might be available to outside developers.

“We have been approaching some developers … to get feedback about our technology stack,” said Fernandez-Ruiz. “There’s a lot of documentation and support to make it healthy, you can’t just dump the code on Github. We have a good track record of open sourcing things and keeping them alive.”

Manhattan will be opened up for use by attendees at this week’s JS Conf. Fernandez-Ruiz said Yahoo plans to gather input and feedback from those developers and use it to determine the next steps for Manhattan.

In the meantime, Mojito is open and available for anyone to use. Fernandez-Ruiz said he hopes developers will take a look a Node, at Mojito, and at their mobile work with new eyes open to the inherent performance benefits these technologies have to offer.

“It’s time to revisit the web, to take a look at mobile networks where people are constrained and where battery life has limits,” he said. “Node.js is, in a way, like a browser that runs on the server. The browser on the mobile phone isn’t that powerful, so Node.js becomes more important.”

“If you look at OSI stack, this is like networking stuff, how you get routed,” Fernandez-Ruiz said. “Your objective is to create network servers that are efficient and low profile, very lean, something that lets you work very close to the kernel. For embedded devices that are partially connected — TVs or car devices, too — Node.js is very interesting.”

Mobile developer or publisher? VentureBeat is studying mobile app analytics. Fill out our 5-minute survey, and we'll share the data with you.