Next.js is an
open-source
Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use the source code, design documents, or content of the product. The open-source model is a decentralized sof ...
web development framework created by
Vercel enabling
React REACT or React may refer to:
Science and technology
* REACT (telescope), a telescope at Fenton Hill Observatory, New Mexico, US
Computing
* React (JavaScript library) , a JavaScript library for building user interfaces, from Facebook
** React Nat ...
-based web applications with
server-side rendering
Server-side scripting is a technique used in web development which involves employing scripts on a web server which produces a response customized for each user's (client's) request to the website. The alternative is for the web server itself ...
and generating
static websites.
React documentation mentions Next.js among "Recommended Toolchains" advising it to developers as a solution when "Building a server-rendered website with Node.js".
Where traditional React apps can only render their content in the client-side browser, Next.js extends this functionality to include applications rendered on the server-side.
The copyright and trademarks for Next.js are owned by Vercel, which also maintains and leads its open-source development.
Background
Next.js is a
React REACT or React may refer to:
Science and technology
* REACT (telescope), a telescope at Fenton Hill Observatory, New Mexico, US
Computing
* React (JavaScript library) , a JavaScript library for building user interfaces, from Facebook
** React Nat ...
framework that enables several extra features, including
server-side rendering
Server-side scripting is a technique used in web development which involves employing scripts on a web server which produces a response customized for each user's (client's) request to the website. The alternative is for the web server itself ...
and generating
static websites.
React is a
JavaScript library A JavaScript library is a library of pre-written JavaScript code that allows for easier development of JavaScript-based applications, especially for AJAX and other web-centric technologies.
Libraries
With the expanded demands for JavaScript, an e ...
that is traditionally used to build web applications rendered in the client's browser with JavaScript.
Developers recognize several problems with this strategy however, such as not catering to users who do not have access to JavaScript or have disabled it, potential security issues, significantly extended page loading times, and harm to the site's overall
search engine optimization
Search engine optimization (SEO) is the process of improving the quality and quantity of website traffic to a website or a web page from search engines. SEO targets unpaid traffic (known as "natural" or " organic" results) rather than di ...
.
Frameworks such as Next.js sidestep these problems by allowing some or all of the website to be rendered on the server-side before being sent to the client.
Next.js is one of the most popular frameworks for React. It is one of several recommended "toolchains" available when starting a new app, all of which provide a layer of abstraction to aid in common tasks.
Next.js requires
Node.js
Node.js is an open-source server environment. Node.js is cross-platform and runs on Windows, Linux, Unix, and macOS. Node.js is a back-end JavaScript runtime environment. Node.js runs on the V8 JavaScript Engine and executes JavaScript code ou ...
and can be initialized using
Node Package Manager.
Google has contributed to the Next.js project, contributing 43 pull requests in 2019, where they helped in pruning unused JavaScript, reducing loading time, and adding improved metrics.
As of March 2022, the framework is used by many large websites, including
Walmart
Walmart Inc. (; formerly Wal-Mart Stores, Inc.) is an American multinational retail corporation that operates a chain of hypermarkets (also called supercenters), discount department stores, and grocery stores from the United States, headquarter ...
,
Apple
An apple is an edible fruit produced by an apple tree (''Malus domestica''). Apple trees are cultivated worldwide and are the most widely grown species in the genus '' Malus''. The tree originated in Central Asia, where its wild ances ...
,
Nike
Nike often refers to:
* Nike (mythology), a Greek goddess who personifies victory
* Nike, Inc., a major American producer of athletic shoes, apparel, and sports equipment
Nike may also refer to:
People
* Nike (name), a surname and feminine given ...
,
Netflix
Netflix, Inc. is an American subscription video on-demand over-the-top streaming service and production company based in Los Gatos, California. Founded in 1997 by Reed Hastings and Marc Randolph in Scotts Valley, California, it offers a ...
,
TikTok
TikTok, known in China as Douyin (), is a short-form video hosting service owned by the Chinese company ByteDance. It hosts user-submitted videos, which can range in duration from 15 seconds to 10 minutes.
TikTok is an international version ...
,
Uber
Uber Technologies, Inc. (Uber), based in San Francisco, provides mobility as a service, ride-hailing (allowing users to book a car and driver to transport them in a way similar to a taxi), food delivery ( Uber Eats and Postmates), pack ...
,
Lyft
Lyft, Inc. offers mobility as a service, ride-hailing, vehicles for hire, motorized scooters, a bicycle-sharing system, rental cars, and food delivery in the United States and select cities in Canada. Lyft sets fares, which vary using a ...
, and
Starbucks
Starbucks Corporation is an American multinational chain of coffeehouses and roastery reserves headquartered in Seattle, Washington. It is the world's largest coffeehouse chain.
As of November 2021, the company had 33,833 stores in 80 ...
.
In early 2020, it was announced that Vercel had secured twenty-one million dollars in Series A funding to support improvements to the software.
The framework's original author, Guillermo Rauch, is currently the CEO of Vercel, and the project's lead maintainer is Tim Neutkens.
Development history
Next.js was first released as an open-source project on
GitHub
GitHub, Inc. () is an Internet hosting service for software development and version control using Git. It provides the distributed version control of Git plus access control, bug tracking, software feature requests, task management, co ...
on .
It was originally developed based on six principles: out-of-the-box functionality requiring no setup, JavaScript everywhere, all functions are written in JavaScript, automatic code-splitting and server-rendering, configurable data-fetching, anticipating requests, and simplifying deployment.
Next.js 2.0 was announced in March 2017 including several improvements that made it easier to work with small websites. It also increased the build efficiency and improved the scalability of the hot-module replacement feature.
Version 7.0 was released in September 2018 with improved error handling and support for React's context API for improved dynamic route handling. This was also the first version to upgrade to
webpack
Webpack is a free and open-source module bundler for JavaScript. It is made primarily for JavaScript, but it can transform front-end assets such as HTML, CSS, and images if the corresponding loaders are included. Webpack takes modules with depen ...
4.
Version 8.0 was released in February 2019 and was the first version to offer serverless deployment of applications, in which the code is split up into
lambda functions that are run on demand. The version also reduced the time and resources required for static exports and improved prefetch performance.
Version 9.3, announced in March 2020, included various optimizations and global
Sass
Sass, Saß or SASS may refer to:
SASS
* M110 Semi-Automatic Sniper System (or M110 SASS)
* Safe Amplification Site Society, a non-profit organization that promotes music and the arts within Vancouver, British Columbia, Canada
* Shanghai Academ ...
and CSS module support.
On July 27, 2020 Next.js version 9.5 was announced, adding new capabilities including incremental static regeneration, rewrites, and redirect support.
On June 15, 2021 Next.js version 11 was released, introducing among others:
Webpack
Webpack is a free and open-source module bundler for JavaScript. It is made primarily for JavaScript, but it can transform front-end assets such as HTML, CSS, and images if the corresponding loaders are included. Webpack takes modules with depen ...
5 support, preview of real-time collaborative coding functionality "Next.js Live", and experimental function of automatic conversion from Create React App to Next.js compatible form "Create React App Migration".
On October 26, 2021, Next.js 12 was released, adding a Rust compiler, making the compilation faster,
AVIF
AV1 Image File Format (AVIF) is an image file format specification for storing images or image sequences compressed with AV1 in the HEIF container format. It competes with HEIC, which uses the same container format built upon ISOBMFF, but HEV ...
support, Edge Functions & Middleware, and Native ESM & URL Imports.
On October 26, 2022, Vercel released Next.js 13. This major release brought about a new routing pattern with the addition of the ''
app
'' directory that includes support for layouts, React server components, streaming, and a new set of data fetching methods. Furthermore, Vercel announced a next-generation Blazingly Fast™ toolchain for front end development called Turbo, written in Rust consisting of three parts: Turbopack (successor to Webpack), Turborepo (incremental build system), and the Turbo engine (Blazingly Fast™ low-level incremental computation and memoization engine). The major release also includes many additional changes to the Next.js API, but most notably an introduction of a new
@next/font
library, changes to
next/image
, and an enhancement to
next/link
.
Styling and features
Next.js supports styling with
CSS
Cascading Style Sheets (CSS) is a style sheet language used for describing the presentation of a document written in a markup language such as HTML or XML (including XML dialects such as SVG, MathML or XHTML). CSS is a cornerstone t ...
as well as precompiled
Scss and
Sass
Sass, Saß or SASS may refer to:
SASS
* M110 Semi-Automatic Sniper System (or M110 SASS)
* Safe Amplification Site Society, a non-profit organization that promotes music and the arts within Vancouver, British Columbia, Canada
* Shanghai Academ ...
,
CSS-in-JS, and
styled JSX.
In addition, it is built with
TypeScript
TypeScript is a free and open source programming language developed and maintained by Microsoft. It is a strict syntactical superset of JavaScript and adds optional static typing to the language. It is designed for the development of large appl ...
support and smart bundling. The open-source
transpiler
A source-to-source translator, source-to-source compiler (S2S compiler), transcompiler, or transpiler is a type of translator that takes the source code of a program written in a programming language as its input and produces an equivalent ...
Babel
Babel is a name used in the Hebrew Bible for the city of Babylon and may refer to:
Arts and media Written works Books
*Babel (book), ''Babel'' (book), by Patti Smith
* Babel (2012 manga), ''Babel'' (2012 manga), by Narumi Shigematsu
* Babel (20 ...
is used to transform and compile code into JavaScript usable by a browser.
Webpack
Webpack is a free and open-source module bundler for JavaScript. It is made primarily for JavaScript, but it can transform front-end assets such as HTML, CSS, and images if the corresponding loaders are included. Webpack takes modules with depen ...
, another open-source tool, is used to bundle the modules afterward. All of these tools are used with
npm in a terminal.
The main feature of Next.js is its use of server-side rendering to reduce the burden on web browsers and provide enhanced security. This can be done for any part of the application or the entire project, allowing for content-rich pages to be singled out for server-side rendering.
It can also be done only for first-time visitors, to reduce the burden on web browsers that have yet to download any of the site's assets.
The "hot reloading" feature detects changes as they are made and re-renders the appropriate pages so the server avoids the need to be restarted. This allows changes made to the application code to be immediately reflected in the web browser, though some browsers will require the page to be refreshed.
The software uses page-based routing for developer convenience and includes support for dynamic routing. Other features include hot-module replacement so that modules can be replaced live, automatic code splitting, which only includes code necessary to load the page, and page prefetching to reduce load time.
Next.js also supports Incremental Static Regeneration
and static site generation - a compiled version of the website is usually built during build time and saved as a .next folder. When a user makes a request, the pre-built version which are static HTML pages are cached and sent to them. This makes the load time very fast, but it's not suitable for every website because for interactive sites that change often and utilize a lot of user input will not be suitable.
See also
*
Angular (web framework)
Angular (also referred to as "Angular 2+") is a TypeScript-based, free and open-source web application framework led by the Angular Team at Google and by a community of individuals and corporations. Angular is a complete rewrite from the same ...
*
Gatsby (JavaScript framework)
*
LAMP
*
React (JavaScript library)
React (also known as React.js or ReactJS) is a free and open-source front-end JavaScript library for building user interfaces based on UI components. It is maintained by Meta (formerly Facebook) and a community of individual developers and ...
*
Nuxt.js
Nuxt.js is a free and open source JavaScript library based on Vue.js, Node.js, Webpack and Babel.js. Nuxt is inspired by Next.js, which is a framework of similar purpose, based on React.js.
The framework is advertised as a "Meta-framework fo ...
*
Vue.js
Vue.js (commonly referred to as Vue; pronounced "view") is an open-source model–view–viewmodel front end JavaScript framework for building user interfaces and single-page applications. It was created by Evan You, and is maintained by him a ...
*
JavaScript framework
A web framework (WF) or web application framework (WAF) is a software framework that is designed to support the development of web applications including web services, web resources, and web APIs. Web frameworks provide a standard way to build an ...
References
External links
*
*
*
* {{Cite web, last=Asay, first=Matt, date=2020-06-01, title=How GraphQL turned web development on its head, url=https://www.infoworld.com/article/3545951/how-graphql-turned-web-development-on-its-head.html, access-date=2020-10-20, website=
InfoWorld
''InfoWorld'' (abbreviated IW) is an information technology media business. Founded in 1978, it began as a monthly magazine. In 2007, it transitioned to a web-only publication. Its parent company today is International Data Group, and its sister ...
, language=en
Web frameworks
JavaScript web frameworks
Software using the MIT license
Static website generators
Free static website generators