top of page

Want to generate your own video summary in seconds?

Exploring the Key Features of Next.js 15: Enhancements and Changes

Discover the significant new features and breaking changes in Next.js 15, including performance enhancements, improved developer experience, and security updates.

Video Summary

Next.js 15 has officially launched, bringing with it a host of significant new features and some breaking changes from its predecessor, version 14. The unexpected release of release candidate 2 just six days prior to the full version left many developers feeling confused. One of the standout improvements in this latest iteration is the introduction of a code mod that simplifies the upgrade process. This tool automatically adjusts various components, including Next.js and React versions, making transitions smoother for developers.

A major breaking change in Next.js 15 is the shift to asynchronous request APIs for headers and parameters. These now return promises, which enhances static rendering capabilities significantly. Additionally, the caching mechanism has undergone a substantial revamp; it is no longer aggressive by default. This means developers can now opt-in for caching rather than being forced to opt-out, addressing frustrations that arose with Next.js 14's caching behavior. Notably, API routes are no longer cached by default, and client-side caching for dynamic pages has been reset to zero seconds, which improves the responsiveness of applications.

The changes introduced in Next.js 15 are primarily aimed at enhancing performance and improving the developer experience. One significant update is the rollback of caching defaults, which clarifies what is cached, with almost nothing being cached by default. This version also utilizes React 19, incorporating its release candidate features that further improve the development experience. Debugging hydration errors has become easier, as the source code is now displayed alongside the rendered output, allowing developers to pinpoint issues more effectively.

Another exciting addition is Turbo Pack, a new fast compiler that can be enabled with a simple flag. This tool significantly speeds up development, although it does not impact production performance. Furthermore, a static route indicator has been introduced, helping developers distinguish between static and dynamic pages during the development process. An experimental feature called 'unstable after' allows background tasks, such as logging or emailing, to run after the main request is completed, enhancing the perceived speed of applications.

The new form component is tailored for specific use cases, such as search forms that navigate to another page while pre-populating query parameters. This improvement enhances client-side navigation without requiring full page refreshes, streamlining the user experience. The discussion also highlights several other key updates in Next.js 15, including enhanced TypeScript support, improvements for self-hosting, and bolstered security for server actions.

The speaker notes that when creating a new project, TypeScript types are now included by default, which is a significant benefit for TypeScript users. While self-hosting has seen some improvements, challenges persist due to Vercel's business model. Enhanced security measures for server actions have also been introduced; unused server actions are no longer deployed, and unique action IDs are generated to mitigate potential abuse. However, the speaker emphasizes that security through obscurity is not a reliable strategy, urging developers to ensure their server actions are secure.

Other noteworthy updates include support for ESLint 9, optimizations for application cold start speed, and finer control over static generation, although the latter remains experimental. A particularly important change is that the 'create next app' command now ignores all .env files by default, preventing accidental commits of sensitive information. The speaker encourages viewers to check out their updated Next.js course, which is being refreshed for Next.js 15, offering free updates for current users.

Click on any timestamp in the keypoints section to jump directly to that moment in the video. Enhance your viewing experience with seamless navigation. Enjoy!

Keypoints

00:00:00

Next.js 15 Launch

Next.js 15 has been launched, introducing numerous new features, particularly improvements in caching. The speaker expresses enthusiasm about these changes and plans to discuss breaking changes and upgrade requirements from Next.js 14 to 15.

Keypoint ads

00:00:15

Release Candidate Confusion

The speaker recounts the confusion surrounding the release of Next.js 15's second release candidate just six days before the stable version was launched. This unusual timing, following a lengthy gap since the first release candidate, left the speaker puzzled, especially after investing significant effort into a video that became irrelevant upon the stable release.

Keypoint ads

00:01:00

Upgrade Process

A fresh installation of Next.js 15 is showcased, highlighting the default settings. The speaker emphasizes the convenience of a code mod that simplifies the upgrade process from Next.js 14 to 15, addressing several breaking changes that necessitate minor code adjustments across projects.

Keypoint ads

00:01:50

Breaking Changes Overview

The speaker introduces the first significant breaking change: the transition to asynchronous request APIs. Previously, headers, cookies, and parameters were accessed directly, but now headers are treated as a promise. This change aims to enhance application speed by allowing static rendering of more components, although it requires developers to adapt to the new asynchronous handling.

Keypoint ads

00:02:56

Asynchronous Parameters

In addition to headers, parameters and search parameters are also now asynchronous. The speaker illustrates this with an example of creating a new page that utilizes parameters, indicating that developers will need to adjust their code to accommodate this new asynchronous behavior.

Keypoint ads

00:03:35

Promise Handling

The speaker discusses the transition to using promises in the new Next.js version, emphasizing the need to properly type asynchronous functions. They note that the previous method of handling promises is no longer valid, and the correct approach involves using 'await' to manage asynchronous operations effectively.

Keypoint ads

00:04:23

Caching Changes

A significant change in Next.js 15 is the modification of caching behavior, which was a major pain point in version 14. The speaker highlights that caching is now less aggressive by default, meaning fetches are no longer cached automatically. This allows developers to fine-tune caching strategies, opting in to cache specific data rather than having everything cached by default, which previously led to numerous bugs and complications.

Keypoint ads

00:05:37

API Route Caching

The speaker expresses relief over the removal of default caching for GET route handlers in Next.js. Previously, all API routes were cached, which was deemed a poor design choice. The new version rectifies this by ensuring that API routes are not cached by default, simplifying the development process.

Keypoint ads

00:06:00

Client Router Caching

The speaker addresses a major complaint regarding the client router's caching mechanism in Next.js. In earlier versions, dynamically rendered pages were cached for 30 seconds, which caused issues when users returned to a page expecting fresh data. The new default caching time has been set to zero seconds, allowing for immediate updates and ensuring that users see the most current version of a page without encountering stale data.

Keypoint ads

00:06:46

Caching Changes

The speaker expresses relief over the rollback of caching changes in Next.js, noting that it has become clearer what is cached by default, with almost nothing being cached now. This change enhances the development experience, as the previous caching methods were not enjoyable.

Keypoint ads

00:07:01

React 19 Integration

Next.js is utilizing React 19, specifically the release candidate versions, allowing developers to access beta features. The speaker mentions having a dedicated video discussing the changes in React 19, emphasizing the benefits of using this version with Next.js.

Keypoint ads

00:07:34

Hydration Error Debugging

An improvement in the development experience includes better visibility for hydration errors. The speaker explains that these errors occur when the server-rendered UI does not match the client-rendered UI. The new feature allows developers to see the source code where the error originates, making it easier to debug these complex issues.

Keypoint ads

00:08:04

Turbo Pack Support

Next.js is introducing support for Turbo Pack, a fast compiler designed to enhance code compilation speed. Although Turbo Pack is disabled by default, developers can enable it by adding the '--turbo' flag. The speaker shares personal testing results, indicating that Turbo Pack significantly improves compilation speed during development, although it does not affect production performance.

Keypoint ads

00:09:00

Static Route Indicator

To address static route and caching issues, Next.js has added a static route indicator on every statically rendered page. This feature allows developers to easily identify which pages are static versus dynamic during development, facilitating debugging without needing to build the entire project.

Keypoint ads

00:09:38

Experimental Features

The speaker introduces an experimental feature called 'unstable after,' which aims to enhance application functionality. Although details are limited, the speaker expresses excitement about its potential benefits for developers.

Keypoint ads

00:09:48

Background Tasks

The discussion begins with the importance of handling background tasks like logging and sending emails to admins without making the client wait. This new experimental feature allows developers to run code after sending the response to clients, enhancing the perceived speed of applications. By offloading tasks such as logging and emailing, developers can ensure that the client experience remains smooth and fast, as these tasks are executed post-rendering.

Keypoint ads

00:10:44

Next.js Form Component

The speaker introduces the Next.js form component, emphasizing its specific use case for rendering forms that navigate to another page, particularly for search functionalities. An example is provided where a search form redirects to a search results page, passing the query as a parameter. The speaker demonstrates the implementation, correcting a minor error in the code to ensure the query is properly passed. This form component simplifies the process of client-side navigation, allowing for a seamless user experience without full page refreshes, thus making forms work effectively within Next.js.

Keypoint ads

00:12:58

JavaScript Forms

The speaker emphasizes that if JavaScript hasn't loaded yet, it doesn't necessitate replacing all forms with a new form component. This change should only be made when navigating between different pages, specifically regarding the form's action.

Keypoint ads

00:13:10

Next.js Configuration

Next.js now includes TypeScript support by default when creating a new project, enhancing the experience for TypeScript users. Additionally, there are improvements aimed at self-hosting, although the speaker notes that self-hosting has historically been challenging with Next.js, likely due to Vercel's business model which profits from hosting Next.js applications.

Keypoint ads

00:13:43

Server Actions Security

The speaker discusses enhanced security measures for Server Actions in Next.js, which function as public APIs. Many developers may not realize that their server actions are publicly accessible, leading to potential security oversights. To mitigate this, Next.js will not deploy unused server actions, thus preventing unnecessary code exposure. Furthermore, secure action IDs are introduced, which are unique to each action, making it harder for malicious users to exploit these public APIs.

Keypoint ads

00:14:17

Creating Server Actions

To create a server action, the speaker demonstrates defining a new folder called 'actions' and creating a file named 'server action.ts'. By using 'use server' at the top of the file and exporting an asynchronous function, developers can implement server actions. The speaker illustrates this by creating a simple action that returns 'Hi', which can be tested through a normal form submission.

Keypoint ads

00:15:10

Action ID Functionality

Upon submitting the form, the speaker shows that the console logs 'Hi' each time the button is clicked. In the network tab, a unique 'action ID' is visible for each action, which is designed to enhance security. This action ID is included as a hidden input in the form, and it is periodically recalculated to further reduce the risk of abuse. However, the speaker cautions that despite these measures, the public nature of the code means that security through obscurity is not a reliable form of security.

Keypoint ads

00:16:09

Server Actions Security

The speaker emphasizes the importance of ensuring server actions are secure and publicly accessible, indicating that while some changes may not seem critical, security should always be a priority.

Keypoint ads

00:16:19

ESLint Support Update

Next.js 15 introduces support for ESLint 9, as ESLint 8 has reached its end of life. By default, the application still uses ESLint 8, but developers have the option to upgrade to ESLint 9, which is now supported.

Keypoint ads

00:16:45

Development Speed Improvements

The speaker notes several changes aimed at enhancing development speed and build times in Next.js 15. However, they caution against experimenting with new static generation controls, as these features are experimental and may not be necessary for most applications.

Keypoint ads

00:17:08

Environment File Handling

A significant change in Next.js 15 is that when using 'create-react-next-app', all .env files are now ignored by default. This update helps prevent accidental commits of sensitive information, such as database URLs, which was a common issue in previous versions.

Keypoint ads

00:17:41

Next.js Course Promotion

The speaker promotes their Next.js course, currently being updated from version 14 to 15. They assure that all updates will be provided for free to current students, encouraging viewers to enroll while the course is still at version 14 to benefit from future updates.

Keypoint ads

Did you like this Youtube video summary? 🚀

Try it for FREE!

bottom of page