WordPress Announces Migration to Node.js
WordPress Announces Migration to Node.js
This just in, Wordpress is moving to Node.js. Check out what Node.js is, and why you'd want to move from PHP to Node.js.
Join the DZone community and get the full member experience.Join For Free
What Is Node.js?
Why Go From PHP to Node.js?
If PHP has been rock solid for so many years, what specific things does Node.js do for WordPress that prompted the change? Specifically, it offers these advantages:
- Node.js is fast. Node.js is asynchronous, which helps it create very fast I/O. Synchronous systems that use blocking are slower because each request must be served in turn.
- Node.js was built around modern computing architectures. It is not hampered by decades-old legacy code.
- Node.js “speaks” JSON, allowing developers to use a single syntax from the web browser through the server to the database.
- Node.js makes event loops available on the server. You can quickly write applications to do things like connecting databases to powerful Web APIs.
Node fits the needs of a fast-changing Internet that is increasingly mobile. The Web is becoming ubiquitous, as we see it implemented in everything from appliances to clothing. Node.js is more suited to that environment than PHP.
Two Major Challenges
When Matt Mullenweg became CEO of Automattic in January of 2014, he realized the WordPress project had two major challenges:
- Lack of capital
- Limits of current technology
It was the second reason that led him and the Automattic team to consider new approaches. The current codebase has helped the platform grow rapidly–currently, 25 percent of websites on the Internet are powered by WordPress. It is powerful, flexible and cheap to run.
However, one of the downsides has been the area of administration. Mullenweg felt the strengths of WordPress were also creating weaknesses for wp-admin–the administration section of WordPress–and they needed a new plan for the future.
One of the main challenges was that they needed to step away from backward compatibility to get a fresh start, yet one of the platform’s strengths has always been that it was compatible with every release. In contrast, some other popular content management systems like Drupal routinely broke backward compatibility to be able to use the latest technology bells and whistles. It didn’t always make users happy, but it kept the platform on the cutting edge.
100 Percent Open Source
Calypso is 100 percent open source, written using libraries from Node.js and React.js. React.js, originally created by developers at Facebook to build user interfaces that worked across many platforms, is used for the user-facing front end.
Calypso is entirely driven by open representational state transfer (REST) APIs that are available to everyone. The open API means you can manage any of your sites through Calypso. It is blazing fast with pages that load almost instantly, and you can now employ social features like statistics and notifications.
One of WordPress’ strengths is the ability to run multiple sites off the same database. However, managing many blogs can be daunting. Calypso lets you manage many WordPress sites from one administration screen off of any desktop computer, smartphone or mobile device.
Currently, Calypso is deployed on WordPress.com, the site that hosts many free WordPress blogs. Just how big is WordPress.com? Consider these numbers. In 2014:
- More than 18 million new blogs were created–that’s about 50,000 per day
- More than 550 million posts were published–that’s the equivalent of 1.5 million per day
- 47 million posts were originated from mobile devices
Self-Hosted WordPress Sites
If you have a self-hosted WordPress site, you can still take advantage of Node.js developments through the Jetpack plugin. To make it work, you must have a WordPress.com account. Jetpack connects to WordPress.com, which allows you to:
- Edit and administrate all of your blogs
- Manage pages, posts, themes, menus, plugins and various settings
- Write and edit posts very quickly
There is also an application available for Macintosh OS X, with other platforms like Windows to be released soon.
First Step Forward
Calypso is the first step in what many see as a continuing move of WordPress.com from the safe harbors of PHP and MySQL. In effect, the site is becoming a client for the API, similar to any application that uses the API. That makes it speedier and lighter for the mobile computing environment that is taking over the world.
With Calypso and Node.js, end users can expect a better experience with WordPress–pages will load faster and respond snappier. Users that also function as webmasters on their own blogs will benefit from new tools for:
- Multi-site management
- Desktop blogging
- Statistics and analytics
- Website security
- Site monitoring
- Image delivery via CDN
- Stunning Slideshows
- Improvements in sharing capability
Although these features will allow a significant percentage of general users running self-hosted blogs to use Jetpack to replace much of their current plugins, power users will demand more power and the ability to tweak settings and configuration. For that reason, advanced users will more than likely stay with the majority of their plugins.
The Future of PHP and Node.js
Does the implementation of Node.js mean the death knell of PHP? If so, it will take some time. PHP is a tough racehorse and has been carrying WordPress around the track for 13 years.
Node.js may take over PHP eventually — it has made huge inroads:
- After a successful Black Friday test, Walmart began moving their mobile traffic to Node.js.
- Early on, Yahoo started to migrate to Node.js for their Web stack.
- LinkedIn reported giant performance gains when they began implementing Node.js.
At this point, Calypso is an administration area with a dashboard. It’s really a combination of React.js with Node.js sitting on the server to generate the Web page. It then talks to the WordPress site through a REST API, and the site is still written in PHP.
However, the future of computing is mobile, and Node.js is a clear winner on distributed devices and the Internet of Things. The way forward isn’t entirely clear, but you can expect Node.js to be in the driver’s seat for a very long time.
Running a Node.js app? Make sure to check out my Node.js Cheat Sheet.
Published at DZone with permission of Omed Habib , DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.