In addition to middleware, the open-source next.js 12.2 release also introduces a capability known as on-demand Incremental Static Regeneration (ISR), which will help to significantly accelerate website delivery. In the past, organizations might have cached certain website pages in order to enable better performance, at the cost of not always having the most updated information. On-demand ISR will enable the faster delivery of pages with the most current information.
Vercel itself has been accelerating its development efforts over the past year, thanks in no small part to a $150 million funding round the company announced in November 2021. The company has raised a total of $313 million, with a post-money valuation of $2.5 billion. As companies of all sizes have raced to support digital transformation efforts that, more often than not, involve advanced website application functionality, Vercel and the next.js framework have been big benefactors.
“We’ve seen a lot of traction with ecommerce, consumer mobile web apps like TikTok and Twitch, and we’ve seen a lot of success with travel websites, with the majority of top travel websites running on next.js,” Guillermo Rauch, founder and CEO of Vercel, told VentureBeat.
A key highlight of the next.js 12.2 update is the stable release of next.js middleware, which had been in beta since next.js 12.0 first appeared in October 2021.
“It allows you to do everything you would expect to do with other middleware technology like authentication, authorization, redirects and rewrites, as well as personalizing and testing new features,” Rauch said.
“You literally add just one file, middleware.ts, and you start writing your logic,” Rauch said.
The middleware.ts file is in some respects an evolution of the next.js config file that defined the configuration parameters for a deployment. Rauch noted that the config file only provides what he referred to as “rudimentary” options such as custom headers and redirections. With middleware he said that developers can put in any logic that is needed for a business application to run.
Bringing middleware to the edge
It’s one thing for an open-source developer to integrate middleware configurations in application code, but it’s quite another to enable that configuration to run in an optimized approach.
That’s where Vercel’s Edge Middleware capability comes into the picture. Edge Middleware is a commercially supported service that runs next.js on the Vercel platform to provide faster performance and lower latency.
Vercel is the lead developer of the open-source next.js framework and provides a commercial service for supporting and delivering applications at scale. The Vercel service makes use of infrastructure from Amazon Web Services (AWS) as well as Cloudflare.
Moving beyond caching to on-demand ISR
The open-source next.js 12.2 update is also noteworthy for its introduction of on-demand ISR for web content.
Web content can be dynamically generated by a web server, but that process can take time, which is why the use of cached or static content is often preferred for high-traffic applications.
With ISR, Rauch explained, the static content is updated when there is a corresponding update in the source-data sources for a given application. Prior to the next.js 12.2 update, the way ISR worked was with web servers checking for updates on a periodic basis.
What’s next for next.js?
The next.js 12.2 release introduces several experimental capabilities that show possible future directions for the technology.
VentureBeat’s mission is to be a digital town square for technical decision-makers to gain knowledge about transformative enterprise technology and transact. Learn more about membership.