Next.js explained

Next.js
Logo Alt:The Next.js logo, a stylization of its name
Logo Caption:The Next.js Logo
Author:Guillermo Rauch[1]
Developer:Vercel and the open-source community[2]
Released:[3]
Latest Preview Version:v14.3.0-canary.4 [4]
Programming Language:JavaScript, TypeScript, and Rust
Platform:Web platform
Size:17.0 MB
Genre:Web application framework
License:MIT License

Next.js is an open-source web development framework created by the private company Vercel providing React-based web applications with server-side rendering and static website generation.

React documentation mentions Next.js among "Recommended Toolchains" advising it to developers when "building a server-rendered website with Node.js".[5] 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.[6]

Background

Next.js is a React framework that enables several extra features, including server-side rendering and generating static websites.[7] React is a JavaScript library 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. 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.[8] 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.[9] Next.js requires Node.js and can be initialized using Node Package Manager.

Google has contributed to the Next.js project, including 43 pull requests in 2019.[10] As of March 2022, the framework is used by many large websites, including Walmart, Apple, Nike, Netflix, TikTok, Uber, Lyft, and Starbucks. In early 2020, Vercel raised $21 million 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.[11]

Development history

Next.js was first released as an open-source project on GitHub on October 25, 2016. 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.[12]

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.[13]

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 4.[14]

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.[15]

Version 9.3, announced in March 2020, included various optimizations and global Sass and CSS module support.[16]

On July 27, 2020 Next.js version 9.5 was announced, adding new capabilities including incremental static regeneration, rewrites, and redirect support.[17]

On June 15, 2021 Next.js version 11 was released, introducing among others: Webpack 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".[18]

On October 26, 2021, Next.js 12 was released, adding a Rust compiler, making the compilation faster, AVIF support, Edge Functions & Middleware, and Native ESM & URL Imports.[19]

On October 26, 2022, Vercel released Next.js 13. This major release brought about a new routing pattern in beta, with the addition of the App Router that includes support for layouts, React Server Components, streaming, and a new set of data fetching methods. Furthermore, Vercel announced a new toolchain for front-end development called Turbo, including Turbopack as a successor to Webpack, Turborepo for incremental build systems.[20]

In May 2023, Vercel released Next.js 13.4. This brought with it the stable version of App Router, which allows developers to use it in production.[21]

In October 2023, Vercel released Next.js 14. Which comes with improve memory management with using edge runtime.[22]

Styling and features

Next.js supports styling with CSS as well as precompiled Scss and Sass, CSS-in-JS, and styled JSX. In addition, it is built with TypeScript support and smart bundling.[23] The open-source transpiler SWC is used to transform and compile code into JavaScript usable by a browser.[24] Webpack, another open-source tool, is used to bundle the modules afterward, however it is currently being replaced with TurboPack.[25] 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 system, 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[26] 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, particularly for interactive sites that change often and utilize a lot of user input.

See also

External links

Notes and References

  1. Web site: Matt. Asay. How Next.js aims to simplify front-end development. 2020-10-20. TechRepublic. 21 April 2020. en. 2020-06-03. https://web.archive.org/web/20200603082105/https://www.techrepublic.com/article/how-next-js-aims-to-simplify-front-end-development/. dead.
  2. Web site: vercel/next.js. GitHub. 2019-03-17. 2019-03-16. https://web.archive.org/web/20190316035131/https://github.com/vercel/next.js. live.
  3. Web site: Next.js First Release. GitHub. 2019-03-14. 2019-03-17. 2020-10-10. https://web.archive.org/web/20201010232115/https://github.com/vercel/next.js/releases/tag/1.0.0. live.
  4. Web site: Releases · vercel/next.js . GitHub . Vercel . 2024-04-16 . https://web.archive.org/web/20240416120231/https://github.com/vercel/next.js/releases . 2024-04-16 .
  5. Web site: Recommended Toolchains . 10 July 2021 . React documentation . en-US . HTML.
  6. Web site: Develop. Preview. Ship. For the best frontend teams – Vercel . live . https://web.archive.org/web/20211006015250/https://vercel.com/home . 2021-10-06 . 2020-09-22 . vercel.com . en-US . HTML.
  7. Web site: 2020-07-02. Differences Between Static Generated Sites And Server-Side Rendered Apps. 2020-10-19. Smashing Magazine. en.
  8. Web site: Matt. Asay. Why front-end development may be the new frontier. 2020-10-20. TechRepublic. 2 December 2019. en.
  9. Web site: Lukman . Adebiyi Adedotun . 2020-09-17 . Comparing Styling Methods In Next.js . 2020-10-20 . . en.
  10. Web site: Asay . Matt . February 1, 2020 . An insider's look at Google's web framework contributions to Next.js and more . 2020-10-19 . . en-US.
  11. Web site: Donovan . Ryan . 2020-10-07 . Static site generation with single page app functionality? That's what's coming Next(.js) . 2020-10-20 . Stack Overflow Blog . en-US . html.
  12. Web site: Krill . Paul . 2016-10-31 . Next step after Node.js: Framework for 'universal' JavaScript apps . 2020-10-20 . . en.
  13. Web site: Krill. Paul. 2017-03-28. Next.js 2.0 plays better with React and JavaScript. 2020-10-20. InfoWorld. en.
  14. Web site: Krill . Paul . 2018-09-21 . Next.js 7 framework compiles faster, supports WebAssembly . 2020-10-20 . . en-US.
  15. Web site: Krill . Paul . 2019-02-14 . Next.js 8 now supports serverless apps . 2020-10-20 . . en-US.
  16. Web site: Krill. Paul. 2020-03-12. Next.js upgrade emphasizes static site generation. 2020-10-20. InfoWorld. en.
  17. Web site: Next.js adds incremental static pages regeneration. Paul. Krill. July 27, 2020. InfoWorld. September 22, 2020. October 2, 2020. https://web.archive.org/web/20201002003602/https://www.infoworld.com/article/3568468/nextjs-adds-incremental-static-pages-regeneration.html. live.
  18. Web site: Next.js 11. 2021-07-10.
  19. Web site: Next.js 12. 2021-10-27. nextjs.org. en.
  20. Web site: Orbán . Balázs . 2022-10-25 . Next.js 13 . 2023-06-09 . nextjs.org . en-US.
  21. Web site: Markbåge. Sebastian. Neutkens. Tim. 2023-05-04. Next.js 13.4. 2023-06-07. nextjs.org. en-US.
  22. Web site: 2023-12-08 . Next.js 14.0.0 . 2023-11-26 . nextjs.org . en-US.
  23. Web site: Next.js 8 now supports serverless apps. Paul. Krill. February 14, 2019. InfoWorld. September 22, 2020. October 2, 2020. https://web.archive.org/web/20201002001850/https://www.infoworld.com/article/3340817/nextjs-8-now-supports-serverless-apps.html. live.
  24. Web site: Architecture: Next.js Compiler Next.js . 2023-08-19 . nextjs.org . en.
  25. Web site: Architecture: Turbopack Next.js . 2023-08-19 . nextjs.org . en.
  26. Web site: Incremental Static Regeneration with Next.js . 2022-03-06 . Vercel . en-US.