Waterwheel, the Drupal SDK ecosystemAugust 29, 2016
Reprinted from the Acquia Developer Center with permission from DC Denison (Senior Editor, Acquia).
As Drupal is increasingly widely used as a back end for application ecosystems, developers of wildly diverse backgrounds are now retrieving and manipulating data from Drupal in unprecedented ways. With Drupal 8 and core REST support articulating an API-first vision for the decoupled future, Drupal is eminently well-prepared to back a bevy of applications with divergent approaches. There's just one problem: non-Drupal developers don't know Drupal.
That's where Waterwheel comes in. Waterwheel is an emerging ecosystem of software development kits (SDKs) built by the Drupal community which ease and accelerate development of applications in other technologies. If you will momentarily forgive the flawed metaphor, Waterwheel helps non-PHP and non-Drupal developers "speak" Drupal.
This blog post summarizes the motivations behind SDKs for Drupal-backed applications and how the Waterwheel team has worked to map out a trajectory for Drupal to be utilized not only by PHP and Drupal developers but also by developers of diverse backgrounds who might otherwise have never discovered or considered it.
The API-first CMS
API-first architectures have become increasingly commonplace as the concept of a content management system (CMS) continues to evolve. In the Drupal community, the Web Services and Context Core Initiative (WSCCI) confronted this trend early by providing the means for Drupal 8 sites to expose data for the benefit of other sites. Today, one Drupal back end is capable of powering a wide range of applications, whether ancillary single-page or native applications or other back-end applications.
In the last several years, the widening prevalence of application ecosystems has been greeted by the advent of the API-first or headless CMS (also referred to as decoupled CMS or “content as a service”). These are content management systems which lack front ends — as a rule — because their sole purpose is to export content for retrieval and manipulation by other applications. Examples include services such as Built.io, CloudCMS, Contentful, and Prismic, which all offer paid subscriptions to build and consume an API in the cloud.
These platforms all have one thing in common: Like Drupal, they are platforms that back application ecosystems. But this is only one half of the picture.
SDKs for building applications
The concept of a software development kit (SDK) is not new in web development, and neither is the idea of connecting an SDK to web services in order to power and supply a decoupled application. Headless CMS platforms like those mentioned above share another common characteristic: the maintenance and release of SDKs that accelerate application development. These SDKs are predominantly free and open-source, despite their dependency on a paid subscription to a headless CMS platform.
With Waterwheel, Drupal challenges these headless CMS services by not only offering a robust series of SDKs to assist application developers but also serving as the best free and open-source API-first CMS on the market. To make Drupal’s web services first-class out of the box, the API-first initiative has been driving progress on both core and contributed modules to improve the developer experience of reading and writing Drupal data. Though SDKs are not intrinsically tied to Drupal core development itself, they serve as an integral piece of Drupal-backed application ecosystems.
The Waterwheel module is required by Waterwheel.js if you wish to implement resource discovery in your application. Resource discovery allows developers desiring client-side validation against server-side entities and their fields to prepopulate an object containing metadata about what entities and fields are available for retrieval and manipulation. Formerly, Waterwheel.js also supported the Entity Query API module and its query operations (e.g. ranges, sorts, and conditions), but this will be superseded in the next minor version by full integration with the emerging JSON API module, where Entity Query API development has migrated.
In sum, Waterwheel.js is uniquely versatile in that it can be used on both server (Node.js) and client (in the browser) and in progressively decoupled or fully decoupled settings. We’re excited to broaden the feature set currently available in Waterwheel.js, especially for a 1.0.0 release in time for DrupalCon Dublin (see our BoF about Waterwheel).
Waterwheel.swift: Drupal for Swift developers
We are also welcoming the Waterwheel.swift SDK, formerly known as the Drupal iOS SDK and the work of Kyle Browning, into the ecosystem as part of a growing suite of SDKs for Drupal-backed applications. Waterwheel.swift provides full support for consuming Drupal 8's core REST API as well as session management and authentication capabilities for the benefit of Swift applications.
Waterwheel.swift supports iOS, macOS, tvOS, and watchOS out of the box with plug-and-play functionality for each of these platforms. Because it leverages Swift, Waterwheel.swift benefits from massive performance gains over the Drupal iOS SDK’s foregoing Objective-C implementation and takes advantage of Swift’s closures, which means anyone who writes Swift will feel very comfortable using it.
For iOS, for instance, it provides a login button which can be placed in any desired location (or subclassed) and will handle showing a custom LoginViewController. To accelerate development even further, Waterwheel.swift also has a waterwheelLoginViewController that provides username and password fields, thus allowing you to incorporate Drupal login and logout functionality into your Swift application with minimal development time.
In an upcoming update, Waterwheel.swift will add full caching of all requests and objects pulled from Drupal. It will be configurable down to the request or globally, but a default for all requests will be included. A demo application of these features is also included in the GitHub repository.
All in all, Waterwheel.swift makes complex communication with Drupal effortless for Apple-driven applications. Because it is built with Swift, you can take advantage of next-generation coding from Apple at your fingertips, and, like Waterwheel.js, you can use it to communicate with Drupal directly without having to understand Drupal’s REST API.
While headless CMS platforms such as Built.io and Contentful benefit from open-source components in the form of application SDKs, Waterwheel spotlights Drupal 8 as a capable and effective API-first CMS that is entirely free and open-source, from data storage to API provisioning to application SDKs and everything in between. With the advent of Waterwheel, paying toward an expensive platform subscription is no longer required — in fact, the sky’s the limit for your unbridled Drupal-backed application ecosystem.
The story of Waterwheel has only just begun. Our ambitious vision is to build upon the successes of Waterwheel.swift’s wide range of application components and Waterwheel.js’ seamless integration with the Drupal core REST API. The end goal is to furnish an ecosystem of SDKs with two significant advantages: For site builders and editors, you will be able to assemble prefabricated Drupal-backed applications without the aid of a developer. For developers, you will have a robust and battle-tested foundation on which to build application components and accelerate Drupal-backed application development.