Promote Drupal API Client Packages to Drupal NPM Namespace

Created on 12 April 2024, 7 months ago
Updated 16 May 2024, 6 months ago

What is the problem to solve?

Tldr; The Drupal project should offer more official tools under the @drupal namespace on NPM for JavaScript developers using Drupal in a Decoupled context. The Drupal API Client project (funded by the community as part of the Pitch-burgh innovation contest ) has built a series of packages that we believe should be considered for promotion to this namespace.

Pain points

For Drupal to be friendly to JavaScript developers who are using Drupal as an API, Drupal as a project should not be completely un-opinionated in this context.

Part of this is a perception issue.

While it is clearly not the only indicator, representation on npm tells a story here. Searching for Drupal results in a somewhat confusing set of packages, and it is unclear what if any are provided by the Drupal project. Those who know to look for the Drupal organization will only see four narrowly focused packages.

A search for WordPress results in a client, and many packages under the @wordpress namespace. Much of this is likely driven by the block editor, but it still provides the perception that WordPress is serious about JavaScript. Searching for Contentful provides a clear set of utilities, including packages to help consume data from Contentful. Contentful may not be a fair comparison here, since it is a completely headless CMS, but that doesn't change the fact that developers familiar with Contentful may have the expectation that any CMS they work with should have an official set of packages for them to take advantage of. They expect to be able to ‘npm install’ Drupal.

Drupal’s current hands off approach results in practical issues as well.

When building decoupled projects that consume data from Drupal, fetching and managing that data is often handled via custom code. Writing that custom code often requires some knowledge of Drupal’s implementation of JSON:API or other Drupal API endpoints. While packages do exist to help with this, developers need to be aware of them, which may not be the case as they aren’t officially associated with the Drupal organization on npm. These solutions also have various advantages and disadvantages or are tied to a specific framework or library, which can make it more difficult to use the same solution across multiple projects.

We don’t want to limit or narrow the possible solutions in this space, but having no opinions isn’t good for the Drupal project either.

The Drupal API Client

The Drupal API Client is a set of JavaScript packages that simplify the process of interacting with common Drupal APIs. Most commonly, developers will use our JSON:API client to interface with Drupal's JSON:API endpoints, but we also publish a base API Client package that can be extended, a client for Decoupled Router, and may support other Drupal APIs in the future.

The Drupal API Client takes great care to be framework-agnostic and universal. It can be used:

  • with your JavaScript framework of choice, vanilla JavaScript, or even in Drupal itself.
  • with or without TypeScript.
  • on the server, or on the client.
  • with a bundler, or as a script import from a CDN.

With the recent completion of our commitment based on Pitch-burgh funding and the 1.0 release of our JSON:API client package, we believe the project is at a point where it could be considered for promotion to the @drupal namespace on NPM. We also believe that being selected for funding by the community also indicates community support.

Who is this for?

Increased visibility for these packages will serve a few different developer personas.

  • Decoupled Drupal Developers. These packages will benefit developers working within a decoupled architecture - either fully decoupled in a separate JavaScript framework, or progressively decoupled within a Drupal site itself.
  • Developers building tools for the decoupled Drupal ecosystem. Our hope is that these packages will be extended, and also used as dependencies in other projects like front end starter kits. We also hope that this will help drive enhancements and additional contributions to this project.
  • JavaScript Developers outside of the Drupal ecosystem. Increased visibility for ‘official’ tools to interact with Drupal APIs are important for developers who have learned that they must source data from Drupal, or are considering using a Drupal back end. It will help improve the perception that Drupal is a viable option.

Result: what will be the outcome?

As a result of this effort, these packages will be part of the @drupal namespace which will provide increased visibility. This will lead to more developers finding and using them, and hopefully improve the outside perception that the Drupal project is serious about modern JavaScript.

Making the decision to ‘promote’ a community project like this will also force us to answer some other questions that could be important for the future of non-PHP Drupal associated projects.

  • General governance - who has ownership of the project, how is security and security updates handled, standards for releases and release cadence.
    • Note: the project currently has three active maintainers.
  • What does it mean for a package to be promoted to the @drupal namespace? What standards does the project need to achieve?
    • Is there another way to indicate ‘official’ Drupal packages other than the main @drupal namespace?
  • What licensing should apply to projects under the @drupal namespace? See issue from the initial phase of the project
  • What coding standards should apply to Drupal associated projects that use TypeScript?

How can we know the desired result is achieved

We expect promoting the these projects will have the following measurable results:

  • An increase in NPM downloads.
  • An increase in dependents for our NPM packages.
  • An Increase in community contribution and issues.

Resources

🌱 Plan
Status

Active

Component

Idea

Created by

🇺🇸United States brianperry

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024