Skip to content

Node.js on VIP

Node.js applications on VIP are provisioned with load-balanced pods with an optional Redis add-on. The VIP Platform is designed to run Node.js web applications—including decoupled/headless frontends to WordPress, microservices, REST APIs, GraphQL APIs, and middleware.

Node.js environments can enable New Relic for insights on performance and help with debugging issues.

Plugins and code examples

A fundamental difference between a WordPress and a Node.js application is the lack of restrictions on the structure of a Node.js application. However, a Node.js application on VIP must fulfill several requirements before it can run successfully on VIP’s infrastructure.

WordPress VIP has authored a selection of plugins and code examples intended to assist developers at all levels of experience to successfully build Node.js applications with greater confidence and efficiency.

  • Node.js Skeleton: All wpcomvip GitHub repositories created for Node.js applications are initialized with a copy of the vip-go-node-skeleton repository. Developers can opt to work with any framework they prefer for their Node.js applications.
    • In its initial state, the repository of a Node.js application is a useful example for the basic requirements necessary to successfully deploy and run a Node.js application on VIP’s infrastructure. Detailed explanations for the basic requirements can be reviewed in the code comments of the entry point /src/index.js.
    • This repository also includes code examples that demonstrate how to use various frameworks and technologies on the VIP Platform.
  • Next.js Boilerplate: The Next.js Boilerplate repository is an optional resource for customers who are using the Next.js framework for decoupled WordPress. The code provided in the repository can be helpful for solving many common use cases for decoupled WordPress applications. The Next.js Boilerplate requires that VIP’s Decoupled Plugin Bundle is installed and activated on the WordPress backend.
  • Decoupled Plugin Bundle: The Decoupled Plugin Bundle provides a selected group of plugins that are designed to quickly set up a decoupled WordPress application. It is designed to support VIP’s Next.js Boilerplate but can be used to support any decoupled frontend. It solves a number of common problems facing decoupled sites, including previewing, permalinks, feeds, and exposing structured data for block-based content.
  • Block Data API plugin: The Block Data API is a REST API for retrieving block editor posts structured as JSON data. While primarily designed for use in decoupled WordPress, the Block Data API plugin can be used anywhere a developer has a need to represent block markup as structured data. For decoupled sites that host the WordPress back end on VIP, the Block Data API plugin is already provided and version managed by VIP MU plugins and can be code enabled.

Limitations

For security and performance reasons, some paths have special behavior across all applications hosted on VIP, even Node.js applications:

  • /wp-admin
  • /wp-content
  • /wp-includes
  • /wp-login

VIP recommends avoiding the use of these paths on Node.js sites. If one of these paths is needed to proxy or redirect a request matching a WordPress site, it should be rewritten. For example, redirect https://nodejs-app.example.com/admin to https://wp-app.example.com/wp-admin/.

Last updated: December 22, 2023

Relevant to

  • Node.js