Jamstack crowd rediscovering the server? Netlify introduces new Next.js middleware runtime

Jamstack crowd rediscovering the server? Netlify introduces new Next.js middleware runtime

Netlify, which runs a hosting platform for modern JavaScript frameworks, has introduced a new runtime environment for the Next.js framework, including beta support for its middleware that enables web requests to be transformed on the server.

The new runtime, enabled by an npm package called @netlify/next, includes the ability to do HTML rewrites and add data by calling serverless functions. Support for Next 12 middleware, which runs functions on the server before a request has finished processing, is in beta.

There are some complications, including that middleware runs best in an edge function, but does not do so by default, as explained here. Netlify Edge functions were introduced in April. The Next.js runtime code is open source under the MIT license.

Long-time web professionals may smile at some of the publicity for the new Next.js runtime. Matt Biilmann, co-founder and CEO of Netlify, is known as a pioneer of the Jamstack architecture, which in the words of its official website, “removes the need for business logic to dictate the web experience. It enables a composable architecture for the web where custom logic and 3rd party services are consumed through APIs.”

Now the press release for the updated runtime states that: “Previously, building dynamic personalization with Next.js required either server-side rendering (SSR) or heavy client-side JavaScript. Netlify’s new Next.js Advanced Middleware, available with the Next.js Runtime by Netlify, eliminates these trade-offs.”

This “heavy client-side JavaScript” is a consequence of shifting much of the application logic to the client, with the data behind a web page or application retrieved from microservice APIs. Now Netlify states that “HTML rewrites and page data transforms right from the edge” make it “much easier to deliver custom user experiences such as personalization, localization, authentication, and more while achieving optimal performance.”

In this context, “the edge” is not quite the same as a traditional web server, because the server-side processing takes place on a server closer to the user’s device, though note also the caveat above concerning where the middleware runs. Nevertheless, the model takes the original Jamstack concept and introduces something that looks more like traditional server-side PHP or ASP.NET, even if the company prefers not to call it “server side rendering” (SSR).

This does not mean that Netlify’s new functionality is misguided. On the contrary, the company is offering a modern application platform including CI/CD, scheduled functions, observability and low latency thanks to its edge network, without the burden of managing a lot of infrastructure, though in this regard it has plenty of competition.

It does seem though that the pendulum of application architecture moving from client to server and then back is still swinging.