metadata
dict | url
stringlengths 19
103
| markdown
stringlengths 199
68.6k
|
---|---|---|
{
"contentLength": null,
"etag": "W/\"9f3003ae728d71a7a89fbdc42395889c\"",
"lastModifiedHeader": null,
"lastModifiedHtml": null
} | https://nextjs.org/docs/ | Menu
Using App Router
Features available in /app
* [Getting Started](/docs/getting-started)
* [Installation](/docs/getting-started/installation)
* [Project Structure](/docs/getting-started/project-structure)
* [Building Your Application](/docs/app/building-your-application)
* [Routing](/docs/app/building-your-application/routing)
* [Defining Routes](/docs/app/building-your-application/routing/defining-routes)
* [Pages and Layouts](/docs/app/building-your-application/routing/pages-and-layouts)
* [Linking and Navigating](/docs/app/building-your-application/routing/linking-and-navigating)
* [Loading UI and Streaming](/docs/app/building-your-application/routing/loading-ui-and-streaming)
* [Error Handling](/docs/app/building-your-application/routing/error-handling)
* [Redirecting](/docs/app/building-your-application/routing/redirecting)
* [Route Groups](/docs/app/building-your-application/routing/route-groups)
* [Project Organization](/docs/app/building-your-application/routing/colocation)
* [Dynamic Routes](/docs/app/building-your-application/routing/dynamic-routes)
* [Parallel Routes](/docs/app/building-your-application/routing/parallel-routes)
* [Intercepting Routes](/docs/app/building-your-application/routing/intercepting-routes)
* [Route Handlers](/docs/app/building-your-application/routing/route-handlers)
* [Middleware](/docs/app/building-your-application/routing/middleware)
* [Internationalization](/docs/app/building-your-application/routing/internationalization)
* [Data Fetching](/docs/app/building-your-application/data-fetching)
* [Fetching, Caching, and Revalidating](/docs/app/building-your-application/data-fetching/fetching-caching-and-revalidating)
* [Server Actions and Mutations](/docs/app/building-your-application/data-fetching/server-actions-and-mutations)
* [Data Fetching Patterns and Best Practices](/docs/app/building-your-application/data-fetching/patterns)
* [Rendering](/docs/app/building-your-application/rendering)
* [Server Components](/docs/app/building-your-application/rendering/server-components)
* [Client Components](/docs/app/building-your-application/rendering/client-components)
* [Composition Patterns](/docs/app/building-your-application/rendering/composition-patterns)
* [Edge and Node.js Runtimes](/docs/app/building-your-application/rendering/edge-and-nodejs-runtimes)
* [Caching](/docs/app/building-your-application/caching)
* [Styling](/docs/app/building-your-application/styling)
* [CSS Modules](/docs/app/building-your-application/styling/css-modules)
* [Tailwind CSS](/docs/app/building-your-application/styling/tailwind-css)
* [CSS-in-JS](/docs/app/building-your-application/styling/css-in-js)
* [Sass](/docs/app/building-your-application/styling/sass)
* [Optimizing](/docs/app/building-your-application/optimizing)
* [Images](/docs/app/building-your-application/optimizing/images)
* [Videos](/docs/app/building-your-application/optimizing/videos)
* [Fonts](/docs/app/building-your-application/optimizing/fonts)
* [Metadata](/docs/app/building-your-application/optimizing/metadata)
* [Scripts](/docs/app/building-your-application/optimizing/scripts)
* [Bundle Analyzer](/docs/app/building-your-application/optimizing/bundle-analyzer)
* [Lazy Loading](/docs/app/building-your-application/optimizing/lazy-loading)
* [Analytics](/docs/app/building-your-application/optimizing/analytics)
* [Instrumentation](/docs/app/building-your-application/optimizing/instrumentation)
* [OpenTelemetry](/docs/app/building-your-application/optimizing/open-telemetry)
* [Static Assets](/docs/app/building-your-application/optimizing/static-assets)
* [Third Party Libraries](/docs/app/building-your-application/optimizing/third-party-libraries)
* [Memory Usage](/docs/app/building-your-application/optimizing/memory-usage)
* [Configuring](/docs/app/building-your-application/configuring)
* [TypeScript](/docs/app/building-your-application/configuring/typescript)
* [ESLint](/docs/app/building-your-application/configuring/eslint)
* [Environment Variables](/docs/app/building-your-application/configuring/environment-variables)
* [Absolute Imports and Module Path Aliases](/docs/app/building-your-application/configuring/absolute-imports-and-module-aliases)
* [MDX](/docs/app/building-your-application/configuring/mdx)
* [src Directory](/docs/app/building-your-application/configuring/src-directory)
* [Draft Mode](/docs/app/building-your-application/configuring/draft-mode)
* [Content Security Policy](/docs/app/building-your-application/configuring/content-security-policy)
* [Testing](/docs/app/building-your-application/testing)
* [Vitest](/docs/app/building-your-application/testing/vitest)
* [Jest](/docs/app/building-your-application/testing/jest)
* [Playwright](/docs/app/building-your-application/testing/playwright)
* [Cypress](/docs/app/building-your-application/testing/cypress)
* [Authentication](/docs/app/building-your-application/authentication)
* [Deploying](/docs/app/building-your-application/deploying)
* [Production Checklist](/docs/app/building-your-application/deploying/production-checklist)
* [Static Exports](/docs/app/building-your-application/deploying/static-exports)
* [Upgrading](/docs/app/building-your-application/upgrading)
* [Codemods](/docs/app/building-your-application/upgrading/codemods)
* [App Router Migration](/docs/app/building-your-application/upgrading/app-router-migration)
* [Version 14](/docs/app/building-your-application/upgrading/version-14)
* [Migrating from Vite](/docs/app/building-your-application/upgrading/from-vite)
* [Migrating from Create React App](/docs/app/building-your-application/upgrading/from-create-react-app)
* [API Reference](/docs/app/api-reference)
* [Components](/docs/app/api-reference/components)
* [Font](/docs/app/api-reference/components/font)
* [<Image>](/docs/app/api-reference/components/image)
* [<Link>](/docs/app/api-reference/components/link)
* [<Script>](/docs/app/api-reference/components/script)
* [File Conventions](/docs/app/api-reference/file-conventions)
* [default.js](/docs/app/api-reference/file-conventions/default)
* [error.js](/docs/app/api-reference/file-conventions/error)
* [instrumentation.js](/docs/app/api-reference/file-conventions/instrumentation)
* [layout.js](/docs/app/api-reference/file-conventions/layout)
* [loading.js](/docs/app/api-reference/file-conventions/loading)
* [middleware.js](/docs/app/api-reference/file-conventions/middleware)
* [not-found.js](/docs/app/api-reference/file-conventions/not-found)
* [page.js](/docs/app/api-reference/file-conventions/page)
* [route.js](/docs/app/api-reference/file-conventions/route)
* [Route Segment Config](/docs/app/api-reference/file-conventions/route-segment-config)
* [template.js](/docs/app/api-reference/file-conventions/template)
* [Metadata Files](/docs/app/api-reference/file-conventions/metadata)
* [favicon, icon, and apple-icon](/docs/app/api-reference/file-conventions/metadata/app-icons)
* [manifest.json](/docs/app/api-reference/file-conventions/metadata/manifest)
* [opengraph-image and twitter-image](/docs/app/api-reference/file-conventions/metadata/opengraph-image)
* [robots.txt](/docs/app/api-reference/file-conventions/metadata/robots)
* [sitemap.xml](/docs/app/api-reference/file-conventions/metadata/sitemap)
* [Functions](/docs/app/api-reference/functions)
* [cookies](/docs/app/api-reference/functions/cookies)
* [draftMode](/docs/app/api-reference/functions/draft-mode)
* [fetch](/docs/app/api-reference/functions/fetch)
* [generateImageMetadata](/docs/app/api-reference/functions/generate-image-metadata)
* [generateMetadata](/docs/app/api-reference/functions/generate-metadata)
* [generateSitemaps](/docs/app/api-reference/functions/generate-sitemaps)
* [generateStaticParams](/docs/app/api-reference/functions/generate-static-params)
* [generateViewport](/docs/app/api-reference/functions/generate-viewport)
* [headers](/docs/app/api-reference/functions/headers)
* [ImageResponse](/docs/app/api-reference/functions/image-response)
* [NextRequest](/docs/app/api-reference/functions/next-request)
* [NextResponse](/docs/app/api-reference/functions/next-response)
* [notFound](/docs/app/api-reference/functions/not-found)
* [permanentRedirect](/docs/app/api-reference/functions/permanentRedirect)
* [redirect](/docs/app/api-reference/functions/redirect)
* [revalidatePath](/docs/app/api-reference/functions/revalidatePath)
* [revalidateTag](/docs/app/api-reference/functions/revalidateTag)
* [unstable\_cache](/docs/app/api-reference/functions/unstable_cache)
* [unstable\_noStore](/docs/app/api-reference/functions/unstable_noStore)
* [useParams](/docs/app/api-reference/functions/use-params)
* [usePathname](/docs/app/api-reference/functions/use-pathname)
* [useReportWebVitals](/docs/app/api-reference/functions/use-report-web-vitals)
* [useRouter](/docs/app/api-reference/functions/use-router)
* [useSearchParams](/docs/app/api-reference/functions/use-search-params)
* [useSelectedLayoutSegment](/docs/app/api-reference/functions/use-selected-layout-segment)
* [useSelectedLayoutSegments](/docs/app/api-reference/functions/use-selected-layout-segments)
* [userAgent](/docs/app/api-reference/functions/userAgent)
* [next.config.js Options](/docs/app/api-reference/next-config-js)
* [appDir](/docs/app/api-reference/next-config-js/appDir)
* [assetPrefix](/docs/app/api-reference/next-config-js/assetPrefix)
* [basePath](/docs/app/api-reference/next-config-js/basePath)
* [compress](/docs/app/api-reference/next-config-js/compress)
* [crossOrigin](/docs/app/api-reference/next-config-js/crossOrigin)
* [devIndicators](/docs/app/api-reference/next-config-js/devIndicators)
* [distDir](/docs/app/api-reference/next-config-js/distDir)
* [env](/docs/app/api-reference/next-config-js/env)
* [eslint](/docs/app/api-reference/next-config-js/eslint)
* [exportPathMap](/docs/app/api-reference/next-config-js/exportPathMap)
* [generateBuildId](/docs/app/api-reference/next-config-js/generateBuildId)
* [generateEtags](/docs/app/api-reference/next-config-js/generateEtags)
* [headers](/docs/app/api-reference/next-config-js/headers)
* [httpAgentOptions](/docs/app/api-reference/next-config-js/httpAgentOptions)
* [images](/docs/app/api-reference/next-config-js/images)
* [cacheHandler](/docs/app/api-reference/next-config-js/incrementalCacheHandlerPath)
* [instrumentationHook](/docs/app/api-reference/next-config-js/instrumentationHook)
* [logging](/docs/app/api-reference/next-config-js/logging)
* [mdxRs](/docs/app/api-reference/next-config-js/mdxRs)
* [onDemandEntries](/docs/app/api-reference/next-config-js/onDemandEntries)
* [optimizePackageImports](/docs/app/api-reference/next-config-js/optimizePackageImports)
* [output](/docs/app/api-reference/next-config-js/output)
* [pageExtensions](/docs/app/api-reference/next-config-js/pageExtensions)
* [Partial Prerendering (experimental)](/docs/app/api-reference/next-config-js/partial-prerendering)
* [poweredByHeader](/docs/app/api-reference/next-config-js/poweredByHeader)
* [productionBrowserSourceMaps](/docs/app/api-reference/next-config-js/productionBrowserSourceMaps)
* [reactStrictMode](/docs/app/api-reference/next-config-js/reactStrictMode)
* [redirects](/docs/app/api-reference/next-config-js/redirects)
* [rewrites](/docs/app/api-reference/next-config-js/rewrites)
* [serverActions](/docs/app/api-reference/next-config-js/serverActions)
* [serverComponentsExternalPackages](/docs/app/api-reference/next-config-js/serverComponentsExternalPackages)
* [StaleTimes (experimental)](/docs/app/api-reference/next-config-js/staleTimes)
* [trailingSlash](/docs/app/api-reference/next-config-js/trailingSlash)
* [transpilePackages](/docs/app/api-reference/next-config-js/transpilePackages)
* [turbo](/docs/app/api-reference/next-config-js/turbo)
* [typedRoutes](/docs/app/api-reference/next-config-js/typedRoutes)
* [typescript](/docs/app/api-reference/next-config-js/typescript)
* [urlImports](/docs/app/api-reference/next-config-js/urlImports)
* [webpack](/docs/app/api-reference/next-config-js/webpack)
* [webVitalsAttribution](/docs/app/api-reference/next-config-js/webVitalsAttribution)
* [create-next-app](/docs/app/api-reference/create-next-app)
* [Edge Runtime](/docs/app/api-reference/edge)
* [Next.js CLI](/docs/app/api-reference/next-cli)
* [Building Your Application](/docs/pages/building-your-application)
* [Routing](/docs/pages/building-your-application/routing)
* [Pages and Layouts](/docs/pages/building-your-application/routing/pages-and-layouts)
* [Dynamic Routes](/docs/pages/building-your-application/routing/dynamic-routes)
* [Linking and Navigating](/docs/pages/building-your-application/routing/linking-and-navigating)
* [Redirecting](/docs/pages/building-your-application/routing/redirecting)
* [Custom App](/docs/pages/building-your-application/routing/custom-app)
* [Custom Document](/docs/pages/building-your-application/routing/custom-document)
* [API Routes](/docs/pages/building-your-application/routing/api-routes)
* [Custom Errors](/docs/pages/building-your-application/routing/custom-error)
* [Internationalization](/docs/pages/building-your-application/routing/internationalization)
* [Middleware](/docs/pages/building-your-application/routing/middleware)
* [Rendering](/docs/pages/building-your-application/rendering)
* [Server-side Rendering (SSR)](/docs/pages/building-your-application/rendering/server-side-rendering)
* [Static Site Generation (SSG)](/docs/pages/building-your-application/rendering/static-site-generation)
* [Automatic Static Optimization](/docs/pages/building-your-application/rendering/automatic-static-optimization)
* [Client-side Rendering (CSR)](/docs/pages/building-your-application/rendering/client-side-rendering)
* [Edge and Node.js Runtimes](/docs/pages/building-your-application/rendering/edge-and-nodejs-runtimes)
* [Data Fetching](/docs/pages/building-your-application/data-fetching)
* [getStaticProps](/docs/pages/building-your-application/data-fetching/get-static-props)
* [getStaticPaths](/docs/pages/building-your-application/data-fetching/get-static-paths)
* [Forms and Mutations](/docs/pages/building-your-application/data-fetching/forms-and-mutations)
* [getServerSideProps](/docs/pages/building-your-application/data-fetching/get-server-side-props)
* [Incremental Static Regeneration (ISR)](/docs/pages/building-your-application/data-fetching/incremental-static-regeneration)
* [Client-side Fetching](/docs/pages/building-your-application/data-fetching/client-side)
* [Styling](/docs/pages/building-your-application/styling)
* [CSS Modules](/docs/pages/building-your-application/styling/css-modules)
* [Tailwind CSS](/docs/pages/building-your-application/styling/tailwind-css)
* [CSS-in-JS](/docs/pages/building-your-application/styling/css-in-js)
* [Sass](/docs/pages/building-your-application/styling/sass)
* [Optimizing](/docs/pages/building-your-application/optimizing)
* [Images](/docs/pages/building-your-application/optimizing/images)
* [Fonts](/docs/pages/building-your-application/optimizing/fonts)
* [Scripts](/docs/pages/building-your-application/optimizing/scripts)
* [Static Assets](/docs/pages/building-your-application/optimizing/static-assets)
* [Bundle Analyzer](/docs/pages/building-your-application/optimizing/bundle-analyzer)
* [Analytics](/docs/pages/building-your-application/optimizing/analytics)
* [Lazy Loading](/docs/pages/building-your-application/optimizing/lazy-loading)
* [Instrumentation](/docs/pages/building-your-application/optimizing/instrumentation)
* [OpenTelemetry](/docs/pages/building-your-application/optimizing/open-telemetry)
* [Third Party Libraries](/docs/pages/building-your-application/optimizing/third-party-libraries)
* [Configuring](/docs/pages/building-your-application/configuring)
* [TypeScript](/docs/pages/building-your-application/configuring/typescript)
* [ESLint](/docs/pages/building-your-application/configuring/eslint)
* [Environment Variables](/docs/pages/building-your-application/configuring/environment-variables)
* [Absolute Imports and Module Path Aliases](/docs/pages/building-your-application/configuring/absolute-imports-and-module-aliases)
* [src Directory](/docs/pages/building-your-application/configuring/src-directory)
* [MDX](/docs/pages/building-your-application/configuring/mdx)
* [AMP](/docs/pages/building-your-application/configuring/amp)
* [Babel](/docs/pages/building-your-application/configuring/babel)
* [PostCSS](/docs/pages/building-your-application/configuring/post-css)
* [Custom Server](/docs/pages/building-your-application/configuring/custom-server)
* [Draft Mode](/docs/pages/building-your-application/configuring/draft-mode)
* [Error Handling](/docs/pages/building-your-application/configuring/error-handling)
* [Debugging](/docs/pages/building-your-application/configuring/debugging)
* [Preview Mode](/docs/pages/building-your-application/configuring/preview-mode)
* [Content Security Policy](/docs/pages/building-your-application/configuring/content-security-policy)
* [Testing](/docs/pages/building-your-application/testing)
* [Vitest](/docs/pages/building-your-application/testing/vitest)
* [Jest](/docs/pages/building-your-application/testing/jest)
* [Playwright](/docs/pages/building-your-application/testing/playwright)
* [Cypress](/docs/pages/building-your-application/testing/cypress)
* [Authentication](/docs/pages/building-your-application/authentication)
* [Deploying](/docs/pages/building-your-application/deploying)
* [Production Checklist](/docs/pages/building-your-application/deploying/production-checklist)
* [Static Exports](/docs/pages/building-your-application/deploying/static-exports)
* [Multi Zones](/docs/pages/building-your-application/deploying/multi-zones)
* [Continuous Integration (CI) Build Caching](/docs/pages/building-your-application/deploying/ci-build-caching)
* [Upgrading](/docs/pages/building-your-application/upgrading)
* [Codemods](/docs/pages/building-your-application/upgrading/codemods)
* [From Pages to App](/docs/pages/building-your-application/upgrading/app-router-migration)
* [Migrating from Vite](/docs/pages/building-your-application/upgrading/from-vite)
* [Migrating from Create React App](/docs/pages/building-your-application/upgrading/from-create-react-app)
* [Version 14](/docs/pages/building-your-application/upgrading/version-14)
* [Version 13](/docs/pages/building-your-application/upgrading/version-13)
* [Version 12](/docs/pages/building-your-application/upgrading/version-12)
* [Version 11](/docs/pages/building-your-application/upgrading/version-11)
* [Version 10](/docs/pages/building-your-application/upgrading/version-10)
* [Version 9](/docs/pages/building-your-application/upgrading/version-9)
* [API Reference](/docs/pages/api-reference)
* [Components](/docs/pages/api-reference/components)
* [Font](/docs/pages/api-reference/components/font)
* [<Head>](/docs/pages/api-reference/components/head)
* [<Image>](/docs/pages/api-reference/components/image)
* [<Image> (Legacy)](/docs/pages/api-reference/components/image-legacy)
* [<Link>](/docs/pages/api-reference/components/link)
* [<Script>](/docs/pages/api-reference/components/script)
* [Functions](/docs/pages/api-reference/functions)
* [getInitialProps](/docs/pages/api-reference/functions/get-initial-props)
* [getServerSideProps](/docs/pages/api-reference/functions/get-server-side-props)
* [getStaticPaths](/docs/pages/api-reference/functions/get-static-paths)
* [getStaticProps](/docs/pages/api-reference/functions/get-static-props)
* [NextRequest](/docs/pages/api-reference/functions/next-request)
* [NextResponse](/docs/pages/api-reference/functions/next-response)
* [useAmp](/docs/pages/api-reference/functions/use-amp)
* [useReportWebVitals](/docs/pages/api-reference/functions/use-report-web-vitals)
* [useRouter](/docs/pages/api-reference/functions/use-router)
* [userAgent](/docs/pages/api-reference/functions/userAgent)
* [next.config.js Options](/docs/pages/api-reference/next-config-js)
* [assetPrefix](/docs/pages/api-reference/next-config-js/assetPrefix)
* [basePath](/docs/pages/api-reference/next-config-js/basePath)
* [compress](/docs/pages/api-reference/next-config-js/compress)
* [crossOrigin](/docs/pages/api-reference/next-config-js/crossOrigin)
* [devIndicators](/docs/pages/api-reference/next-config-js/devIndicators)
* [distDir](/docs/pages/api-reference/next-config-js/distDir)
* [env](/docs/pages/api-reference/next-config-js/env)
* [eslint](/docs/pages/api-reference/next-config-js/eslint)
* [exportPathMap](/docs/pages/api-reference/next-config-js/exportPathMap)
* [generateBuildId](/docs/pages/api-reference/next-config-js/generateBuildId)
* [generateEtags](/docs/pages/api-reference/next-config-js/generateEtags)
* [headers](/docs/pages/api-reference/next-config-js/headers)
* [httpAgentOptions](/docs/pages/api-reference/next-config-js/httpAgentOptions)
* [images](/docs/pages/api-reference/next-config-js/images)
* [instrumentationHook](/docs/pages/api-reference/next-config-js/instrumentationHook)
* [onDemandEntries](/docs/pages/api-reference/next-config-js/onDemandEntries)
* [optimizePackageImports](/docs/pages/api-reference/next-config-js/optimizePackageImports)
* [output](/docs/pages/api-reference/next-config-js/output)
* [pageExtensions](/docs/pages/api-reference/next-config-js/pageExtensions)
* [poweredByHeader](/docs/pages/api-reference/next-config-js/poweredByHeader)
* [productionBrowserSourceMaps](/docs/pages/api-reference/next-config-js/productionBrowserSourceMaps)
* [reactStrictMode](/docs/pages/api-reference/next-config-js/reactStrictMode)
* [redirects](/docs/pages/api-reference/next-config-js/redirects)
* [rewrites](/docs/pages/api-reference/next-config-js/rewrites)
* [Runtime Config](/docs/pages/api-reference/next-config-js/runtime-configuration)
* [trailingSlash](/docs/pages/api-reference/next-config-js/trailingSlash)
* [transpilePackages](/docs/pages/api-reference/next-config-js/transpilePackages)
* [turbo](/docs/pages/api-reference/next-config-js/turbo)
* [typescript](/docs/pages/api-reference/next-config-js/typescript)
* [urlImports](/docs/pages/api-reference/next-config-js/urlImports)
* [webpack](/docs/pages/api-reference/next-config-js/webpack)
* [webVitalsAttribution](/docs/pages/api-reference/next-config-js/webVitalsAttribution)
* [create-next-app](/docs/pages/api-reference/create-next-app)
* [Next.js CLI](/docs/pages/api-reference/next-cli)
* [Edge Runtime](/docs/pages/api-reference/edge)
* [Architecture](/docs/architecture)
* [Accessibility](/docs/architecture/accessibility)
* [Fast Refresh](/docs/architecture/fast-refresh)
* [Next.js Compiler](/docs/architecture/nextjs-compiler)
* [Supported Browsers](/docs/architecture/supported-browsers)
* [Turbopack](/docs/architecture/turbopack)
* [Community](/docs/community)
* [Contribution Guide](/docs/community/contribution-guide)
On this page
* [What is Next.js?](#what-is-nextjs)
* [Main Features](#main-features)
* [How to Use These Docs](#how-to-use-these-docs)
* [App Router vs Pages Router](#app-router-vs-pages-router)
* [Pre-Requisite Knowledge](#pre-requisite-knowledge)
* [Accessibility](#accessibility)
* [Join our Community](#join-our-community)
[Edit this page on GitHub](https://github.com/vercel/next.js/edit/canary/docs/index.mdx) [Managed Next.js (Vercel)](https://vercel.com/solutions/nextjs?utm_source=next_site&utm_medium=web&utm_campaign=managed_nextjs_solutions_page) Scroll to top
Introduction
============
Welcome to the Next.js documentation!
[What is Next.js?](#what-is-nextjs)
-----------------------------------
Next.js is a React framework for building full-stack web applications. You use React Components to build user interfaces, and Next.js for additional features and optimizations.
Under the hood, Next.js also abstracts and automatically configures tooling needed for React, like bundling, compiling, and more. This allows you to focus on building your application instead of spending time with configuration.
Whether you're an individual developer or part of a larger team, Next.js can help you build interactive, dynamic, and fast React applications.
[Main Features](#main-features)
-------------------------------
Some of the main Next.js features include:
Feature
Description
[Routing](/docs/app/building-your-application/routing)
A file-system based router built on top of Server Components that supports layouts, nested routing, loading states, error handling, and more.
[Rendering](/docs/app/building-your-application/rendering)
Client-side and Server-side Rendering with Client and Server Components. Further optimized with Static and Dynamic Rendering on the server with Next.js. Streaming on Edge and Node.js runtimes.
[Data Fetching](/docs/app/building-your-application/data-fetching)
Simplified data fetching with async/await in Server Components, and an extended `fetch` API for request memoization, data caching and revalidation.
[Styling](/docs/app/building-your-application/styling)
Support for your preferred styling methods, including CSS Modules, Tailwind CSS, and CSS-in-JS
[Optimizations](/docs/app/building-your-application/optimizing)
Image, Fonts, and Script Optimizations to improve your application's Core Web Vitals and User Experience.
[TypeScript](/docs/app/building-your-application/configuring/typescript)
Improved support for TypeScript, with better type checking and more efficient compilation, as well as custom TypeScript Plugin and type checker.
[How to Use These Docs](#how-to-use-these-docs)
-----------------------------------------------
On the left side of the screen, you'll find the docs navbar. The pages of the docs are organized sequentially, from basic to advanced, so you can follow them step-by-step when building your application. However, you can read them in any order or skip to the pages that apply to your use case.
On the right side of the screen, you'll see a table of contents that makes it easier to navigate between sections of a page. If you need to quickly find a page, you can use the search bar at the top, or the search shortcut (`Ctrl+K` or `Cmd+K`).
To get started, checkout the [Installation](/docs/getting-started/installation) guide.
[App Router vs Pages Router](#app-router-vs-pages-router)
---------------------------------------------------------
Next.js has two different routers: the App Router and the Pages Router. The App Router is a newer router that allows you to use React's latest features, such as Server Components and Streaming. The Pages Router is the original Next.js router, which allowed you to build server-rendered React applications and continues to be supported for older Next.js applications.
At the top of the sidebar, you'll notice a dropdown menu that allows you to switch between the **App Router** and the **Pages Router** features. Since there are features that are unique to each directory, it's important to keep track of which tab is selected.
The breadcrumbs at the top of the page will also indicate whether you're viewing App Router docs or Pages Router docs.
[Pre-Requisite Knowledge](#pre-requisite-knowledge)
---------------------------------------------------
Although our docs are designed to be beginner-friendly, we need to establish a baseline so that the docs can stay focused on Next.js functionality. We'll make sure to provide links to relevant documentation whenever we introduce a new concept.
To get the most out of our docs, it's recommended that you have a basic understanding of HTML, CSS, and React. If you need to brush up on your React skills, check out our [React Foundations Course](/learn/react-foundations), which will introduce you to the fundamentals. Then, learn more about Next.js by [building a dashboard application](/learn/dashboard-app).
[Accessibility](#accessibility)
-------------------------------
For optimal accessibility when using a screen reader while reading the docs, we recommend using Firefox and NVDA, or Safari and VoiceOver.
[Join our Community](#join-our-community)
-----------------------------------------
If you have questions about anything related to Next.js, you're always welcome to ask our community on [GitHub Discussions](https://github.com/vercel/next.js/discussions), [Discord](https://discord.com/invite/bUG2bvbtHy), [Twitter](https://twitter.com/nextjs), and [Reddit](https://www.reddit.com/r/nextjs).
[
### Getting Started
Learn how to create full-stack web applications with Next.js.
](/docs/getting-started)[
### App Router
Use the new App Router with Next.js' and React's latest features, including Layouts, Server Components, Suspense, and more.
](/docs/app)[
### Pages Router
Before Next.js 13, the Pages Router was the main way to create routes in Next.js with an intuitive file-system router.
](/docs/pages)[
### Architecture
How Next.js Works
](/docs/architecture)[
### Community
Get involved in the Next.js community.
](/docs/community)
[Next
Installation
](/docs/getting-started/installation)
Was this helpful?
supported.
Send |
{
"contentLength": null,
"etag": "W/\"45288f403da6b7279bc5a994262ee748\"",
"lastModifiedHeader": null,
"lastModifiedHtml": null
} | https://nextjs.org/showcase | ran **May 23**. Check out the announcements.
Vercel Ship
24
[Watch the Keynote](https://vercel.com/ship?utm_source=next_site&utm_medium=web&utm_campaign=vercel_ship&utm_content=next_site_showcase)
Vercel Ship
24
ran **May 23**. Check out the announcements.
[Watch the Keynote](https://vercel.com/ship?utm_source=next_site&utm_medium=web&utm_campaign=vercel_ship&utm_content=next_site_showcase)
The web framework for when it mattersself.\_\_wrap\_n=self.\_\_wrap\_n||(self.CSS&&CSS.supports("text-wrap","balance")?1:2);self.\_\_wrap\_b=(e,t,s)=>{let r=(s=s||document.querySelector(\`\[data-br="${e}"\]\`)).parentElement,n=e=>s.style.maxWidth=e+"px";s.style.maxWidth="";let a=r.clientWidth,i=r.clientHeight,c=a/2-.25,l=a+.5,o;if(a){for(n(c),c=Math.max(s.scrollWidth,c);c+1<l;)n(o=Math.round((c+l)/2)),r.clientHeight===i?l=o:c=o;n(l\*t+a\*(1-t))}s.\_\_wrap\_o||"undefined"!=typeof ResizeObserver&&(s.\_\_wrap\_o=new ResizeObserver(()=>{self.\_\_wrap\_b(0,+s.dataset.brr,s)})).observe(r)};self.\_\_wrap\_n!=1&&self.\_\_wrap\_b(":Rij6unhn6uf:",1)
=======================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
Peerless performance, efficiency and developer experience. Next.js is trusted by some of the biggest names of the web.self.\_\_wrap\_n=self.\_\_wrap\_n||(self.CSS&&CSS.supports("text-wrap","balance")?1:2);self.\_\_wrap\_b=(e,t,s)=>{let r=(s=s||document.querySelector(\`\[data-br="${e}"\]\`)).parentElement,n=e=>s.style.maxWidth=e+"px";s.style.maxWidth="";let a=r.clientWidth,i=r.clientHeight,c=a/2-.25,l=a+.5,o;if(a){for(n(c),c=Math.max(s.scrollWidth,c);c+1<l;)n(o=Math.round((c+l)/2)),r.clientHeight===i?l=o:c=o;n(l\*t+a\*(1-t))}s.\_\_wrap\_o||"undefined"!=typeof ResizeObserver&&(s.\_\_wrap\_o=new ResizeObserver(()=>{self.\_\_wrap\_b(0,+s.dataset.brr,s)})).observe(r)};self.\_\_wrap\_n!=1&&self.\_\_wrap\_b(":R1qj6unhn6uf:",1)Peerless performance, efficiency and developer experienceself.\_\_wrap\_n=self.\_\_wrap\_n||(self.CSS&&CSS.supports("text-wrap","balance")?1:2);self.\_\_wrap\_b=(e,t,s)=>{let r=(s=s||document.querySelector(\`\[data-br="${e}"\]\`)).parentElement,n=e=>s.style.maxWidth=e+"px";s.style.maxWidth="";let a=r.clientWidth,i=r.clientHeight,c=a/2-.25,l=a+.5,o;if(a){for(n(c),c=Math.max(s.scrollWidth,c);c+1<l;)n(o=Math.round((c+l)/2)),r.clientHeight===i?l=o:c=o;n(l\*t+a\*(1-t))}s.\_\_wrap\_o||"undefined"!=typeof ResizeObserver&&(s.\_\_wrap\_o=new ResizeObserver(()=>{self.\_\_wrap\_b(0,+s.dataset.brr,s)})).observe(r)};self.\_\_wrap\_n!=1&&self.\_\_wrap\_b(":R2qj6unhn6uf:",1)
[Learn About Managed Next.js](https://vercel.com/solutions/nextjs?utm_source=next_site&utm_medium=showcase_redesign&utm_campaign=hero_cta)[Contact Sales](https://vercel.com/contact/sales/nextjs?utm_source=next_site&utm_medium=showcase_redesign&utm_campaign=hero_cta)
* ![Washington Post article](/_next/image?url=https%3A%2F%2Fassets.vercel.com%2Fimage%2Fupload%2Fv1675140153%2Fnextjs%2Fshowcase%2Fwapo.jpg&w=1920&q=75)
![the Washington Post logo](https://assets.vercel.com/image/upload/v1675111868/nextjs/showcase/wapost.svg)
[Read the Washington Post's customer story](https://vercel.com/customers/washington-post-next.js-vercel-engineering-at-the-speed-of-breaking-news?utm_source=next-site&utm_medium=showcase-wapost-card&utm_campaign=showcase-new)
![the Washington Post logo](https://assets.vercel.com/image/upload/v1675111868/nextjs/showcase/wapost.svg)
Engineering a site at the speed of breaking newsself.\_\_wrap\_n=self.\_\_wrap\_n||(self.CSS&&CSS.supports("text-wrap","balance")?1:2);self.\_\_wrap\_b=(e,t,s)=>{let r=(s=s||document.querySelector(\`\[data-br="${e}"\]\`)).parentElement,n=e=>s.style.maxWidth=e+"px";s.style.maxWidth="";let a=r.clientWidth,i=r.clientHeight,c=a/2-.25,l=a+.5,o;if(a){for(n(c),c=Math.max(s.scrollWidth,c);c+1<l;)n(o=Math.round((c+l)/2)),r.clientHeight===i?l=o:c=o;n(l\*t+a\*(1-t))}s.\_\_wrap\_o||"undefined"!=typeof ResizeObserver&&(s.\_\_wrap\_o=new ResizeObserver(()=>{self.\_\_wrap\_b(0,+s.dataset.brr,s)})).observe(r)};self.\_\_wrap\_n!=1&&self.\_\_wrap\_b(":Rl8b36unhn6uf:",1)The Washington Post had 5 billion+ AWS Lambda invocations per week, and saw lightning-fast turnaround on developing new features.
5 Billion+
Lambda invocations per week
Lighting-Fast
Turnaround on developing new features
[Read the customer story](https://vercel.com/customers/washington-post-next.js-vercel-engineering-at-the-speed-of-breaking-news?utm_source=next-site&utm_medium=showcase-wapost-card&utm_campaign=showcase-new)
5 Billion+
Lambda invocations per week
Lighting-Fast
Turnaround on developing new features
* ![](/_next/static/media/template-grid.d2964a3f.svg)
![](/_next/static/media/chatbot-visual.f9712721.svg)
[View the AI Chatbot Template template](https://vercel.com/templates/next.js/nextjs-ai-chatbot?utm_source=next-site&utm_medium=showcase-ai-chatbot-card&utm_campaign=showcase-new)
AI Chatbot Template
A full-featured, hackable Next.js AI chatbot built by Vercelself.\_\_wrap\_n=self.\_\_wrap\_n||(self.CSS&&CSS.supports("text-wrap","balance")?1:2);self.\_\_wrap\_b=(e,t,s)=>{let r=(s=s||document.querySelector(\`\[data-br="${e}"\]\`)).parentElement,n=e=>s.style.maxWidth=e+"px";s.style.maxWidth="";let a=r.clientWidth,i=r.clientHeight,c=a/2-.25,l=a+.5,o;if(a){for(n(c),c=Math.max(s.scrollWidth,c);c+1<l;)n(o=Math.round((c+l)/2)),r.clientHeight===i?l=o:c=o;n(l\*t+a\*(1-t))}s.\_\_wrap\_o||"undefined"!=typeof ResizeObserver&&(s.\_\_wrap\_o=new ResizeObserver(()=>{self.\_\_wrap\_b(0,+s.dataset.brr,s)})).observe(r)};self.\_\_wrap\_n!=1&&self.\_\_wrap\_b(":Rl8j36unhn6uf:",1)
[Deploy this template](https://vercel.com/templates/next.js/nextjs-ai-chatbot?utm_source=next-site&utm_medium=showcase-ai-chatbot-card&utm_campaign=showcase-new)
* ![](/_next/static/media/stripe-visual.abb7a693.svg)
![Stripe logo](https://assets.vercel.com/image/upload/v1675111868/nextjs/showcase/stripe.svg)
[Read Stripe's customer story](https://vercel.com/blog/architecting-reliability-stripes-black-friday-site?utm_source=next-site&utm_medium=showcase-stripe-card&utm_campaign=showcase-new)
![Stripe logo](https://assets.vercel.com/image/upload/v1675111868/nextjs/showcase/stripe.svg)
Architecting a live look at reliability: Stripe's viral Black Friday siteself.\_\_wrap\_n=self.\_\_wrap\_n||(self.CSS&&CSS.supports("text-wrap","balance")?1:2);self.\_\_wrap\_b=(e,t,s)=>{let r=(s=s||document.querySelector(\`\[data-br="${e}"\]\`)).parentElement,n=e=>s.style.maxWidth=e+"px";s.style.maxWidth="";let a=r.clientWidth,i=r.clientHeight,c=a/2-.25,l=a+.5,o;if(a){for(n(c),c=Math.max(s.scrollWidth,c);c+1<l;)n(o=Math.round((c+l)/2)),r.clientHeight===i?l=o:c=o;n(l\*t+a\*(1-t))}s.\_\_wrap\_o||"undefined"!=typeof ResizeObserver&&(s.\_\_wrap\_o=new ResizeObserver(()=>{self.\_\_wrap\_b(0,+s.dataset.brr,s)})).observe(r)};self.\_\_wrap\_n!=1&&self.\_\_wrap\_b(":Rl8r36unhn6uf:",1)With Vercel, Stripe's Black Friday site saw 100% uptime with over 17 million edge requests at launch
100%
Uptime
17m+
Edge requests at launch
[Read the customer story](https://vercel.com/blog/architecting-reliability-stripes-black-friday-site?utm_source=next-site&utm_medium=showcase-stripe-card&utm_campaign=showcase-new)
100%
Uptime
17m+
Edge requests at launch
* ![](/_next/static/media/sonos-visual.371c925c.svg)
![Sonos logo](https://assets.vercel.com/image/upload/v1675111868/nextjs/showcase/sonos.svg)
[Read Sonos's customer story](https://vercel.com/blog/how-sonos-amplified-their-devex?utm_source=next-site&utm_medium=showcase-sonos-card&utm_campaign=showcase-new)
![Sonos logo](https://assets.vercel.com/image/upload/v1675111868/nextjs/showcase/sonos.svg)
Developing at the speed of sound: How Sonos amplified their DevExself.\_\_wrap\_n=self.\_\_wrap\_n||(self.CSS&&CSS.supports("text-wrap","balance")?1:2);self.\_\_wrap\_b=(e,t,s)=>{let r=(s=s||document.querySelector(\`\[data-br="${e}"\]\`)).parentElement,n=e=>s.style.maxWidth=e+"px";s.style.maxWidth="";let a=r.clientWidth,i=r.clientHeight,c=a/2-.25,l=a+.5,o;if(a){for(n(c),c=Math.max(s.scrollWidth,c);c+1<l;)n(o=Math.round((c+l)/2)),r.clientHeight===i?l=o:c=o;n(l\*t+a\*(1-t))}s.\_\_wrap\_o||"undefined"!=typeof ResizeObserver&&(s.\_\_wrap\_o=new ResizeObserver(()=>{self.\_\_wrap\_b(0,+s.dataset.brr,s)})).observe(r)};self.\_\_wrap\_n!=1&&self.\_\_wrap\_b(":Rl9336unhn6uf:",1)After migrating to Next.js and Vercel, Sonos had 75% faster build times and improved their performance scores by 10%
75% faster
Build times
10% better
Performance scores
[Read the customer story](https://vercel.com/blog/how-sonos-amplified-their-devex?utm_source=next-site&utm_medium=showcase-sonos-card&utm_campaign=showcase-new)
75% faster
Build times
10% better
Performance scores
* ![](/_next/static/media/template-grid.d2964a3f.svg)
![](/_next/static/media/commerce-visual.163d1fa7.svg)
[View the Commerce Template template](https://vercel.com/templates/next.js/nextjs-commerce?utm_source=next-site&utm_medium=showcase-commerce-template-card&utm_campaign=showcase-new)
Commerce Template
Starter kit for high-performance commerce with Shopifyself.\_\_wrap\_n=self.\_\_wrap\_n||(self.CSS&&CSS.supports("text-wrap","balance")?1:2);self.\_\_wrap\_b=(e,t,s)=>{let r=(s=s||document.querySelector(\`\[data-br="${e}"\]\`)).parentElement,n=e=>s.style.maxWidth=e+"px";s.style.maxWidth="";let a=r.clientWidth,i=r.clientHeight,c=a/2-.25,l=a+.5,o;if(a){for(n(c),c=Math.max(s.scrollWidth,c);c+1<l;)n(o=Math.round((c+l)/2)),r.clientHeight===i?l=o:c=o;n(l\*t+a\*(1-t))}s.\_\_wrap\_o||"undefined"!=typeof ResizeObserver&&(s.\_\_wrap\_o=new ResizeObserver(()=>{self.\_\_wrap\_b(0,+s.dataset.brr,s)})).observe(r)};self.\_\_wrap\_n!=1&&self.\_\_wrap\_b(":Rl9b36unhn6uf:",1)
[Deploy this template](https://vercel.com/templates/next.js/nextjs-commerce?utm_source=next-site&utm_medium=showcase-commerce-template-card&utm_campaign=showcase-new)
14th Largest
on GitHub
\# 1
React
Framework
110,000
Stars
on GitHub
Meet thousands of beautiful websites built with Next.js by Vercelself.\_\_wrap\_n=self.\_\_wrap\_n||(self.CSS&&CSS.supports("text-wrap","balance")?1:2);self.\_\_wrap\_b=(e,t,s)=>{let r=(s=s||document.querySelector(\`\[data-br="${e}"\]\`)).parentElement,n=e=>s.style.maxWidth=e+"px";s.style.maxWidth="";let a=r.clientWidth,i=r.clientHeight,c=a/2-.25,l=a+.5,o;if(a){for(n(c),c=Math.max(s.scrollWidth,c);c+1<l;)n(o=Math.round((c+l)/2)),r.clientHeight===i?l=o:c=o;n(l\*t+a\*(1-t))}s.\_\_wrap\_o||"undefined"!=typeof ResizeObserver&&(s.\_\_wrap\_o=new ResizeObserver(()=>{self.\_\_wrap\_b(0,+s.dataset.brr,s)})).observe(r)};self.\_\_wrap\_n!=1&&self.\_\_wrap\_b(":Rn6unhn6uf:",1)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
All
Composable Commerce
Web Apps
AI
Marketing & Media
Platform Engineering
[
![](/_next/image?url=%2F_next%2Fstatic%2Fmedia%2Fsonos.fd388bcb.png&w=750&q=55)
Sonos
Composable Commerce
](https://vercel.com/blog/how-sonos-amplified-their-devex?utm_source=next-site&utm_medium=sonos_callout&utm_campaign=showcase-new)[
![](/_next/image?url=%2F_next%2Fstatic%2Fmedia%2Fnike.509ec268.jpg&w=750&q=55)
Nike
Composable Commerce
](https://www.nike.com)[
![](/_next/image?url=%2F_next%2Fstatic%2Fmedia%2Fchatgpt.c6245dc6.png&w=750&q=55)
OpenAI ChatGPT
AI
](https://chatgpt.com/)[
![](/_next/image?url=%2F_next%2Fstatic%2Fmedia%2Fclaude.5aa10087.png&w=750&q=55)
Claude
AI
](https://claude.ai/)[
![](/_next/image?url=%2F_next%2Fstatic%2Fmedia%2Fspotify.6415e03a.png&w=750&q=55)
Spotify
Web Apps
](https://open.spotify.com)[
![](/_next/image?url=%2F_next%2Fstatic%2Fmedia%2Fnerdwallet.d4dd8d82.png&w=750&q=55)
NerdWallet
Web Apps
](https://www.nerdwallet.com/)
Load More
Powering the best frontend teams
![Sonos Logo](https://assets.vercel.com/image/upload/v1582596549/front/home/new/logos/sonos.svg)
![Spotify Logo](https://assets.vercel.com/image/upload/v1711718485/front/home/new/logos/spotify.svg)
![OpenAI Logo](https://assets.vercel.com/image/upload/v1675298561/front/home/new/logos/open-ai.svg)
![twitch Logo](https://assets.vercel.com/image/upload/v1675298561/front/home/new/logos/twitch.svg)
![Patreon Logo](https://assets.vercel.com/image/upload/v1618004238/front/home/new/logos/patreon.svg)
![Auth0 Logo](https://assets.vercel.com/image/upload/v1581706075/front/home/new/logos/auth0.svg)
![IMDB Logo](https://assets.vercel.com/image/upload/v1711718484/front/home/new/logos/imdb.svg)
StarterEcommerceBlogAIEdge FunctionsEdge ConfigPortfolioSaaSMulti-tenant AppsRealtime AppsDocumentationVirtual EventWeb3
Build like the Best
-------------------
Jumpstart your Next.js development with pre-built solutions from Vercel and our community.self.\_\_wrap\_n=self.\_\_wrap\_n||(self.CSS&&CSS.supports("text-wrap","balance")?1:2);self.\_\_wrap\_b=(e,t,s)=>{let r=(s=s||document.querySelector(\`\[data-br="${e}"\]\`)).parentElement,n=e=>s.style.maxWidth=e+"px";s.style.maxWidth="";let a=r.clientWidth,i=r.clientHeight,c=a/2-.25,l=a+.5,o;if(a){for(n(c),c=Math.max(s.scrollWidth,c);c+1<l;)n(o=Math.round((c+l)/2)),r.clientHeight===i?l=o:c=o;n(l\*t+a\*(1-t))}s.\_\_wrap\_o||"undefined"!=typeof ResizeObserver&&(s.\_\_wrap\_o=new ResizeObserver(()=>{self.\_\_wrap\_b(0,+s.dataset.brr,s)})).observe(r)};self.\_\_wrap\_n!=1&&self.\_\_wrap\_b(":R9j96unhn6uf:",1)
[Deploy a Template on Vercel](https://vercel.com/templates/next.js?utm_source=next-site&utm_medium=deploy-template-on-vercel-cta&utm_campaign=showcase-new)
![A Next.js app and a Serverless Function API.](/_next/image?url=https%3A%2F%2Fassets.vercel.com%2Fimage%2Fupload%2Fv1677122002%2Fnextjs%2Fshowcase%2Ftemplate-next-boilerplate.jpg&w=3840&q=75)
Next.js Boilerplate
A Next.js app and a Serverless Function API.
![An image gallery built on Next.js and Cloudinary.](/_next/image?url=https%3A%2F%2Fassets.vercel.com%2Fimage%2Fupload%2Fv1677122387%2Fnextjs%2Fshowcase%2Ftemplate-next-gallery.jpg&w=3840&q=75)
Image Gallery Starter
An image gallery built on Next.js and Cloudinary.
![An all-in-one starter kit for high-performance ecommerce sites.](/_next/image?url=https%3A%2F%2Fassets.vercel.com%2Fimage%2Fupload%2Fv1677122003%2Fnextjs%2Fshowcase%2Ftemplate-next-commerce.jpg&w=3840&q=75)
Next.js Commerce
An all-in-one starter kit for high-performance ecommerce sites.
A powerful framework for building high-performance, server rendered web applicationsself.\_\_wrap\_n=self.\_\_wrap\_n||(self.CSS&&CSS.supports("text-wrap","balance")?1:2);self.\_\_wrap\_b=(e,t,s)=>{let r=(s=s||document.querySelector(\`\[data-br="${e}"\]\`)).parentElement,n=e=>s.style.maxWidth=e+"px";s.style.maxWidth="";let a=r.clientWidth,i=r.clientHeight,c=a/2-.25,l=a+.5,o;if(a){for(n(c),c=Math.max(s.scrollWidth,c);c+1<l;)n(o=Math.round((c+l)/2)),r.clientHeight===i?l=o:c=o;n(l\*t+a\*(1-t))}s.\_\_wrap\_o||"undefined"!=typeof ResizeObserver&&(s.\_\_wrap\_o=new ResizeObserver(()=>{self.\_\_wrap\_b(0,+s.dataset.brr,s)})).observe(r)};self.\_\_wrap\_n!=1&&self.\_\_wrap\_b(":Rr6unhn6uf:",0.23)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
### Superior Developer Experience
Deploy your Next.js site globally in seconds, with zero configuration just Git push to get started.self.\_\_wrap\_n=self.\_\_wrap\_n||(self.CSS&&CSS.supports("text-wrap","balance")?1:2);self.\_\_wrap\_b=(e,t,s)=>{let r=(s=s||document.querySelector(\`\[data-br="${e}"\]\`)).parentElement,n=e=>s.style.maxWidth=e+"px";s.style.maxWidth="";let a=r.clientWidth,i=r.clientHeight,c=a/2-.25,l=a+.5,o;if(a){for(n(c),c=Math.max(s.scrollWidth,c);c+1<l;)n(o=Math.round((c+l)/2)),r.clientHeight===i?l=o:c=o;n(l\*t+a\*(1-t))}s.\_\_wrap\_o||"undefined"!=typeof ResizeObserver&&(s.\_\_wrap\_o=new ResizeObserver(()=>{self.\_\_wrap\_b(0,+s.dataset.brr,s)})).observe(r)};self.\_\_wrap\_n!=1&&self.\_\_wrap\_b(":R2jb6unhn6uf:",1)
### Battle-tested in Production
All the features you need for production: hybrid static & server rendering, TypeScript support, smart bundling, route pre-fetching, and more.self.\_\_wrap\_n=self.\_\_wrap\_n||(self.CSS&&CSS.supports("text-wrap","balance")?1:2);self.\_\_wrap\_b=(e,t,s)=>{let r=(s=s||document.querySelector(\`\[data-br="${e}"\]\`)).parentElement,n=e=>s.style.maxWidth=e+"px";s.style.maxWidth="";let a=r.clientWidth,i=r.clientHeight,c=a/2-.25,l=a+.5,o;if(a){for(n(c),c=Math.max(s.scrollWidth,c);c+1<l;)n(o=Math.round((c+l)/2)),r.clientHeight===i?l=o:c=o;n(l\*t+a\*(1-t))}s.\_\_wrap\_o||"undefined"!=typeof ResizeObserver&&(s.\_\_wrap\_o=new ResizeObserver(()=>{self.\_\_wrap\_b(0,+s.dataset.brr,s)})).observe(r)};self.\_\_wrap\_n!=1&&self.\_\_wrap\_b(":R2lb6unhn6uf:",1)
### Performance-obsessed stack
Next.js brings years of experience in building and optimizing production applications.self.\_\_wrap\_n=self.\_\_wrap\_n||(self.CSS&&CSS.supports("text-wrap","balance")?1:2);self.\_\_wrap\_b=(e,t,s)=>{let r=(s=s||document.querySelector(\`\[data-br="${e}"\]\`)).parentElement,n=e=>s.style.maxWidth=e+"px";s.style.maxWidth="";let a=r.clientWidth,i=r.clientHeight,c=a/2-.25,l=a+.5,o;if(a){for(n(c),c=Math.max(s.scrollWidth,c);c+1<l;)n(o=Math.round((c+l)/2)),r.clientHeight===i?l=o:c=o;n(l\*t+a\*(1-t))}s.\_\_wrap\_o||"undefined"!=typeof ResizeObserver&&(s.\_\_wrap\_o=new ResizeObserver(()=>{self.\_\_wrap\_b(0,+s.dataset.brr,s)})).observe(r)};self.\_\_wrap\_n!=1&&self.\_\_wrap\_b(":R2nb6unhn6uf:",1)
[Learn About Managed Next.js](https://vercel.com/solutions/nextjs?utm_source=next_site&utm_medium=showcase_redesign&utm_campaign=footer_learn_cta)[Contact Sales](https://vercel.com/contact/sales/nextjs?utm_source=next_site&utm_medium=showcase_redesign&utm_campaign=footer_learn_cta) |
{
"contentLength": null,
"etag": "W/\"149fcee0bef4b6599f3f5d4e592cb920\"",
"lastModifiedHeader": null,
"lastModifiedHtml": null
} | https://nextjs.org/docs/app/building-your-application/data-fetching/patterns | Menu
Using App Router
Features available in /app
* [Getting Started](/docs/getting-started)
* [Installation](/docs/getting-started/installation)
* [Project Structure](/docs/getting-started/project-structure)
* [Building Your Application](/docs/app/building-your-application)
* [Routing](/docs/app/building-your-application/routing)
* [Defining Routes](/docs/app/building-your-application/routing/defining-routes)
* [Pages and Layouts](/docs/app/building-your-application/routing/pages-and-layouts)
* [Linking and Navigating](/docs/app/building-your-application/routing/linking-and-navigating)
* [Loading UI and Streaming](/docs/app/building-your-application/routing/loading-ui-and-streaming)
* [Error Handling](/docs/app/building-your-application/routing/error-handling)
* [Redirecting](/docs/app/building-your-application/routing/redirecting)
* [Route Groups](/docs/app/building-your-application/routing/route-groups)
* [Project Organization](/docs/app/building-your-application/routing/colocation)
* [Dynamic Routes](/docs/app/building-your-application/routing/dynamic-routes)
* [Parallel Routes](/docs/app/building-your-application/routing/parallel-routes)
* [Intercepting Routes](/docs/app/building-your-application/routing/intercepting-routes)
* [Route Handlers](/docs/app/building-your-application/routing/route-handlers)
* [Middleware](/docs/app/building-your-application/routing/middleware)
* [Internationalization](/docs/app/building-your-application/routing/internationalization)
* [Data Fetching](/docs/app/building-your-application/data-fetching)
* [Fetching, Caching, and Revalidating](/docs/app/building-your-application/data-fetching/fetching-caching-and-revalidating)
* [Server Actions and Mutations](/docs/app/building-your-application/data-fetching/server-actions-and-mutations)
* [
Data Fetching Patterns and Best Practices](/docs/app/building-your-application/data-fetching/patterns)
* [Rendering](/docs/app/building-your-application/rendering)
* [Server Components](/docs/app/building-your-application/rendering/server-components)
* [Client Components](/docs/app/building-your-application/rendering/client-components)
* [Composition Patterns](/docs/app/building-your-application/rendering/composition-patterns)
* [Edge and Node.js Runtimes](/docs/app/building-your-application/rendering/edge-and-nodejs-runtimes)
* [Caching](/docs/app/building-your-application/caching)
* [Styling](/docs/app/building-your-application/styling)
* [CSS Modules](/docs/app/building-your-application/styling/css-modules)
* [Tailwind CSS](/docs/app/building-your-application/styling/tailwind-css)
* [CSS-in-JS](/docs/app/building-your-application/styling/css-in-js)
* [Sass](/docs/app/building-your-application/styling/sass)
* [Optimizing](/docs/app/building-your-application/optimizing)
* [Images](/docs/app/building-your-application/optimizing/images)
* [Videos](/docs/app/building-your-application/optimizing/videos)
* [Fonts](/docs/app/building-your-application/optimizing/fonts)
* [Metadata](/docs/app/building-your-application/optimizing/metadata)
* [Scripts](/docs/app/building-your-application/optimizing/scripts)
* [Bundle Analyzer](/docs/app/building-your-application/optimizing/bundle-analyzer)
* [Lazy Loading](/docs/app/building-your-application/optimizing/lazy-loading)
* [Analytics](/docs/app/building-your-application/optimizing/analytics)
* [Instrumentation](/docs/app/building-your-application/optimizing/instrumentation)
* [OpenTelemetry](/docs/app/building-your-application/optimizing/open-telemetry)
* [Static Assets](/docs/app/building-your-application/optimizing/static-assets)
* [Third Party Libraries](/docs/app/building-your-application/optimizing/third-party-libraries)
* [Memory Usage](/docs/app/building-your-application/optimizing/memory-usage)
* [Configuring](/docs/app/building-your-application/configuring)
* [TypeScript](/docs/app/building-your-application/configuring/typescript)
* [ESLint](/docs/app/building-your-application/configuring/eslint)
* [Environment Variables](/docs/app/building-your-application/configuring/environment-variables)
* [Absolute Imports and Module Path Aliases](/docs/app/building-your-application/configuring/absolute-imports-and-module-aliases)
* [MDX](/docs/app/building-your-application/configuring/mdx)
* [src Directory](/docs/app/building-your-application/configuring/src-directory)
* [Draft Mode](/docs/app/building-your-application/configuring/draft-mode)
* [Content Security Policy](/docs/app/building-your-application/configuring/content-security-policy)
* [Testing](/docs/app/building-your-application/testing)
* [Vitest](/docs/app/building-your-application/testing/vitest)
* [Jest](/docs/app/building-your-application/testing/jest)
* [Playwright](/docs/app/building-your-application/testing/playwright)
* [Cypress](/docs/app/building-your-application/testing/cypress)
* [Authentication](/docs/app/building-your-application/authentication)
* [Deploying](/docs/app/building-your-application/deploying)
* [Production Checklist](/docs/app/building-your-application/deploying/production-checklist)
* [Static Exports](/docs/app/building-your-application/deploying/static-exports)
* [Upgrading](/docs/app/building-your-application/upgrading)
* [Codemods](/docs/app/building-your-application/upgrading/codemods)
* [App Router Migration](/docs/app/building-your-application/upgrading/app-router-migration)
* [Version 14](/docs/app/building-your-application/upgrading/version-14)
* [Migrating from Vite](/docs/app/building-your-application/upgrading/from-vite)
* [Migrating from Create React App](/docs/app/building-your-application/upgrading/from-create-react-app)
* [API Reference](/docs/app/api-reference)
* [Components](/docs/app/api-reference/components)
* [Font](/docs/app/api-reference/components/font)
* [<Image>](/docs/app/api-reference/components/image)
* [<Link>](/docs/app/api-reference/components/link)
* [<Script>](/docs/app/api-reference/components/script)
* [File Conventions](/docs/app/api-reference/file-conventions)
* [default.js](/docs/app/api-reference/file-conventions/default)
* [error.js](/docs/app/api-reference/file-conventions/error)
* [instrumentation.js](/docs/app/api-reference/file-conventions/instrumentation)
* [layout.js](/docs/app/api-reference/file-conventions/layout)
* [loading.js](/docs/app/api-reference/file-conventions/loading)
* [middleware.js](/docs/app/api-reference/file-conventions/middleware)
* [not-found.js](/docs/app/api-reference/file-conventions/not-found)
* [page.js](/docs/app/api-reference/file-conventions/page)
* [route.js](/docs/app/api-reference/file-conventions/route)
* [Route Segment Config](/docs/app/api-reference/file-conventions/route-segment-config)
* [template.js](/docs/app/api-reference/file-conventions/template)
* [Metadata Files](/docs/app/api-reference/file-conventions/metadata)
* [favicon, icon, and apple-icon](/docs/app/api-reference/file-conventions/metadata/app-icons)
* [manifest.json](/docs/app/api-reference/file-conventions/metadata/manifest)
* [opengraph-image and twitter-image](/docs/app/api-reference/file-conventions/metadata/opengraph-image)
* [robots.txt](/docs/app/api-reference/file-conventions/metadata/robots)
* [sitemap.xml](/docs/app/api-reference/file-conventions/metadata/sitemap)
* [Functions](/docs/app/api-reference/functions)
* [cookies](/docs/app/api-reference/functions/cookies)
* [draftMode](/docs/app/api-reference/functions/draft-mode)
* [fetch](/docs/app/api-reference/functions/fetch)
* [generateImageMetadata](/docs/app/api-reference/functions/generate-image-metadata)
* [generateMetadata](/docs/app/api-reference/functions/generate-metadata)
* [generateSitemaps](/docs/app/api-reference/functions/generate-sitemaps)
* [generateStaticParams](/docs/app/api-reference/functions/generate-static-params)
* [generateViewport](/docs/app/api-reference/functions/generate-viewport)
* [headers](/docs/app/api-reference/functions/headers)
* [ImageResponse](/docs/app/api-reference/functions/image-response)
* [NextRequest](/docs/app/api-reference/functions/next-request)
* [NextResponse](/docs/app/api-reference/functions/next-response)
* [notFound](/docs/app/api-reference/functions/not-found)
* [permanentRedirect](/docs/app/api-reference/functions/permanentRedirect)
* [redirect](/docs/app/api-reference/functions/redirect)
* [revalidatePath](/docs/app/api-reference/functions/revalidatePath)
* [revalidateTag](/docs/app/api-reference/functions/revalidateTag)
* [unstable\_cache](/docs/app/api-reference/functions/unstable_cache)
* [unstable\_noStore](/docs/app/api-reference/functions/unstable_noStore)
* [useParams](/docs/app/api-reference/functions/use-params)
* [usePathname](/docs/app/api-reference/functions/use-pathname)
* [useReportWebVitals](/docs/app/api-reference/functions/use-report-web-vitals)
* [useRouter](/docs/app/api-reference/functions/use-router)
* [useSearchParams](/docs/app/api-reference/functions/use-search-params)
* [useSelectedLayoutSegment](/docs/app/api-reference/functions/use-selected-layout-segment)
* [useSelectedLayoutSegments](/docs/app/api-reference/functions/use-selected-layout-segments)
* [userAgent](/docs/app/api-reference/functions/userAgent)
* [next.config.js Options](/docs/app/api-reference/next-config-js)
* [appDir](/docs/app/api-reference/next-config-js/appDir)
* [assetPrefix](/docs/app/api-reference/next-config-js/assetPrefix)
* [basePath](/docs/app/api-reference/next-config-js/basePath)
* [compress](/docs/app/api-reference/next-config-js/compress)
* [crossOrigin](/docs/app/api-reference/next-config-js/crossOrigin)
* [devIndicators](/docs/app/api-reference/next-config-js/devIndicators)
* [distDir](/docs/app/api-reference/next-config-js/distDir)
* [env](/docs/app/api-reference/next-config-js/env)
* [eslint](/docs/app/api-reference/next-config-js/eslint)
* [exportPathMap](/docs/app/api-reference/next-config-js/exportPathMap)
* [generateBuildId](/docs/app/api-reference/next-config-js/generateBuildId)
* [generateEtags](/docs/app/api-reference/next-config-js/generateEtags)
* [headers](/docs/app/api-reference/next-config-js/headers)
* [httpAgentOptions](/docs/app/api-reference/next-config-js/httpAgentOptions)
* [images](/docs/app/api-reference/next-config-js/images)
* [cacheHandler](/docs/app/api-reference/next-config-js/incrementalCacheHandlerPath)
* [instrumentationHook](/docs/app/api-reference/next-config-js/instrumentationHook)
* [logging](/docs/app/api-reference/next-config-js/logging)
* [mdxRs](/docs/app/api-reference/next-config-js/mdxRs)
* [onDemandEntries](/docs/app/api-reference/next-config-js/onDemandEntries)
* [optimizePackageImports](/docs/app/api-reference/next-config-js/optimizePackageImports)
* [output](/docs/app/api-reference/next-config-js/output)
* [pageExtensions](/docs/app/api-reference/next-config-js/pageExtensions)
* [Partial Prerendering (experimental)](/docs/app/api-reference/next-config-js/partial-prerendering)
* [poweredByHeader](/docs/app/api-reference/next-config-js/poweredByHeader)
* [productionBrowserSourceMaps](/docs/app/api-reference/next-config-js/productionBrowserSourceMaps)
* [reactStrictMode](/docs/app/api-reference/next-config-js/reactStrictMode)
* [redirects](/docs/app/api-reference/next-config-js/redirects)
* [rewrites](/docs/app/api-reference/next-config-js/rewrites)
* [serverActions](/docs/app/api-reference/next-config-js/serverActions)
* [serverComponentsExternalPackages](/docs/app/api-reference/next-config-js/serverComponentsExternalPackages)
* [StaleTimes (experimental)](/docs/app/api-reference/next-config-js/staleTimes)
* [trailingSlash](/docs/app/api-reference/next-config-js/trailingSlash)
* [transpilePackages](/docs/app/api-reference/next-config-js/transpilePackages)
* [turbo](/docs/app/api-reference/next-config-js/turbo)
* [typedRoutes](/docs/app/api-reference/next-config-js/typedRoutes)
* [typescript](/docs/app/api-reference/next-config-js/typescript)
* [urlImports](/docs/app/api-reference/next-config-js/urlImports)
* [webpack](/docs/app/api-reference/next-config-js/webpack)
* [webVitalsAttribution](/docs/app/api-reference/next-config-js/webVitalsAttribution)
* [create-next-app](/docs/app/api-reference/create-next-app)
* [Edge Runtime](/docs/app/api-reference/edge)
* [Next.js CLI](/docs/app/api-reference/next-cli)
* [Building Your Application](/docs/pages/building-your-application)
* [Routing](/docs/pages/building-your-application/routing)
* [Pages and Layouts](/docs/pages/building-your-application/routing/pages-and-layouts)
* [Dynamic Routes](/docs/pages/building-your-application/routing/dynamic-routes)
* [Linking and Navigating](/docs/pages/building-your-application/routing/linking-and-navigating)
* [Redirecting](/docs/pages/building-your-application/routing/redirecting)
* [Custom App](/docs/pages/building-your-application/routing/custom-app)
* [Custom Document](/docs/pages/building-your-application/routing/custom-document)
* [API Routes](/docs/pages/building-your-application/routing/api-routes)
* [Custom Errors](/docs/pages/building-your-application/routing/custom-error)
* [Internationalization](/docs/pages/building-your-application/routing/internationalization)
* [Middleware](/docs/pages/building-your-application/routing/middleware)
* [Rendering](/docs/pages/building-your-application/rendering)
* [Server-side Rendering (SSR)](/docs/pages/building-your-application/rendering/server-side-rendering)
* [Static Site Generation (SSG)](/docs/pages/building-your-application/rendering/static-site-generation)
* [Automatic Static Optimization](/docs/pages/building-your-application/rendering/automatic-static-optimization)
* [Client-side Rendering (CSR)](/docs/pages/building-your-application/rendering/client-side-rendering)
* [Edge and Node.js Runtimes](/docs/pages/building-your-application/rendering/edge-and-nodejs-runtimes)
* [Data Fetching](/docs/pages/building-your-application/data-fetching)
* [getStaticProps](/docs/pages/building-your-application/data-fetching/get-static-props)
* [getStaticPaths](/docs/pages/building-your-application/data-fetching/get-static-paths)
* [Forms and Mutations](/docs/pages/building-your-application/data-fetching/forms-and-mutations)
* [getServerSideProps](/docs/pages/building-your-application/data-fetching/get-server-side-props)
* [Incremental Static Regeneration (ISR)](/docs/pages/building-your-application/data-fetching/incremental-static-regeneration)
* [Client-side Fetching](/docs/pages/building-your-application/data-fetching/client-side)
* [Styling](/docs/pages/building-your-application/styling)
* [CSS Modules](/docs/pages/building-your-application/styling/css-modules)
* [Tailwind CSS](/docs/pages/building-your-application/styling/tailwind-css)
* [CSS-in-JS](/docs/pages/building-your-application/styling/css-in-js)
* [Sass](/docs/pages/building-your-application/styling/sass)
* [Optimizing](/docs/pages/building-your-application/optimizing)
* [Images](/docs/pages/building-your-application/optimizing/images)
* [Fonts](/docs/pages/building-your-application/optimizing/fonts)
* [Scripts](/docs/pages/building-your-application/optimizing/scripts)
* [Static Assets](/docs/pages/building-your-application/optimizing/static-assets)
* [Bundle Analyzer](/docs/pages/building-your-application/optimizing/bundle-analyzer)
* [Analytics](/docs/pages/building-your-application/optimizing/analytics)
* [Lazy Loading](/docs/pages/building-your-application/optimizing/lazy-loading)
* [Instrumentation](/docs/pages/building-your-application/optimizing/instrumentation)
* [OpenTelemetry](/docs/pages/building-your-application/optimizing/open-telemetry)
* [Third Party Libraries](/docs/pages/building-your-application/optimizing/third-party-libraries)
* [Configuring](/docs/pages/building-your-application/configuring)
* [TypeScript](/docs/pages/building-your-application/configuring/typescript)
* [ESLint](/docs/pages/building-your-application/configuring/eslint)
* [Environment Variables](/docs/pages/building-your-application/configuring/environment-variables)
* [Absolute Imports and Module Path Aliases](/docs/pages/building-your-application/configuring/absolute-imports-and-module-aliases)
* [src Directory](/docs/pages/building-your-application/configuring/src-directory)
* [MDX](/docs/pages/building-your-application/configuring/mdx)
* [AMP](/docs/pages/building-your-application/configuring/amp)
* [Babel](/docs/pages/building-your-application/configuring/babel)
* [PostCSS](/docs/pages/building-your-application/configuring/post-css)
* [Custom Server](/docs/pages/building-your-application/configuring/custom-server)
* [Draft Mode](/docs/pages/building-your-application/configuring/draft-mode)
* [Error Handling](/docs/pages/building-your-application/configuring/error-handling)
* [Debugging](/docs/pages/building-your-application/configuring/debugging)
* [Preview Mode](/docs/pages/building-your-application/configuring/preview-mode)
* [Content Security Policy](/docs/pages/building-your-application/configuring/content-security-policy)
* [Testing](/docs/pages/building-your-application/testing)
* [Vitest](/docs/pages/building-your-application/testing/vitest)
* [Jest](/docs/pages/building-your-application/testing/jest)
* [Playwright](/docs/pages/building-your-application/testing/playwright)
* [Cypress](/docs/pages/building-your-application/testing/cypress)
* [Authentication](/docs/pages/building-your-application/authentication)
* [Deploying](/docs/pages/building-your-application/deploying)
* [Production Checklist](/docs/pages/building-your-application/deploying/production-checklist)
* [Static Exports](/docs/pages/building-your-application/deploying/static-exports)
* [Multi Zones](/docs/pages/building-your-application/deploying/multi-zones)
* [Continuous Integration (CI) Build Caching](/docs/pages/building-your-application/deploying/ci-build-caching)
* [Upgrading](/docs/pages/building-your-application/upgrading)
* [Codemods](/docs/pages/building-your-application/upgrading/codemods)
* [From Pages to App](/docs/pages/building-your-application/upgrading/app-router-migration)
* [Migrating from Vite](/docs/pages/building-your-application/upgrading/from-vite)
* [Migrating from Create React App](/docs/pages/building-your-application/upgrading/from-create-react-app)
* [Version 14](/docs/pages/building-your-application/upgrading/version-14)
* [Version 13](/docs/pages/building-your-application/upgrading/version-13)
* [Version 12](/docs/pages/building-your-application/upgrading/version-12)
* [Version 11](/docs/pages/building-your-application/upgrading/version-11)
* [Version 10](/docs/pages/building-your-application/upgrading/version-10)
* [Version 9](/docs/pages/building-your-application/upgrading/version-9)
* [API Reference](/docs/pages/api-reference)
* [Components](/docs/pages/api-reference/components)
* [Font](/docs/pages/api-reference/components/font)
* [<Head>](/docs/pages/api-reference/components/head)
* [<Image>](/docs/pages/api-reference/components/image)
* [<Image> (Legacy)](/docs/pages/api-reference/components/image-legacy)
* [<Link>](/docs/pages/api-reference/components/link)
* [<Script>](/docs/pages/api-reference/components/script)
* [Functions](/docs/pages/api-reference/functions)
* [getInitialProps](/docs/pages/api-reference/functions/get-initial-props)
* [getServerSideProps](/docs/pages/api-reference/functions/get-server-side-props)
* [getStaticPaths](/docs/pages/api-reference/functions/get-static-paths)
* [getStaticProps](/docs/pages/api-reference/functions/get-static-props)
* [NextRequest](/docs/pages/api-reference/functions/next-request)
* [NextResponse](/docs/pages/api-reference/functions/next-response)
* [useAmp](/docs/pages/api-reference/functions/use-amp)
* [useReportWebVitals](/docs/pages/api-reference/functions/use-report-web-vitals)
* [useRouter](/docs/pages/api-reference/functions/use-router)
* [userAgent](/docs/pages/api-reference/functions/userAgent)
* [next.config.js Options](/docs/pages/api-reference/next-config-js)
* [assetPrefix](/docs/pages/api-reference/next-config-js/assetPrefix)
* [basePath](/docs/pages/api-reference/next-config-js/basePath)
* [compress](/docs/pages/api-reference/next-config-js/compress)
* [crossOrigin](/docs/pages/api-reference/next-config-js/crossOrigin)
* [devIndicators](/docs/pages/api-reference/next-config-js/devIndicators)
* [distDir](/docs/pages/api-reference/next-config-js/distDir)
* [env](/docs/pages/api-reference/next-config-js/env)
* [eslint](/docs/pages/api-reference/next-config-js/eslint)
* [exportPathMap](/docs/pages/api-reference/next-config-js/exportPathMap)
* [generateBuildId](/docs/pages/api-reference/next-config-js/generateBuildId)
* [generateEtags](/docs/pages/api-reference/next-config-js/generateEtags)
* [headers](/docs/pages/api-reference/next-config-js/headers)
* [httpAgentOptions](/docs/pages/api-reference/next-config-js/httpAgentOptions)
* [images](/docs/pages/api-reference/next-config-js/images)
* [instrumentationHook](/docs/pages/api-reference/next-config-js/instrumentationHook)
* [onDemandEntries](/docs/pages/api-reference/next-config-js/onDemandEntries)
* [optimizePackageImports](/docs/pages/api-reference/next-config-js/optimizePackageImports)
* [output](/docs/pages/api-reference/next-config-js/output)
* [pageExtensions](/docs/pages/api-reference/next-config-js/pageExtensions)
* [poweredByHeader](/docs/pages/api-reference/next-config-js/poweredByHeader)
* [productionBrowserSourceMaps](/docs/pages/api-reference/next-config-js/productionBrowserSourceMaps)
* [reactStrictMode](/docs/pages/api-reference/next-config-js/reactStrictMode)
* [redirects](/docs/pages/api-reference/next-config-js/redirects)
* [rewrites](/docs/pages/api-reference/next-config-js/rewrites)
* [Runtime Config](/docs/pages/api-reference/next-config-js/runtime-configuration)
* [trailingSlash](/docs/pages/api-reference/next-config-js/trailingSlash)
* [transpilePackages](/docs/pages/api-reference/next-config-js/transpilePackages)
* [turbo](/docs/pages/api-reference/next-config-js/turbo)
* [typescript](/docs/pages/api-reference/next-config-js/typescript)
* [urlImports](/docs/pages/api-reference/next-config-js/urlImports)
* [webpack](/docs/pages/api-reference/next-config-js/webpack)
* [webVitalsAttribution](/docs/pages/api-reference/next-config-js/webVitalsAttribution)
* [create-next-app](/docs/pages/api-reference/create-next-app)
* [Next.js CLI](/docs/pages/api-reference/next-cli)
* [Edge Runtime](/docs/pages/api-reference/edge)
* [Architecture](/docs/architecture)
* [Accessibility](/docs/architecture/accessibility)
* [Fast Refresh](/docs/architecture/fast-refresh)
* [Next.js Compiler](/docs/architecture/nextjs-compiler)
* [Supported Browsers](/docs/architecture/supported-browsers)
* [Turbopack](/docs/architecture/turbopack)
* [Community](/docs/community)
* [Contribution Guide](/docs/community/contribution-guide)
On this page
* [Fetching data on the server](#fetching-data-on-the-server)
* [Fetching data where it's needed](#fetching-data-where-its-needed)
* [Streaming](#streaming)
* [Parallel and sequential data fetching](#parallel-and-sequential-data-fetching)
* [Sequential Data Fetching](#sequential-data-fetching)
* [Parallel Data Fetching](#parallel-data-fetching)
* [Preloading Data](#preloading-data)
* [Using React cache, server-only, and the Preload Pattern](#using-react-cache-server-only-and-the-preload-pattern)
* [Preventing sensitive data from being exposed to the client](#preventing-sensitive-data-from-being-exposed-to-the-client)
[Edit this page on GitHub](https://github.com/vercel/next.js/edit/canary/docs/02-app/01-building-your-application/02-data-fetching/03-patterns.mdx) [Managed Next.js (Vercel)](https://vercel.com/solutions/nextjs?utm_source=next_site&utm_medium=web&utm_campaign=managed_nextjs_solutions_page) Scroll to top
[App Router](/docs/app)[...](/docs/app/building-your-application)[Data Fetching](/docs/app/building-your-application/data-fetching)Data Fetching Patterns and Best Practices
Patterns and Best Practices
===========================
There are a few recommended patterns and best practices for fetching data in React and Next.js. This page will go over some of the most common patterns and how to use them.
[Fetching data on the server](#fetching-data-on-the-server)
-----------------------------------------------------------
Whenever possible, we recommend fetching data on the server with Server Components. This allows you to:
* Have direct access to backend data resources (e.g. databases).
* Keep your application more secure by preventing sensitive information, such as access tokens and API keys, from being exposed to the client.
* Fetch data and render in the same environment. This reduces both the back-and-forth communication between client and server, as well as the [work on the main thread](https://vercel.com/blog/how-react-18-improves-application-performance) on the client.
* Perform multiple data fetches with single round-trip instead of multiple individual requests on the client.
* Reduce client-server [waterfalls](#parallel-and-sequential-data-fetching).
* Depending on your region, data fetching can also happen closer to your data source, reducing latency and improving performance.
Then, you can mutate or update data with [Server Actions](/docs/app/building-your-application/data-fetching/server-actions-and-mutations).
[Fetching data where it's needed](#fetching-data-where-its-needed)
------------------------------------------------------------------
If you need to use the same data (e.g. current user) in multiple components in a tree, you do not have to fetch data globally, nor forward props between components. Instead, you can use `fetch` or React `cache` in the component that needs the data without worrying about the performance implications of making multiple requests for the same data.
This is possible because `fetch` requests are automatically memoized. Learn more about [request memoization](/docs/app/building-your-application/caching#request-memoization)
> **Good to know**: This also applies to layouts, since it's not possible to pass data between a parent layout and its children.
[Streaming](#streaming)
-----------------------
Streaming and [Suspense](https://react.dev/reference/react/Suspense) are React features that allow you to progressively render and incrementally stream rendered units of the UI to the client.
With Server Components and [nested layouts](/docs/app/building-your-application/routing/pages-and-layouts), you're able to instantly render parts of the page that do not specifically require data, and show a [loading state](/docs/app/building-your-application/routing/loading-ui-and-streaming) for parts of the page that are fetching data. This means the user does not have to wait for the entire page to load before they can start interacting with it.
![Server Rendering with Streaming](/_next/image?url=%2Fdocs%2Flight%2Fserver-rendering-with-streaming.png&w=3840&q=75)![Server Rendering with Streaming](/_next/image?url=%2Fdocs%2Fdark%2Fserver-rendering-with-streaming.png&w=3840&q=75)
To learn more about Streaming and Suspense, see the [Loading UI](/docs/app/building-your-application/routing/loading-ui-and-streaming) and [Streaming and Suspense](/docs/app/building-your-application/routing/loading-ui-and-streaming#streaming-with-suspense) pages.
[Parallel and sequential data fetching](#parallel-and-sequential-data-fetching)
-------------------------------------------------------------------------------
When fetching data inside React components, you need to be aware of two data fetching patterns: Parallel and Sequential.
![Sequential and Parallel Data Fetching](/_next/image?url=%2Fdocs%2Flight%2Fsequential-parallel-data-fetching.png&w=3840&q=75)![Sequential and Parallel Data Fetching](/_next/image?url=%2Fdocs%2Fdark%2Fsequential-parallel-data-fetching.png&w=3840&q=75)
* With **sequential data fetching**, requests in a route are dependent on each other and therefore create waterfalls. There may be cases where you want this pattern because one fetch depends on the result of the other, or you want a condition to be satisfied before the next fetch to save resources. However, this behavior can also be unintentional and lead to longer loading times.
* With **parallel data fetching**, requests in a route are eagerly initiated and will load data at the same time. This reduces client-server waterfalls and the total time it takes to load data.
### [Sequential Data Fetching](#sequential-data-fetching)
If you have nested components, and each component fetches its own data, then data fetching will happen sequentially if those data requests are different (this doesn't apply to requests for the same data as they are automatically [memoized](/docs/app/building-your-application/caching#request-memoization)).
For example, the `Playlists` component will only start fetching data once the `Artist` component has finished fetching data because `Playlists` depends on the `artistID` prop:
app/artist/\[username\]/page.tsx
TypeScript
JavaScriptTypeScript
// ...
async function Playlists({ artistID }: { artistID: string }) {
// Wait for the playlists
const playlists = await getArtistPlaylists(artistID)
return (
<ul>
{playlists.map((playlist) => (
<li key={playlist.id}>{playlist.name}</li>
))}
</ul>
)
}
export default async function Page({
params: { username },
}: {
params: { username: string }
}) {
// Wait for the artist
const artist = await getArtist(username)
return (
<>
<h1>{artist.name}</h1>
<Suspense fallback={<div>Loading...</div>}>
<Playlists artistID={artist.id} />
</Suspense>
</>
)
}
In cases like this, you can use [`loading.js`](/docs/app/building-your-application/routing/loading-ui-and-streaming) (for route segments) or [React `<Suspense>`](/docs/app/building-your-application/routing/loading-ui-and-streaming#streaming-with-suspense) (for nested components) to show an instant loading state while React streams in the result.
This will prevent the whole route from being blocked by data fetching, and the user will be able to interact with the parts of the page that are not blocked.
> **Blocking Data Requests:**
>
> An alternative approach to prevent waterfalls is to fetch data globally, at the root of your application, but this will block rendering for all route segments beneath it until the data has finished loading. This can be described as "all or nothing" data fetching. Either you have the entire data for your page or application, or none.
>
> Any fetch requests with `await` will block rendering and data fetching for the entire tree beneath it, unless they are wrapped in a `<Suspense>` boundary or `loading.js` is used. Another alternative is to use [parallel data fetching](#parallel-data-fetching) or the [preload pattern](#preloading-data).
### [Parallel Data Fetching](#parallel-data-fetching)
To fetch data in parallel, you can eagerly initiate requests by defining them outside the components that use the data, then calling them from inside the component. This saves time by initiating both requests in parallel, however, the user won't see the rendered result until both promises are resolved.
In the example below, the `getArtist` and `getArtistAlbums` functions are defined outside the `Page` component, then called inside the component, and we wait for both promises to resolve:
app/artist/\[username\]/page.tsx
TypeScript
JavaScriptTypeScript
import Albums from './albums'
async function getArtist(username: string) {
const res = await fetch(`https://api.example.com/artist/${username}`)
return res.json()
}
async function getArtistAlbums(username: string) {
const res = await fetch(`https://api.example.com/artist/${username}/albums`)
return res.json()
}
export default async function Page({
params: { username },
}: {
params: { username: string }
}) {
// Initiate both requests in parallel
const artistData = getArtist(username)
const albumsData = getArtistAlbums(username)
// Wait for the promises to resolve
const [artist, albums] = await Promise.all([artistData, albumsData])
return (
<>
<h1>{artist.name}</h1>
<Albums list={albums}></Albums>
</>
)
}
To improve the user experience, you can add a [Suspense Boundary](/docs/app/building-your-application/routing/loading-ui-and-streaming) to break up the rendering work and show part of the result as soon as possible.
[Preloading Data](#preloading-data)
-----------------------------------
Another way to prevent waterfalls is to use the preload pattern. You can optionally create a `preload` function to further optimize parallel data fetching. With this approach, you don't have to pass promises down as props. The `preload` function can also have any name as it's a pattern, not an API.
components/Item.tsx
TypeScript
JavaScriptTypeScript
import { getItem } from '@/utils/get-item'
export const preload = (id: string) => {
// void evaluates the given expression and returns undefined
// https://developer.mozilla.org/docs/Web/JavaScript/Reference/Operators/void
void getItem(id)
}
export default async function Item({ id }: { id: string }) {
const result = await getItem(id)
// ...
}
app/item/\[id\]/page.tsx
TypeScript
JavaScriptTypeScript
import Item, { preload, checkIsAvailable } from '@/components/Item'
export default async function Page({
params: { id },
}: {
params: { id: string }
}) {
// starting loading item data
preload(id)
// perform another asynchronous task
const isAvailable = await checkIsAvailable()
return isAvailable ? <Item id={id} /> : null
}
### [Using React `cache`, `server-only`, and the Preload Pattern](#using-react-cache-server-only-and-the-preload-pattern)
You can combine the `cache` function, the `preload` pattern, and the `server-only` package to create a data fetching utility that can be used throughout your app.
utils/get-item.ts
TypeScript
JavaScriptTypeScript
import { cache } from 'react'
import 'server-only'
export const preload = (id: string) => {
void getItem(id)
}
export const getItem = cache(async (id: string) => {
// ...
})
With this approach, you can eagerly fetch data, cache responses, and guarantee that this data fetching [only happens on the server](/docs/app/building-your-application/rendering/composition-patterns#keeping-server-only-code-out-of-the-client-environment).
The `utils/get-item` exports can be used by Layouts, Pages, or other components to give them control over when an item's data is fetched.
> **Good to know:**
>
> * We recommend using the [`server-only` package](/docs/app/building-your-application/rendering/composition-patterns#keeping-server-only-code-out-of-the-client-environment) to make sure server data fetching functions are never used on the client.
[Preventing sensitive data from being exposed to the client](#preventing-sensitive-data-from-being-exposed-to-the-client)
-------------------------------------------------------------------------------------------------------------------------
We recommend using React's taint APIs, [`taintObjectReference`](https://react.dev/reference/react/experimental_taintObjectReference) and [`taintUniqueValue`](https://react.dev/reference/react/experimental_taintUniqueValue), to prevent whole object instances or sensitive values from being passed to the client.
To enable tainting in your application, set the Next.js Config `experimental.taint` option to `true`:
next.config.js
module.exports = {
experimental: {
taint: true,
},
}
Then pass the object or value you want to taint to the `experimental_taintObjectReference` or `experimental_taintUniqueValue` functions:
app/utils.ts
TypeScript
JavaScriptTypeScript
import { queryDataFromDB } from './api'
import {
experimental_taintObjectReference,
experimental_taintUniqueValue,
} from 'react'
export async function getUserData() {
const data = await queryDataFromDB()
experimental_taintObjectReference(
'Do not pass the whole user object to the client',
data
)
experimental_taintUniqueValue(
"Do not pass the user's address to the client",
data,
data.address
)
return data
}
app/page.tsx
TypeScript
JavaScriptTypeScript
import { getUserData } from './data'
export async function Page() {
const userData = getUserData()
return (
<ClientComponent
user={userData} // this will cause an error because of taintObjectReference
address={userData.address} // this will cause an error because of taintUniqueValue
/>
)
}
Learn more about [Security and Server Actions](https://nextjs.org/blog/security-nextjs-server-components-actions).
[Previous
Server Actions and Mutations
](/docs/app/building-your-application/data-fetching/server-actions-and-mutations)
[Next
Rendering
](/docs/app/building-your-application/rendering)
Was this helpful?
supported.
Send |
{
"contentLength": null,
"etag": "W/\"c6e0e33eac4004cd083bec51a0c632d1\"",
"lastModifiedHeader": null,
"lastModifiedHtml": null
} | https://nextjs.org/learn?utm_source=next-site&utm_medium=navbar | Start building with Next.js
===========================
Go from beginner to expert by learning the foundations of Next.js and building a fully functional demo website that uses all the latest features.
Learn Next.js
Learn Next.js
16 chapters that take you from React to Next.js.
[Placeholder](/learn)
Learn React Foundations
New to React? Learn how to go from JavaScript to React with this Foundations course.
[React Foundations](/learn/react-foundations)
How does the course work?
-------------------------
By building a full web application. Step by step.
![Course explainer](/_next/image?url=%2Flearn%2Fcourse-explainer.png&w=1920&q=75)![Course explainer](/_next/image?url=%2Flearn%2Fcourse-explainer-small.png&w=1920&q=75)
Set up your local environment and initializing the "ACME" Next.js project template.
Use pre-styled components as part of each chapter that leverage Next.js conventions and patterns.
Hook up real application logic and data to bring a fully-fledged demo website to life.
At the end you’ll have a website that’s ready to ship and the knowledge to build and deploy your own.
Your progress will be synced as you complete chapters
Go at your own pace and pick up where you left off
Test your knowledge during each chapter
Take quick quizzes to see what you’ve learned
What will I learn?
------------------
Here’s everything that’s covered in the course.
[
Introduction
Learn how to build a full-stack web application with the free, Next.js App Router Course.
](/learn/dashboard-app)
[
1
Getting Started
Create a new Next.js application using the dashboard starter example and explore the project.
](/learn/dashboard-app/getting-started)
[
2
CSS Styling
Style your Next.js application with Tailwind and CSS modules.
](/learn/dashboard-app/css-styling)
[
3
Optimizing Fonts and Images
Optimize fonts and images with the Next.js built-in components.
](/learn/dashboard-app/optimizing-fonts-images)
[
4
Creating Layouts and Pages
Create the dashboard routes and a shared layout that can be shared between multiple pages.
](/learn/dashboard-app/creating-layouts-and-pages)
[
5
Navigating Between Pages
Learn how to use the <Link> component to navigate between pages.
](/learn/dashboard-app/navigating-between-pages)
[
6
Setting Up Your Database
Setup a database for your application and seed it with initial data.
](/learn/dashboard-app/setting-up-your-database)
[
7
Fetching Data
Learn about the different ways to fetch data in Next.js, and fetch data for your dashboard page using Server Components.
](/learn/dashboard-app/fetching-data)
[
8
Static and Dynamic Rendering
Understand how rendering works in Next.js, and make your dashboard app dynamic.
](/learn/dashboard-app/static-and-dynamic-rendering)
[
9
Streaming
Improve your application's loading experience with streaming and loading skeletons.
](/learn/dashboard-app/streaming)
[
10
Partial Prerendering
An early look into Partial Prerendering and how it works.
](/learn/dashboard-app/partial-prerendering)
[
11
Adding Search and Pagination
Add search and pagination to your dashboard application using Next.js APIs.
](/learn/dashboard-app/adding-search-and-pagination)
[
12
Mutating Data
Mutate data using React Server Actions, and revalidate the Next.js cache.
](/learn/dashboard-app/mutating-data)
[
13
Handling Errors
Handle errors gracefully with error.tsx and notFound.
](/learn/dashboard-app/error-handling)
[
14
Improving Accessibility
Implement server-side form validation and improve accessibility in your forms.
](/learn/dashboard-app/improving-accessibility)
[
15
Adding Authentication
Add authentication to protect your dashboard routes using NextAuth.js, Server Actions, and Middleware.
](/learn/dashboard-app/adding-authentication)
[
16
Adding Metadata
Learn how to add metadata to your Next.js application.
](/learn/dashboard-app/adding-metadata)
[
17
Next Steps
Next.js Dashboard Course Conclusion
](/learn/dashboard-app/next-steps)
[Placeholder](/learn)
Looking to go deeper?
Continue learning by using our guides.
[View All Guides](https://vercel.com/guides?topics=frameworks)
[
How to build a fullstack app with Next.js, Prisma and Postgres
Build, Deployment & Git
](https://vercel.com/guides/nextjs-prisma-postgres)[
Build a multi-tenant app with custom domains using Next.js
Build, Deployment & Git
](https://vercel.com/guides/nextjs-multi-tenant-application)[
Integrating Next.js and Contentful for your headless CMS
Databases & CMS
](https://vercel.com/guides/integrating-next-js-and-contentful-for-your-headless-cms)[
Building Ecommerce Sites with Next.js and Shopify
Databases & CMS
](https://vercel.com/guides/building-ecommerce-sites-with-next-js-and-shopify)[
Using headless WordPress with Next.js and Vercel
Databases & CMS
](https://vercel.com/guides/wordpress-with-vercel)
Next.js Documentation
The complete resource for installing, running, building with, and deploying Next.js
[View the Documentation](https://nextjs.org/docs) |
{
"contentLength": null,
"etag": "W/\"d71d84974714e6b5b027cab81889329e\"",
"lastModifiedHeader": null,
"lastModifiedHtml": null
} | https://nextjs.org/docs/app/api-reference/file-conventions/metadata/sitemap | Menu
Using App Router
Features available in /app
* [Getting Started](/docs/getting-started)
* [Installation](/docs/getting-started/installation)
* [Project Structure](/docs/getting-started/project-structure)
* [Building Your Application](/docs/app/building-your-application)
* [Routing](/docs/app/building-your-application/routing)
* [Defining Routes](/docs/app/building-your-application/routing/defining-routes)
* [Pages and Layouts](/docs/app/building-your-application/routing/pages-and-layouts)
* [Linking and Navigating](/docs/app/building-your-application/routing/linking-and-navigating)
* [Loading UI and Streaming](/docs/app/building-your-application/routing/loading-ui-and-streaming)
* [Error Handling](/docs/app/building-your-application/routing/error-handling)
* [Redirecting](/docs/app/building-your-application/routing/redirecting)
* [Route Groups](/docs/app/building-your-application/routing/route-groups)
* [Project Organization](/docs/app/building-your-application/routing/colocation)
* [Dynamic Routes](/docs/app/building-your-application/routing/dynamic-routes)
* [Parallel Routes](/docs/app/building-your-application/routing/parallel-routes)
* [Intercepting Routes](/docs/app/building-your-application/routing/intercepting-routes)
* [Route Handlers](/docs/app/building-your-application/routing/route-handlers)
* [Middleware](/docs/app/building-your-application/routing/middleware)
* [Internationalization](/docs/app/building-your-application/routing/internationalization)
* [Data Fetching](/docs/app/building-your-application/data-fetching)
* [Fetching, Caching, and Revalidating](/docs/app/building-your-application/data-fetching/fetching-caching-and-revalidating)
* [Server Actions and Mutations](/docs/app/building-your-application/data-fetching/server-actions-and-mutations)
* [Data Fetching Patterns and Best Practices](/docs/app/building-your-application/data-fetching/patterns)
* [Rendering](/docs/app/building-your-application/rendering)
* [Server Components](/docs/app/building-your-application/rendering/server-components)
* [Client Components](/docs/app/building-your-application/rendering/client-components)
* [Composition Patterns](/docs/app/building-your-application/rendering/composition-patterns)
* [Edge and Node.js Runtimes](/docs/app/building-your-application/rendering/edge-and-nodejs-runtimes)
* [Caching](/docs/app/building-your-application/caching)
* [Styling](/docs/app/building-your-application/styling)
* [CSS Modules](/docs/app/building-your-application/styling/css-modules)
* [Tailwind CSS](/docs/app/building-your-application/styling/tailwind-css)
* [CSS-in-JS](/docs/app/building-your-application/styling/css-in-js)
* [Sass](/docs/app/building-your-application/styling/sass)
* [Optimizing](/docs/app/building-your-application/optimizing)
* [Images](/docs/app/building-your-application/optimizing/images)
* [Videos](/docs/app/building-your-application/optimizing/videos)
* [Fonts](/docs/app/building-your-application/optimizing/fonts)
* [Metadata](/docs/app/building-your-application/optimizing/metadata)
* [Scripts](/docs/app/building-your-application/optimizing/scripts)
* [Bundle Analyzer](/docs/app/building-your-application/optimizing/bundle-analyzer)
* [Lazy Loading](/docs/app/building-your-application/optimizing/lazy-loading)
* [Analytics](/docs/app/building-your-application/optimizing/analytics)
* [Instrumentation](/docs/app/building-your-application/optimizing/instrumentation)
* [OpenTelemetry](/docs/app/building-your-application/optimizing/open-telemetry)
* [Static Assets](/docs/app/building-your-application/optimizing/static-assets)
* [Third Party Libraries](/docs/app/building-your-application/optimizing/third-party-libraries)
* [Memory Usage](/docs/app/building-your-application/optimizing/memory-usage)
* [Configuring](/docs/app/building-your-application/configuring)
* [TypeScript](/docs/app/building-your-application/configuring/typescript)
* [ESLint](/docs/app/building-your-application/configuring/eslint)
* [Environment Variables](/docs/app/building-your-application/configuring/environment-variables)
* [Absolute Imports and Module Path Aliases](/docs/app/building-your-application/configuring/absolute-imports-and-module-aliases)
* [MDX](/docs/app/building-your-application/configuring/mdx)
* [src Directory](/docs/app/building-your-application/configuring/src-directory)
* [Draft Mode](/docs/app/building-your-application/configuring/draft-mode)
* [Content Security Policy](/docs/app/building-your-application/configuring/content-security-policy)
* [Testing](/docs/app/building-your-application/testing)
* [Vitest](/docs/app/building-your-application/testing/vitest)
* [Jest](/docs/app/building-your-application/testing/jest)
* [Playwright](/docs/app/building-your-application/testing/playwright)
* [Cypress](/docs/app/building-your-application/testing/cypress)
* [Authentication](/docs/app/building-your-application/authentication)
* [Deploying](/docs/app/building-your-application/deploying)
* [Production Checklist](/docs/app/building-your-application/deploying/production-checklist)
* [Static Exports](/docs/app/building-your-application/deploying/static-exports)
* [Upgrading](/docs/app/building-your-application/upgrading)
* [Codemods](/docs/app/building-your-application/upgrading/codemods)
* [App Router Migration](/docs/app/building-your-application/upgrading/app-router-migration)
* [Version 14](/docs/app/building-your-application/upgrading/version-14)
* [Migrating from Vite](/docs/app/building-your-application/upgrading/from-vite)
* [Migrating from Create React App](/docs/app/building-your-application/upgrading/from-create-react-app)
* [API Reference](/docs/app/api-reference)
* [Components](/docs/app/api-reference/components)
* [Font](/docs/app/api-reference/components/font)
* [<Image>](/docs/app/api-reference/components/image)
* [<Link>](/docs/app/api-reference/components/link)
* [<Script>](/docs/app/api-reference/components/script)
* [File Conventions](/docs/app/api-reference/file-conventions)
* [default.js](/docs/app/api-reference/file-conventions/default)
* [error.js](/docs/app/api-reference/file-conventions/error)
* [instrumentation.js](/docs/app/api-reference/file-conventions/instrumentation)
* [layout.js](/docs/app/api-reference/file-conventions/layout)
* [loading.js](/docs/app/api-reference/file-conventions/loading)
* [middleware.js](/docs/app/api-reference/file-conventions/middleware)
* [not-found.js](/docs/app/api-reference/file-conventions/not-found)
* [page.js](/docs/app/api-reference/file-conventions/page)
* [route.js](/docs/app/api-reference/file-conventions/route)
* [Route Segment Config](/docs/app/api-reference/file-conventions/route-segment-config)
* [template.js](/docs/app/api-reference/file-conventions/template)
* [Metadata Files](/docs/app/api-reference/file-conventions/metadata)
* [favicon, icon, and apple-icon](/docs/app/api-reference/file-conventions/metadata/app-icons)
* [manifest.json](/docs/app/api-reference/file-conventions/metadata/manifest)
* [opengraph-image and twitter-image](/docs/app/api-reference/file-conventions/metadata/opengraph-image)
* [robots.txt](/docs/app/api-reference/file-conventions/metadata/robots)
* [
sitemap.xml](/docs/app/api-reference/file-conventions/metadata/sitemap)
* [Functions](/docs/app/api-reference/functions)
* [cookies](/docs/app/api-reference/functions/cookies)
* [draftMode](/docs/app/api-reference/functions/draft-mode)
* [fetch](/docs/app/api-reference/functions/fetch)
* [generateImageMetadata](/docs/app/api-reference/functions/generate-image-metadata)
* [generateMetadata](/docs/app/api-reference/functions/generate-metadata)
* [generateSitemaps](/docs/app/api-reference/functions/generate-sitemaps)
* [generateStaticParams](/docs/app/api-reference/functions/generate-static-params)
* [generateViewport](/docs/app/api-reference/functions/generate-viewport)
* [headers](/docs/app/api-reference/functions/headers)
* [ImageResponse](/docs/app/api-reference/functions/image-response)
* [NextRequest](/docs/app/api-reference/functions/next-request)
* [NextResponse](/docs/app/api-reference/functions/next-response)
* [notFound](/docs/app/api-reference/functions/not-found)
* [permanentRedirect](/docs/app/api-reference/functions/permanentRedirect)
* [redirect](/docs/app/api-reference/functions/redirect)
* [revalidatePath](/docs/app/api-reference/functions/revalidatePath)
* [revalidateTag](/docs/app/api-reference/functions/revalidateTag)
* [unstable\_cache](/docs/app/api-reference/functions/unstable_cache)
* [unstable\_noStore](/docs/app/api-reference/functions/unstable_noStore)
* [useParams](/docs/app/api-reference/functions/use-params)
* [usePathname](/docs/app/api-reference/functions/use-pathname)
* [useReportWebVitals](/docs/app/api-reference/functions/use-report-web-vitals)
* [useRouter](/docs/app/api-reference/functions/use-router)
* [useSearchParams](/docs/app/api-reference/functions/use-search-params)
* [useSelectedLayoutSegment](/docs/app/api-reference/functions/use-selected-layout-segment)
* [useSelectedLayoutSegments](/docs/app/api-reference/functions/use-selected-layout-segments)
* [userAgent](/docs/app/api-reference/functions/userAgent)
* [next.config.js Options](/docs/app/api-reference/next-config-js)
* [appDir](/docs/app/api-reference/next-config-js/appDir)
* [assetPrefix](/docs/app/api-reference/next-config-js/assetPrefix)
* [basePath](/docs/app/api-reference/next-config-js/basePath)
* [compress](/docs/app/api-reference/next-config-js/compress)
* [crossOrigin](/docs/app/api-reference/next-config-js/crossOrigin)
* [devIndicators](/docs/app/api-reference/next-config-js/devIndicators)
* [distDir](/docs/app/api-reference/next-config-js/distDir)
* [env](/docs/app/api-reference/next-config-js/env)
* [eslint](/docs/app/api-reference/next-config-js/eslint)
* [exportPathMap](/docs/app/api-reference/next-config-js/exportPathMap)
* [generateBuildId](/docs/app/api-reference/next-config-js/generateBuildId)
* [generateEtags](/docs/app/api-reference/next-config-js/generateEtags)
* [headers](/docs/app/api-reference/next-config-js/headers)
* [httpAgentOptions](/docs/app/api-reference/next-config-js/httpAgentOptions)
* [images](/docs/app/api-reference/next-config-js/images)
* [cacheHandler](/docs/app/api-reference/next-config-js/incrementalCacheHandlerPath)
* [instrumentationHook](/docs/app/api-reference/next-config-js/instrumentationHook)
* [logging](/docs/app/api-reference/next-config-js/logging)
* [mdxRs](/docs/app/api-reference/next-config-js/mdxRs)
* [onDemandEntries](/docs/app/api-reference/next-config-js/onDemandEntries)
* [optimizePackageImports](/docs/app/api-reference/next-config-js/optimizePackageImports)
* [output](/docs/app/api-reference/next-config-js/output)
* [pageExtensions](/docs/app/api-reference/next-config-js/pageExtensions)
* [Partial Prerendering (experimental)](/docs/app/api-reference/next-config-js/partial-prerendering)
* [poweredByHeader](/docs/app/api-reference/next-config-js/poweredByHeader)
* [productionBrowserSourceMaps](/docs/app/api-reference/next-config-js/productionBrowserSourceMaps)
* [reactStrictMode](/docs/app/api-reference/next-config-js/reactStrictMode)
* [redirects](/docs/app/api-reference/next-config-js/redirects)
* [rewrites](/docs/app/api-reference/next-config-js/rewrites)
* [serverActions](/docs/app/api-reference/next-config-js/serverActions)
* [serverComponentsExternalPackages](/docs/app/api-reference/next-config-js/serverComponentsExternalPackages)
* [StaleTimes (experimental)](/docs/app/api-reference/next-config-js/staleTimes)
* [trailingSlash](/docs/app/api-reference/next-config-js/trailingSlash)
* [transpilePackages](/docs/app/api-reference/next-config-js/transpilePackages)
* [turbo](/docs/app/api-reference/next-config-js/turbo)
* [typedRoutes](/docs/app/api-reference/next-config-js/typedRoutes)
* [typescript](/docs/app/api-reference/next-config-js/typescript)
* [urlImports](/docs/app/api-reference/next-config-js/urlImports)
* [webpack](/docs/app/api-reference/next-config-js/webpack)
* [webVitalsAttribution](/docs/app/api-reference/next-config-js/webVitalsAttribution)
* [create-next-app](/docs/app/api-reference/create-next-app)
* [Edge Runtime](/docs/app/api-reference/edge)
* [Next.js CLI](/docs/app/api-reference/next-cli)
* [Building Your Application](/docs/pages/building-your-application)
* [Routing](/docs/pages/building-your-application/routing)
* [Pages and Layouts](/docs/pages/building-your-application/routing/pages-and-layouts)
* [Dynamic Routes](/docs/pages/building-your-application/routing/dynamic-routes)
* [Linking and Navigating](/docs/pages/building-your-application/routing/linking-and-navigating)
* [Redirecting](/docs/pages/building-your-application/routing/redirecting)
* [Custom App](/docs/pages/building-your-application/routing/custom-app)
* [Custom Document](/docs/pages/building-your-application/routing/custom-document)
* [API Routes](/docs/pages/building-your-application/routing/api-routes)
* [Custom Errors](/docs/pages/building-your-application/routing/custom-error)
* [Internationalization](/docs/pages/building-your-application/routing/internationalization)
* [Middleware](/docs/pages/building-your-application/routing/middleware)
* [Rendering](/docs/pages/building-your-application/rendering)
* [Server-side Rendering (SSR)](/docs/pages/building-your-application/rendering/server-side-rendering)
* [Static Site Generation (SSG)](/docs/pages/building-your-application/rendering/static-site-generation)
* [Automatic Static Optimization](/docs/pages/building-your-application/rendering/automatic-static-optimization)
* [Client-side Rendering (CSR)](/docs/pages/building-your-application/rendering/client-side-rendering)
* [Edge and Node.js Runtimes](/docs/pages/building-your-application/rendering/edge-and-nodejs-runtimes)
* [Data Fetching](/docs/pages/building-your-application/data-fetching)
* [getStaticProps](/docs/pages/building-your-application/data-fetching/get-static-props)
* [getStaticPaths](/docs/pages/building-your-application/data-fetching/get-static-paths)
* [Forms and Mutations](/docs/pages/building-your-application/data-fetching/forms-and-mutations)
* [getServerSideProps](/docs/pages/building-your-application/data-fetching/get-server-side-props)
* [Incremental Static Regeneration (ISR)](/docs/pages/building-your-application/data-fetching/incremental-static-regeneration)
* [Client-side Fetching](/docs/pages/building-your-application/data-fetching/client-side)
* [Styling](/docs/pages/building-your-application/styling)
* [CSS Modules](/docs/pages/building-your-application/styling/css-modules)
* [Tailwind CSS](/docs/pages/building-your-application/styling/tailwind-css)
* [CSS-in-JS](/docs/pages/building-your-application/styling/css-in-js)
* [Sass](/docs/pages/building-your-application/styling/sass)
* [Optimizing](/docs/pages/building-your-application/optimizing)
* [Images](/docs/pages/building-your-application/optimizing/images)
* [Fonts](/docs/pages/building-your-application/optimizing/fonts)
* [Scripts](/docs/pages/building-your-application/optimizing/scripts)
* [Static Assets](/docs/pages/building-your-application/optimizing/static-assets)
* [Bundle Analyzer](/docs/pages/building-your-application/optimizing/bundle-analyzer)
* [Analytics](/docs/pages/building-your-application/optimizing/analytics)
* [Lazy Loading](/docs/pages/building-your-application/optimizing/lazy-loading)
* [Instrumentation](/docs/pages/building-your-application/optimizing/instrumentation)
* [OpenTelemetry](/docs/pages/building-your-application/optimizing/open-telemetry)
* [Third Party Libraries](/docs/pages/building-your-application/optimizing/third-party-libraries)
* [Configuring](/docs/pages/building-your-application/configuring)
* [TypeScript](/docs/pages/building-your-application/configuring/typescript)
* [ESLint](/docs/pages/building-your-application/configuring/eslint)
* [Environment Variables](/docs/pages/building-your-application/configuring/environment-variables)
* [Absolute Imports and Module Path Aliases](/docs/pages/building-your-application/configuring/absolute-imports-and-module-aliases)
* [src Directory](/docs/pages/building-your-application/configuring/src-directory)
* [MDX](/docs/pages/building-your-application/configuring/mdx)
* [AMP](/docs/pages/building-your-application/configuring/amp)
* [Babel](/docs/pages/building-your-application/configuring/babel)
* [PostCSS](/docs/pages/building-your-application/configuring/post-css)
* [Custom Server](/docs/pages/building-your-application/configuring/custom-server)
* [Draft Mode](/docs/pages/building-your-application/configuring/draft-mode)
* [Error Handling](/docs/pages/building-your-application/configuring/error-handling)
* [Debugging](/docs/pages/building-your-application/configuring/debugging)
* [Preview Mode](/docs/pages/building-your-application/configuring/preview-mode)
* [Content Security Policy](/docs/pages/building-your-application/configuring/content-security-policy)
* [Testing](/docs/pages/building-your-application/testing)
* [Vitest](/docs/pages/building-your-application/testing/vitest)
* [Jest](/docs/pages/building-your-application/testing/jest)
* [Playwright](/docs/pages/building-your-application/testing/playwright)
* [Cypress](/docs/pages/building-your-application/testing/cypress)
* [Authentication](/docs/pages/building-your-application/authentication)
* [Deploying](/docs/pages/building-your-application/deploying)
* [Production Checklist](/docs/pages/building-your-application/deploying/production-checklist)
* [Static Exports](/docs/pages/building-your-application/deploying/static-exports)
* [Multi Zones](/docs/pages/building-your-application/deploying/multi-zones)
* [Continuous Integration (CI) Build Caching](/docs/pages/building-your-application/deploying/ci-build-caching)
* [Upgrading](/docs/pages/building-your-application/upgrading)
* [Codemods](/docs/pages/building-your-application/upgrading/codemods)
* [From Pages to App](/docs/pages/building-your-application/upgrading/app-router-migration)
* [Migrating from Vite](/docs/pages/building-your-application/upgrading/from-vite)
* [Migrating from Create React App](/docs/pages/building-your-application/upgrading/from-create-react-app)
* [Version 14](/docs/pages/building-your-application/upgrading/version-14)
* [Version 13](/docs/pages/building-your-application/upgrading/version-13)
* [Version 12](/docs/pages/building-your-application/upgrading/version-12)
* [Version 11](/docs/pages/building-your-application/upgrading/version-11)
* [Version 10](/docs/pages/building-your-application/upgrading/version-10)
* [Version 9](/docs/pages/building-your-application/upgrading/version-9)
* [API Reference](/docs/pages/api-reference)
* [Components](/docs/pages/api-reference/components)
* [Font](/docs/pages/api-reference/components/font)
* [<Head>](/docs/pages/api-reference/components/head)
* [<Image>](/docs/pages/api-reference/components/image)
* [<Image> (Legacy)](/docs/pages/api-reference/components/image-legacy)
* [<Link>](/docs/pages/api-reference/components/link)
* [<Script>](/docs/pages/api-reference/components/script)
* [Functions](/docs/pages/api-reference/functions)
* [getInitialProps](/docs/pages/api-reference/functions/get-initial-props)
* [getServerSideProps](/docs/pages/api-reference/functions/get-server-side-props)
* [getStaticPaths](/docs/pages/api-reference/functions/get-static-paths)
* [getStaticProps](/docs/pages/api-reference/functions/get-static-props)
* [NextRequest](/docs/pages/api-reference/functions/next-request)
* [NextResponse](/docs/pages/api-reference/functions/next-response)
* [useAmp](/docs/pages/api-reference/functions/use-amp)
* [useReportWebVitals](/docs/pages/api-reference/functions/use-report-web-vitals)
* [useRouter](/docs/pages/api-reference/functions/use-router)
* [userAgent](/docs/pages/api-reference/functions/userAgent)
* [next.config.js Options](/docs/pages/api-reference/next-config-js)
* [assetPrefix](/docs/pages/api-reference/next-config-js/assetPrefix)
* [basePath](/docs/pages/api-reference/next-config-js/basePath)
* [compress](/docs/pages/api-reference/next-config-js/compress)
* [crossOrigin](/docs/pages/api-reference/next-config-js/crossOrigin)
* [devIndicators](/docs/pages/api-reference/next-config-js/devIndicators)
* [distDir](/docs/pages/api-reference/next-config-js/distDir)
* [env](/docs/pages/api-reference/next-config-js/env)
* [eslint](/docs/pages/api-reference/next-config-js/eslint)
* [exportPathMap](/docs/pages/api-reference/next-config-js/exportPathMap)
* [generateBuildId](/docs/pages/api-reference/next-config-js/generateBuildId)
* [generateEtags](/docs/pages/api-reference/next-config-js/generateEtags)
* [headers](/docs/pages/api-reference/next-config-js/headers)
* [httpAgentOptions](/docs/pages/api-reference/next-config-js/httpAgentOptions)
* [images](/docs/pages/api-reference/next-config-js/images)
* [instrumentationHook](/docs/pages/api-reference/next-config-js/instrumentationHook)
* [onDemandEntries](/docs/pages/api-reference/next-config-js/onDemandEntries)
* [optimizePackageImports](/docs/pages/api-reference/next-config-js/optimizePackageImports)
* [output](/docs/pages/api-reference/next-config-js/output)
* [pageExtensions](/docs/pages/api-reference/next-config-js/pageExtensions)
* [poweredByHeader](/docs/pages/api-reference/next-config-js/poweredByHeader)
* [productionBrowserSourceMaps](/docs/pages/api-reference/next-config-js/productionBrowserSourceMaps)
* [reactStrictMode](/docs/pages/api-reference/next-config-js/reactStrictMode)
* [redirects](/docs/pages/api-reference/next-config-js/redirects)
* [rewrites](/docs/pages/api-reference/next-config-js/rewrites)
* [Runtime Config](/docs/pages/api-reference/next-config-js/runtime-configuration)
* [trailingSlash](/docs/pages/api-reference/next-config-js/trailingSlash)
* [transpilePackages](/docs/pages/api-reference/next-config-js/transpilePackages)
* [turbo](/docs/pages/api-reference/next-config-js/turbo)
* [typescript](/docs/pages/api-reference/next-config-js/typescript)
* [urlImports](/docs/pages/api-reference/next-config-js/urlImports)
* [webpack](/docs/pages/api-reference/next-config-js/webpack)
* [webVitalsAttribution](/docs/pages/api-reference/next-config-js/webVitalsAttribution)
* [create-next-app](/docs/pages/api-reference/create-next-app)
* [Next.js CLI](/docs/pages/api-reference/next-cli)
* [Edge Runtime](/docs/pages/api-reference/edge)
* [Architecture](/docs/architecture)
* [Accessibility](/docs/architecture/accessibility)
* [Fast Refresh](/docs/architecture/fast-refresh)
* [Next.js Compiler](/docs/architecture/nextjs-compiler)
* [Supported Browsers](/docs/architecture/supported-browsers)
* [Turbopack](/docs/architecture/turbopack)
* [Community](/docs/community)
* [Contribution Guide](/docs/community/contribution-guide)
On this page
* [Sitemap files (.xml)](#sitemap-files-xml)
* [Generating a sitemap using code (.js, .ts)](#generating-a-sitemap-using-code-js-ts)
* [Generate a localized Sitemap](#generate-a-localized-sitemap)
* [Generating multiple sitemaps](#generating-multiple-sitemaps)
* [Returns](#returns)
* [Version History](#version-history)
* [Next Steps](#next-steps)
[Edit this page on GitHub](https://github.com/vercel/next.js/edit/canary/docs/02-app/02-api-reference/02-file-conventions/01-metadata/sitemap.mdx) [Managed Next.js (Vercel)](https://vercel.com/solutions/nextjs?utm_source=next_site&utm_medium=web&utm_campaign=managed_nextjs_solutions_page) Scroll to top
[App Router](/docs/app)[...](/docs/app/api-reference/file-conventions)[Metadata Files](/docs/app/api-reference/file-conventions/metadata)sitemap.xml
sitemap.xml
===========
`sitemap.(xml|js|ts)` is a special file that matches the [Sitemaps XML format](https://www.sitemaps.org/protocol.html) to help search engine crawlers index your site more efficiently.
### [Sitemap files (.xml)](#sitemap-files-xml)
For smaller applications, you can create a `sitemap.xml` file and place it in the root of your `app` directory.
app/sitemap.xml
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://acme.com</loc>
<lastmod>2023-04-06T15:02:24.021Z</lastmod>
<changefreq>yearly</changefreq>
<priority>1</priority>
</url>
<url>
<loc>https://acme.com/about</loc>
<lastmod>2023-04-06T15:02:24.021Z</lastmod>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>
<url>
<loc>https://acme.com/blog</loc>
<lastmod>2023-04-06T15:02:24.021Z</lastmod>
<changefreq>weekly</changefreq>
<priority>0.5</priority>
</url>
</urlset>
### [Generating a sitemap using code (.js, .ts)](#generating-a-sitemap-using-code-js-ts)
You can use the `sitemap.(js|ts)` file convention to programmatically **generate** a sitemap by exporting a default function that returns an array of URLs. If using TypeScript, a [`Sitemap`](#returns) type is available.
app/sitemap.ts
TypeScript
JavaScriptTypeScript
import { MetadataRoute } from 'next'
export default function sitemap(): MetadataRoute.Sitemap {
return [
{
url: 'https://acme.com',
lastModified: new Date(),
changeFrequency: 'yearly',
priority: 1,
},
{
url: 'https://acme.com/about',
lastModified: new Date(),
changeFrequency: 'monthly',
priority: 0.8,
},
{
url: 'https://acme.com/blog',
lastModified: new Date(),
changeFrequency: 'weekly',
priority: 0.5,
},
]
}
Output:
acme.com/sitemap.xml
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://acme.com</loc>
<lastmod>2023-04-06T15:02:24.021Z</lastmod>
<changefreq>yearly</changefreq>
<priority>1</priority>
</url>
<url>
<loc>https://acme.com/about</loc>
<lastmod>2023-04-06T15:02:24.021Z</lastmod>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>
<url>
<loc>https://acme.com/blog</loc>
<lastmod>2023-04-06T15:02:24.021Z</lastmod>
<changefreq>weekly</changefreq>
<priority>0.5</priority>
</url>
</urlset>
### [Generate a localized Sitemap](#generate-a-localized-sitemap)
app/sitemap.ts
TypeScript
JavaScriptTypeScript
import { MetadataRoute } from 'next'
export default function sitemap(): MetadataRoute.Sitemap {
return [
{
url: 'https://acme.com',
lastModified: new Date(),
alternates: {
languages: {
es: 'https://acme.com/es',
de: 'https://acme.com/de',
},
},
},
{
url: 'https://acme.com/about',
lastModified: new Date(),
alternates: {
languages: {
es: 'https://acme.com/es/about',
de: 'https://acme.com/de/about',
},
},
},
{
url: 'https://acme.com/blog',
lastModified: new Date(),
alternates: {
languages: {
es: 'https://acme.com/es/blog',
de: 'https://acme.com/de/blog',
},
},
},
]
}
Output:
acme.com/sitemap.xml
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">
<url>
<loc>https://acme.com</loc>
<xhtml:link
rel="alternate"
hreflang="es"
href="https://acme.com/es"/>
<xhtml:link
rel="alternate"
hreflang="de"
href="https://acme.com/de"/>
<lastmod>2023-04-06T15:02:24.021Z</lastmod>
</url>
<url>
<loc>https://acme.com/about</loc>
<xhtml:link
rel="alternate"
hreflang="es"
href="https://acme.com/es/about"/>
<xhtml:link
rel="alternate"
hreflang="de"
href="https://acme.com/de/about"/>
<lastmod>2023-04-06T15:02:24.021Z</lastmod>
</url>
<url>
<loc>https://acme.com/blog</loc>
<xhtml:link
rel="alternate"
hreflang="es"
href="https://acme.com/es/blog"/>
<xhtml:link
rel="alternate"
hreflang="de"
href="https://acme.com/de/blog"/>
<lastmod>2023-04-06T15:02:24.021Z</lastmod>
</url>
</urlset>
### [Generating multiple sitemaps](#generating-multiple-sitemaps)
While a single sitemap will work for most applications. For large web applications, you may need to split a sitemap into multiple files.
There are two ways you can create multiple sitemaps:
* By nesting `sitemap.(xml|js|ts)` inside multiple route segments e.g. `app/sitemap.xml` and `app/products/sitemap.xml`.
* By using the [`generateSitemaps`](/docs/app/api-reference/functions/generate-sitemaps) function.
For example, to split a sitemap using `generateSitemaps`, return an array of objects with the sitemap `id`. Then, use the `id` to generate the unique sitemaps.
app/product/sitemap.ts
TypeScript
JavaScriptTypeScript
import { BASE_URL } from '@/app/lib/constants'
export async function generateSitemaps() {
// Fetch the total number of products and calculate the number of sitemaps needed
return [{ id: 0 }, { id: 1 }, { id: 2 }, { id: 3 }]
}
export default async function sitemap({
id,
}: {
id: number
}): Promise<MetadataRoute.Sitemap> {
// Google's limit is 50,000 URLs per sitemap
const start = id * 50000
const end = start + 50000
const products = await getProducts(
`SELECT id, date FROM products WHERE id BETWEEN ${start} AND ${end}`
)
return products.map((product) => ({
url: `${BASE_URL}/product/${id}`,
lastModified: product.date,
}))
}
In production, your generated sitemaps will be available at `/.../sitemap/[id].xml`. For example, `/product/sitemap/1.xml`.
In development, you can view the generated sitemap on `/.../sitemap.xml/[id]`. For example, `/product/sitemap.xml/1`. This difference is temporary and will follow the production format.
See the [`generateSitemaps` API reference](/docs/app/api-reference/functions/generate-sitemaps) for more information.
[Returns](#returns)
-------------------
The default function exported from `sitemap.(xml|ts|js)` should return an array of objects with the following properties:
type Sitemap = Array<{
url: string
lastModified?: string | Date
changeFrequency?:
| 'always'
| 'hourly'
| 'daily'
| 'weekly'
| 'monthly'
| 'yearly'
| 'never'
priority?: number
alternates?: {
languages?: Languages<string>
}
}>
[Version History](#version-history)
-----------------------------------
Version
Changes
`v13.4.5`
Add `changeFrequency` and `priority` attributes to sitemaps.
`v13.3.0`
`sitemap` introduced.
Next Steps
----------
Learn how to use the generateSitemaps function.
[
App Router
...
Functions
### generateSitemaps
Learn how to use the generateSiteMaps function to create multiple sitemaps for your application.
](/docs/app/api-reference/functions/generate-sitemaps)
[Previous
robots.txt
](/docs/app/api-reference/file-conventions/metadata/robots)
[Next
Functions
](/docs/app/api-reference/functions)
Was this helpful?
supported.
Send |
{
"contentLength": null,
"etag": "W/\"f0d8b555bc7403466b72bf0e5f18e66c\"",
"lastModifiedHeader": null,
"lastModifiedHtml": null
} | https://nextjs.org/blog | The latest Next.js news
=======================
May 23rd, 2024
![](/_next/image?url=%2Fstatic%2Fteam%2Fdelba.jpg&w=48&q=75)
![](/_next/image?url=%2Fstatic%2Fteam%2Fzack.jpg&w=48&q=75)
[Next.js 15 RC](/blog/next-15-rc)
The Next.js 15 Release Candidate (RC) is now available. This early version allows you to test the latest features before the upcoming stable release.
* [React RC](/blog/next-15-rc#react-19-rc)
* [Caching defaults changes](/blog/next-15-rc#caching-updates)
* [Incremental Partial Prerendering adoption](/blog/next-15-rc#incremental-adoption-of-partial-prerendering-experimental)
* [next/after (Experimental)](/blog/next-15-rc#executing-code-after-a-response-with-nextafter-experimental)
* [New create-next-app design](/blog/next-15-rc#create-next-app-updates)
* [Bundling external packages (Stable)](/blog/next-15-rc#optimizing-bundling-of-external-packages-stable)
[Read More](/blog/next-15-rc)
April 11th, 2024
![](/_next/image?url=%2Fstatic%2Fteam%2Fdelba.jpg&w=48&q=75)
![](/_next/image?url=%2Fstatic%2Fteam%2Ftim.jpg&w=48&q=75)
[Next.js 14.2](/blog/next-14-2)
Next.js 14.2 includes development, production, and caching improvements.
* [Turbopack (Release Candidate)](/blog/next-14-2#turbopack-for-development-release-candidate)
* [Caching Improvements](/blog/next-14-2#caching-improvements)
* [Build and Production Improvements](/blog/next-14-2#build-and-production-improvements)
* [Errors DX Improvements](/blog/next-14-2#errors-dx-improvements)
[Read More](/blog/next-14-2)
January 18th, 2024
![](/_next/image?url=%2Fstatic%2Fteam%2Fjiachi.png&w=48&q=75)
![](/_next/image?url=%2Fstatic%2Fteam%2Fjimmy.jpg&w=48&q=75)
[Next.js 14.1](/blog/next-14-1)
Next.js 14.1 includes developer experience improvements including:
* [Improved Self-Hosting](/blog/next-14-1#improved-self-hosting)
* [Turbopack Improvements](/blog/next-14-1#turbopack-improvements)
* [DX Improvements](/blog/next-14-1#developer-experience-improvements)
* [Parallel & Intercepted Routes](/blog/next-14-1#parallel--intercepted-routes)
* [`next/image` Improvements](/blog/next-14-1#nextimage-support-for-picture-and-art-direction)
[Read More](/blog/next-14-1)
October 26th, 2023
![](/_next/image?url=%2Fstatic%2Fteam%2Flee.jpg&w=48&q=75)
![](/_next/image?url=%2Fstatic%2Fteam%2Ftim.jpg&w=48&q=75)
[Next.js 14](/blog/next-14)
As we announced at [Next.js Conf](https://nextjs.org/conf), Next.js 14 is our most focused release with:
* [Turbopack](/blog/next-14#nextjs-compiler-turbocharged)
* **53% faster** local server startup
* **94% faster** code updates
* [Server Actions (Stable)](/blog/next-14#forms-and-mutations)
* [Partial Prerendering (Preview)](/blog/next-14#partial-prerendering-preview)
* [Next.js Learn (New)](/blog/next-14#nextjs-learn-course)
[Read More](/blog/next-14)
October 23rd, 2023
![](/_next/image?url=%2Fstatic%2Fteam%2Fseb.jpg&w=48&q=75)
[How to Think About Security in Next.js](/blog/security-nextjs-server-components-actions)
React Server Components (RSC) in App Router is a novel paradigm that eliminates much of the redundancy and potential risks linked with conventional methods. Given the newness, developers and subsequently security teams may find it challenging to align their existing security protocols with this model.
[Read More](/blog/security-nextjs-server-components-actions)
September 19th, 2023
![](/_next/image?url=%2Fstatic%2Fteam%2Fjimmy.jpg&w=48&q=75)
![](/_next/image?url=%2Fstatic%2Fteam%2Ftim.jpg&w=48&q=75)
![](/_next/image?url=%2Fstatic%2Fteam%2Fsokra.jpg&w=48&q=75)
[Next.js 13.5](/blog/next-13-5)
Next.js 13.5 improves local dev performance and reliability with:
* [22% faster local server startup](/blog/next-13-5#improving-startup-and-fast-refresh-time)
* [29% faster HMR (Fast Refresh)](/blog/next-13-5#improving-startup-and-fast-refresh-time)
* [40% less memory usage](/blog/next-13-5#improving-startup-and-fast-refresh-time)
* [Optimized Package Imports](/blog/next-13-5#optimized-package-imports)
* [`next/image` Improvements](/blog/next-13-5#nextimage-improvements)
* [And over 438 bugs patched!](/blog/next-13-5#other-improvements)
[Read More](/blog/next-13-5)
June 22nd, 2023
![](/_next/image?url=%2Fstatic%2Fteam%2Fdelba.jpg&w=48&q=75)
![](/_next/image?url=%2Fstatic%2Fteam%2Flee.jpg&w=48&q=75)
[Next.js App Router Update](/blog/june-2023-update)
For the next release (and coming months) we're focused on the following areas:
* **Performance**
* **Stability**
* **Developer Experience**
[Read More](/blog/june-2023-update)
May 4th, 2023
![](/_next/image?url=%2Fstatic%2Fteam%2Fseb.jpg&w=48&q=75)
![](/_next/image?url=%2Fstatic%2Fteam%2Ftim.jpg&w=48&q=75)
[Next.js 13.4](/blog/next-13-4)
Next.js 13.4 is a foundational release, marking stability for the App Router:
* [App Router (Stable)](/blog/next-13-4#nextjs-app-router)
* [Turbopack (Beta)](/blog/next-13-4#turbopack-beta)
* [Server Actions (Alpha)](/blog/next-13-4#server-actions-alpha)
[Read More](/blog/next-13-4)
April 6th, 2023
![](/_next/image?url=%2Fstatic%2Fteam%2Fdelba.jpg&w=48&q=75)
![](/_next/image?url=%2Fstatic%2Fteam%2Ftim.jpg&w=48&q=75)
[Next.js 13.3](/blog/next-13-3)
Next.js 13.3 adds popular community-requested features and is the last release before the App Router is stable, including:
* [File-Based Metadata API](/blog/next-13-3#file-based-metadata-api)
* [Dynamic Open Graph Images](/blog/next-13-3#dynamic-open-graph-image-generation)
* [Static Export for App Router](/blog/next-13-3#static-export-for-app-router)
* [Parallel Routes and Interception](/blog/next-13-3#parallel-routes-and-interception)
[Read More](/blog/next-13-3)
February 23rd, 2023
![](/_next/image?url=%2Fstatic%2Fteam%2Fcasey.png&w=48&q=75)
![](/_next/image?url=%2Fstatic%2Fteam%2Fjimmy.jpg&w=48&q=75)
+1![](/_next/image?url=%2Fstatic%2Fteam%2Fluba.png&w=48&q=75)
[Next.js 13.2](/blog/next-13-2)
Next.js 13.2 includes major improvements to the App Router (`app`) in preparation for stability:
* [Built-in SEO Support](/blog/next-13-2#built-in-seo-support-with-new-metadata-api)
* [Route Handlers](/blog/next-13-2#custom-route-handlers)
* [MDX for Server Components](/blog/next-13-2#mdx-for-server-components)
* [Rust MDX Parser](/blog/next-13-2#rust-mdx-parser)
* [Improved Error Overlay](/blog/next-13-2#improved-error-overlay)
* [Statically Typed Links (Beta)](/blog/next-13-2#statically-typed-links)
* [Turbopack Improvements (Alpha)](/blog/next-13-2#turbopack-improvements)
* [Next.js Cache (Beta)](/blog/next-13-2#nextjs-cache)
[Read More](/blog/next-13-2)
December 22nd, 2022
![](/_next/image?url=%2Fstatic%2Fteam%2Foj.jpg&w=48&q=75)
![](/_next/image?url=%2Fstatic%2Fteam%2Ftim.jpg&w=48&q=75)
[Next.js 13.1](/blog/next-13-1)
Next.js 13.1 includes improvements to both the `pages` and `app` directories:
* [`app` Directory (Beta) Improvements](/blog/next-13-1#improved-stability-and-support-for-app-directory)
* [Built-in Module Transpilation](/blog/next-13-1#built-in-module-transpilation-stable)
* [Edge Runtime (Stable)](#a-light-nodejs-runtime-for-the-edge-now-stable-for-api-routes)
* [Turbopack Updates](/blog/next-13-1#turbopack-improvements)
* [Middleware Improvements](/blog/next-13-1#nextjs-advanced-middleware)
* [SWC Import Resolution](/blog/next-13-1#import-resolution-for-smaller-bundles)
[Read More](/blog/next-13-1)
October 25th, 2022
![](/_next/image?url=%2Fstatic%2Fteam%2Fbalazs.jpg&w=48&q=75)
![](/_next/image?url=%2Fstatic%2Fteam%2Fdelba.jpg&w=48&q=75)
+8![](/_next/image?url=%2Fstatic%2Fteam%2Fkdy.jpg&w=48&q=75)
[Next.js 13](/blog/next-13)
As we announced at [Next.js Conf](https://nextjs.org/conf), Next.js 13 (stable) lays the foundations to be dynamic without limits:
* [`app/` Directory (beta)](/blog/next-13#new-app-directory-beta)
* [Layouts](/blog/next-13#layouts)
* [React Server Components](/blog/next-13#server-components)
* [Streaming](/blog/next-13#streaming)
* [Turbopack (alpha)](/blog/next-13#introducing-turbopack-alpha)
* [New `next/image` (stable)](/blog/next-13#nextimage)
* [New `@next/font` (beta)](/blog/next-13#nextfont)
* [Improved `next/link`](/blog/next-13#breaking-changes)
[Read More](/blog/next-13)
September 8th, 2022
![](/_next/image?url=%2Fstatic%2Fteam%2Fbalazs.jpg&w=48&q=75)
![](/_next/image?url=%2Fstatic%2Fteam%2Fkdy.jpg&w=48&q=75)
+5![](/_next/image?url=%2Fstatic%2Fteam%2Fjiachi.png&w=48&q=75)
[Next.js 12.3](/blog/next-12-3)
We've shipped some quality-of-life improvements to Next.js with 12.3:
* [Improved Fast Refresh](/blog/next-12-3#improved-fast-refresh)
* [TypeScript Auto-Install](/blog/next-12-3#typescript-auto-install)
* [Image Component](/blog/next-12-3#image-component)
* [SWC Minifier](/blog/next-12-3##swc-minifier-stable)
* [New Router + Layouts Update](/blog/next-12-3#new-router-and-layouts-update)
[Read More](/blog/next-12-3)
June 28th, 2022
![](/_next/image?url=%2Fstatic%2Fteam%2Fbalazs.jpg&w=48&q=75)
![](/_next/image?url=%2Fstatic%2Fteam%2Fkdy.jpg&w=48&q=75)
+8![](/_next/image?url=%2Fstatic%2Fteam%2Fjavi.jpg&w=48&q=75)
[Next.js 12.2](/blog/next-12-2)
We're laying the foundation for the future of Next.js with 12.2:
* [Middleware (Stable)](/blog/next-12-2#middleware-stable)
* [On-Demand ISR (Stable)](/blog/next-12-2#on-demand-incremental-static-regeneration-stable)
* [Edge API Routes (Experimental)](/blog/next-12-2#edge-api-routes-experimental)
* [Edge SSR (Experimental)](/blog/next-12-2#edge-server-rendering-experimental)
* [SWC Plugins (Experimental)](/blog/next-12-2#swc-plugins-experimental)
* [Improvements to `next/image`](/blog/next-12-2#improvements-to-nextimage)
[Read More](/blog/next-12-2)
May 23rd, 2022
![](/_next/image?url=%2Fstatic%2Fteam%2Fdelba.jpg&w=48&q=75)
![](/_next/image?url=%2Fstatic%2Fteam%2Flee.jpg&w=48&q=75)
+1![](/_next/image?url=%2Fstatic%2Fteam%2Fseb.jpg&w=48&q=75)
[Layouts RFC](/blog/layouts-rfc)
This RFC outlines the biggest update to Next.js since it was introduced in 2016:
* **Nested Layouts:** Build complex applications with nested routes.
* **Designed for Server Components:** Optimized for subtree navigation.
* **Improved Data Fetching:** Fetch in layouts while avoiding waterfalls.
* **Using React 18 Features:** Streaming, Transitions, and Suspense.
* **Client and Server Routing:** Server-centric routing with _SPA-like_ behavior.
* **100% incrementally adoptable**: No breaking changes so you can adopt gradually.
* **Advanced Routing Conventions**: Offscreen stashing, instant transitions, and more.
[Read More](/blog/layouts-rfc)
February 17th, 2022
![](/_next/image?url=%2Fstatic%2Fteam%2Fbalazs.jpg&w=48&q=75)
![](/_next/image?url=%2Fstatic%2Fteam%2Fkdy.jpg&w=48&q=75)
+9![](/_next/image?url=%2Fstatic%2Fteam%2Fgerald.jpg&w=48&q=75)
[Next.js 12.1](/blog/next-12-1)
We're excited to release one of our most requested features with Next.js 12.1:
* [On-demand ISR (Beta)](/blog/next-12-1#on-demand-incremental-static-regeneration-beta)
* [Expanded Support for SWC](/blog/next-12-1#improved-swc-support)
* [`next/jest` Plugin](/blog/next-12-1#zero-configuration-jest-plugin)
* [Faster Minification with SWC (RC)](/blog/next-12-1#faster-minification-with-swc)
* [Self-Hosting Improvements](/blog/next-12-1#self-hosted-nextjs-improvements)
* [React 18 & Server Components (Alpha)](/blog/next-12-1#react-18-server-components-and-ssr-streaming-alpha)
* [Developer Survey](/blog/next-12-1#nextjs-developer-survey)
[Read More](/blog/next-12-1)
October 26th, 2021
![](/_next/image?url=%2Fstatic%2Fteam%2Fconnor.jpg&w=48&q=75)
![](/_next/image?url=%2Fstatic%2Fteam%2Fkdy.jpg&w=48&q=75)
+9![](/_next/image?url=%2Fstatic%2Fteam%2Fgerald.jpg&w=48&q=75)
[Next.js 12](/blog/next-12)
As we announced at [Next.js Conf](https://nextjs.org/conf), Next.js 12 is our biggest release ever:
* [Rust Compiler](/blog/next-12#faster-builds-and-fast-refresh-with-rust-compiler)
* [Middleware (beta)](/blog/next-12#introducing-middleware)
* [React 18 Support](/blog/next-12#preparing-for-react-18)
* [`<Image />` AVIF Support](/blog/next-12#smaller-images-using-avif)
* [Bot-aware ISR Fallback](/blog/next-12#bot-aware-isr-fallback)
* [Native ES Modules Support](/blog/next-12#es-modules-support-and-url-imports)
* [URL Imports (alpha)](/blog/next-12#url-imports)
* [React Server Components (alpha)](/blog/next-12#react-server-components)
[Read More](/blog/next-12)
August 11th, 2021
![](/_next/image?url=%2Fstatic%2Fteam%2Fkdy.jpg&w=48&q=75)
![](/_next/image?url=%2Fstatic%2Fteam%2Fjiachi.png&w=48&q=75)
+5![](/_next/image?url=%2Fstatic%2Fteam%2Fjj.jpg&w=48&q=75)
[Next.js 11.1](/blog/next-11-1)
We're improving build performance across the entire stack with Next.js 11.1, featuring:
* [Security Patch](/blog/next-11-1#security-patch)
* [ES Modules Support](/blog/next-11-1#es-modules-support)
* [Rust-based Tooling](/blog/next-11-1#adopting-rust-based-swc)
* [Faster Data Fetching](/blog/next-11-1#builds--data-fetching)
* [Faster Source Maps](/blog/next-11-1#source-maps)
* [ESLint Integration Improvements](/blog/next-11-1#eslint-improvements)
* [`next/image` Improvements](/blog/next-11-1#nextimage-improvements)
[Read More](/blog/next-11-1)
June 15th, 2021
![](/_next/image?url=%2Fstatic%2Fteam%2Fjj.jpg&w=48&q=75)
![](/_next/image?url=%2Fstatic%2Fteam%2Fshu.jpg&w=48&q=75)
+1![](/_next/image?url=%2Fstatic%2Fteam%2Ftim.jpg&w=48&q=75)
[Next.js 11](/blog/next-11)
Our mission to create the best developer experience continues with Next.js 11, featuring:
* [Conformance](/blog/next-11#conformance)
* [Improved Performance](/blog/next-11#improved-performance)
* [`next/script`](/blog/next-11#script-optimization)
* [`next/image` Improvements](/blog/next-11#image-improvements)
* [Webpack 5](/blog/next-11#webpack-5)
* [Create React App Migration (Experimental)](/blog/next-11#cra-migration)
* [Next.js Live (Preview Release)](/blog/next-11#nextjs-live-preview-release)
[Read More](/blog/next-11)
April 28th, 2021
![](/_next/image?url=%2Fstatic%2Fteam%2Fconnor.jpg&w=48&q=75)
![](/_next/image?url=%2Fstatic%2Fteam%2Fjj.jpg&w=48&q=75)
+2![](/_next/image?url=%2Fstatic%2Fteam%2Fshu.jpg&w=48&q=75)
[Next.js 10.2](/blog/next-10-2)
We are excited to introduce Next.js 10.2, featuring:
* [Faster Builds](/blog/next-10-2#webpack-5)
* [Faster Refresh](/blog/next-10-2#webpack-5)
* [Faster Startup](/blog/next-10-2#improved-startup-performance)
* [Improved Accessibility](/blog/next-10-2#accessibility-improvements)
* [More Flexible Redirects and Rewrites](/blog/next-10-2#routing-based-on-headers-and-query-string-parameters)
* [Automatic Webfont Optimization](/blog/next-10-2#automatic-webfont-optimization)
[Read More](/blog/next-10-2)
March 29th, 2021
![](/_next/image?url=%2Fstatic%2Fteam%2Fbel.png&w=48&q=75)
![](/_next/image?url=%2Fstatic%2Fteam%2Fjj.jpg&w=48&q=75)
+5![](/_next/image?url=%2Fstatic%2Fteam%2Ftimer.jpg&w=48&q=75)
[Next.js 10.1](/blog/next-10-1)
We are excited to introduce Next.js 10.1, featuring:
* [3x Faster Refresh](/blog/next-10-1#3x-faster-refresh)
* [Improved Installation Time](/blog/next-10-1#improved-installation-time)
* [`next/image` Improvements](/blog/next-10-1#nextimage-improvements)
* [Next.js Commerce Shopify Integration](/blog/next-10-1#nextjs-commerce-shopify-integration)
* [Custom 500 Page](/blog/next-10-1#custom-500-page)
* [Strict PostCSS Configuration Loading](/blog/next-10-1#strict-postcss-configuration-loading)
* [Support for `extends` in `tsconfig.json`](/blog/next-10-1#support-for-extends-in-tsconfigjson)
* [Detect When Preview Mode Is Enabled](/blog/next-10-1#detect-when-preview-mode-is-enabled)
* [Router Methods Scroll to Top](/blog/next-10-1#router-methods-scroll-to-top)
* [Documentation Improvements](/blog/next-10-1#documentation-improvements)
[Read More](/blog/next-10-1)
November 18th, 2020
![](/_next/image?url=%2Fstatic%2Fteam%2Flee.jpg&w=48&q=75)
[Incrementally Adopting Next.js](/blog/incremental-adoption)
[Next.js](https://nextjs.org/) has been designed for gradual adoption. With Next.js, you can continue using your existing code and add as much (or as little) React as you need. By starting small and incrementally adding more pages, you can prevent derailing feature work by avoiding a complete rewrite.
Many companies need to modernize their tech stack to reduce costs, increase developer productivity, and provide the best experience for their customers. Component-driven development has greatly improved the deployment velocity and reusability of modern codebases.
And with over [8 million downloads/month](https://www.npmtrends.com/react), React is the leading component-driven choice for developers. Next.js, the React framework for production, enables you to incrementally adopt React.
[Read More](/blog/incremental-adoption)
October 27th, 2020
![](/_next/image?url=%2Fstatic%2Fteam%2Fbel.png&w=48&q=75)
![](/_next/image?url=%2Fstatic%2Fteam%2Fconnor.jpg&w=48&q=75)
+5![](/_next/image?url=%2Fstatic%2Fteam%2Fjj.jpg&w=48&q=75)
[Next.js 10](/blog/next-10)
We are excited to introduce Next.js 10, featuring:
* [Built-in Image Component and Automatic Image Optimization](/blog/next-10#built-in-image-component-and-automatic-image-optimization)
* [Internationalized Routing](/blog/next-10#internationalized-routing)
* [Next.js Analytics](/blog/next-10#nextjs-analytics)
* [Next.js Commerce](/blog/next-10#nextjs-commerce)
* [React 17 Support](/blog/next-10#react-17-support)
* [getStaticProps / getServerSideProps Fast Refresh](/blog/next-10#getstaticprops--getserversideprops-fast-refresh)
* [Fast Refresh for MDX](/blog/next-10#fast-refresh-for-mdx)
* [Importing CSS from Third Party React Components](/blog/next-10#importing-css-from-third-party-react-components)
* [Automatic Resolving of href](/blog/next-10#automatic-resolving-of-href)
* [@next/codemod CLI](/blog/next-10#nextcodemod-cli)
* [Blocking Fallback for getStaticPaths](/blog/next-10#blocking-fallback-for-getstaticpaths)
[Read More](/blog/next-10)
July 27th, 2020
![](/_next/image?url=%2Fstatic%2Fteam%2Fconnor.jpg&w=48&q=75)
![](/_next/image?url=%2Fstatic%2Fteam%2Fjj.jpg&w=48&q=75)
+3![](/_next/image?url=%2Fstatic%2Fteam%2Ftimer.jpg&w=48&q=75)
[Next.js 9.5](/blog/next-9-5)
We are excited today to introduce Next.js 9.5, featuring:
* [Stable Incremental Static Regeneration](/blog/next-9-5#stable-incremental-static-regeneration)
* [Customizable Base Path](/blog/next-9-5#customizable-base-path)
* [Support for Rewrites, Redirects, and Headers](/blog/next-9-5#support-for-rewrites-redirects-and-headers)
* [Optional Trailing Slash in URLs](/blog/next-9-5#optional-trailing-slash-in-urls)
* [Persistent Caching for Page Bundles](/blog/next-9-5#persistent-caching-for-page-bundles)
* [Fast Refresh Enhancements](/blog/next-9-5#fast-refresh-enhancements)
* [Production React Profiling](/blog/next-9-5#production-react-profiling)
* [Optional Catch All Routes](/blog/next-9-5#optional-catch-all-routes)
* [Webpack 5 Support (beta)](/blog/next-9-5#webpack-5-support-beta)
[Read More](/blog/next-9-5)
May 11th, 2020
![](/_next/image?url=%2Fstatic%2Fteam%2Fjj.jpg&w=48&q=75)
![](/_next/image?url=%2Fstatic%2Fteam%2Ftimer.jpg&w=48&q=75)
+2![](/_next/image?url=%2Fstatic%2Fteam%2Flfades.jpg&w=48&q=75)
[Next.js 9.4](/blog/next-9-4)
We are excited today to introduce Next.js 9.4, featuring:
* [Fast Refresh](/blog/next-9-4#fast-refresh)
* [Incremental Static Regeneration (beta)](/blog/next-9-4#incremental-static-regeneration-beta)
* [CMS Examples](/blog/next-9-4#cms-examples)
* [New Environment Variables Support](/blog/next-9-4#new-environment-variables-support)
* [Improved Built-in Fetch Support](/blog/next-9-4#improved-built-in-fetch-support)
* [Integrated Web Vitals Reporting](/blog/next-9-4#integrated-web-vitals-reporting)
* [Absolute Imports and Aliases](/blog/next-9-4#absolute-imports-and-aliases)
* [Configurable Sass Support](/blog/next-9-4#configurable-sass-support)
* [Improved Log Output](/blog/next-9-4#improved-log-output)
[Read More](/blog/next-9-4)
March 9th, 2020
![](/_next/image?url=%2Fstatic%2Fteam%2Fjj.jpg&w=48&q=75)
![](/_next/image?url=%2Fstatic%2Fteam%2Ftimer.jpg&w=48&q=75)
+2![](/_next/image?url=%2Fstatic%2Fteam%2Flfades.jpg&w=48&q=75)
[Next.js 9.3](/blog/next-9-3)
We are excited today to introduce Next.js 9.3, featuring:
* [Next-gen Static Site Generation (SSG) Support](/blog/next-9-3#next-gen-static-site-generation-ssg-support)
* [Preview Mode](/blog/next-9-3#preview-mode)
* [Built-In Sass Support for Global Stylesheets](/blog/next-9-3#built-in-sass-support-for-global-stylesheets)
* [Built-In Sass CSS Module Support for Component-Level Styles](/blog/next-9-3#built-in-sass-css-module-support-for-component-level-styles)
* [Automatic Static Optimization for 404](/blog/next-9-3#automatic-static-optimization-for-404)
* [32 kB Smaller Runtime](/blog/next-9-3#32-kb-smaller-runtime-15-kb-gzip)
* [Next.js Community on GitHub Discussions](/blog/next-9-3#community)
[Read More](/blog/next-9-3)
January 15th, 2020
![](/_next/image?url=%2Fstatic%2Fteam%2Fjj.jpg&w=48&q=75)
![](/_next/image?url=%2Fstatic%2Fteam%2Ftimer.jpg&w=48&q=75)
+1![](/_next/image?url=%2Fstatic%2Fteam%2Flfades.jpg&w=48&q=75)
[Next.js 9.2](/blog/next-9-2)
We are excited today to introduce the production-ready Next.js 9.2, featuring:
* [Built-In CSS Support for Global Stylesheets](/blog/next-9-2#built-in-css-support-for-global-stylesheets)
* [Built-In CSS Module Support for Component-Level Styles](/blog/next-9-2#built-in-css-module-support-for-component-level-styles)
* [Improved Code-Splitting Strategy](/blog/next-9-2#improved-code-splitting-strategy)
* [Catch-All Dynamic Routes](/blog/next-9-2#catch-all-dynamic-routes)
[Read More](/blog/next-9-2)
January 9th, 2020
![](/_next/image?url=%2Fstatic%2Fteam%2Fjj.jpg&w=48&q=75)
![](/_next/image?url=%2Fstatic%2Fteam%2Ftimer.jpg&w=48&q=75)
+1![](/_next/image?url=%2Fstatic%2Fteam%2Flfades.jpg&w=48&q=75)
[New Next.js Documentation](/blog/new-documentation)
We're excited to announce the new Next.js documentation, featuring:
* [Improved Content](/blog/new-documentation#improved-content)
* [Search](/blog/new-documentation#search)
* [API Reference](/blog/new-documentation#api-reference)
[Read More](/blog/new-documentation)
January 6th, 2020
![](/_next/image?url=%2Fstatic%2Fteam%2Fjj.jpg&w=48&q=75)
![](/_next/image?url=%2Fstatic%2Fteam%2Ftimer.jpg&w=48&q=75)
+1![](/_next/image?url=%2Fstatic%2Fteam%2Flfades.jpg&w=48&q=75)
[Next.js 9.1.7](/blog/next-9-1-7)
[Next.js 9](/blog/next-9) was released six (6) months ago, followed by [Next.js 9.1](/blog/next-9-1) three (3) months ago. These two releases added very powerful new features to Next.js, without increasing our baseline client runtime size.
Since then, we've focused heavily on refining and improving the framework as a whole: [9.1.1](https://github.com/vercel/next.js/releases/tag/v9.1.1), [9.1.2](https://github.com/vercel/next.js/releases/tag/v9.1.2), [9.1.3](https://github.com/vercel/next.js/releases/tag/v9.1.3), [9.1.4](https://github.com/vercel/next.js/releases/tag/v9.1.4), [9.1.5](https://github.com/vercel/next.js/releases/tag/v9.1.5), [9.1.6](https://github.com/vercel/next.js/releases/tag/v9.1.6), and [9.1.7](https://github.com/vercel/next.js/releases/tag/v9.1.7).
Let's dive into what these releases have improved!
* [3% – 8%+ Smaller Client-Side JavaScript Size](/blog/next-9-1-7#3--8-smaller-client-side-javascript-size)
* [Redesigned Production Build CLI Output](/blog/next-9-1-7#redesigned-production-build-cli-output)
* [New Built-In Polyfills: fetch(), URL, and Object.assign](/blog/next-9-1-7#new-built-in-polyfills-fetch-url-and-objectassign)
* [Optimized Page Loading: Better FCP and TTI](/blog/next-9-1-7#optimized-page-loading-better-fcp-and-tti)
* [Support for the Latest JavaScript Features](/blog/next-9-1-7#support-for-the-latest-javascript-features)
* [Zero-Config Deployment Support for `next export` Applications](/blog/next-9-1-7#zero-config-deployment-support-for-next-export-applications)
* [React Strict Mode Compliance and Opt-In](/blog/next-9-1-7#react-strict-mode-compliance-and-opt-in)
* [Automated Testing against Nightly React Builds](/blog/next-9-1-7#automated-testing-against-nightly-react-builds)
[Read More](/blog/next-9-1-7)
October 9th, 2019
![](/_next/image?url=%2Fstatic%2Fteam%2Ftimer.jpg&w=48&q=75)
![](/_next/image?url=%2Fstatic%2Fteam%2Ftim.jpg&w=48&q=75)
[Introducing Create Next App](/blog/create-next-app)
We're delighted today to introduce the new Create Next App.
Create Next App sets up a modern React application powered by Next.js in one command.
[Read More](/blog/create-next-app)
October 7th, 2019
![](/_next/image?url=%2Fstatic%2Fteam%2Fjj.jpg&w=48&q=75)
![](/_next/image?url=%2Fstatic%2Fteam%2Ftimer.jpg&w=48&q=75)
+1![](/_next/image?url=%2Fstatic%2Fteam%2Flfades.jpg&w=48&q=75)
[Next.js 9.1](/blog/next-9-1)
Today, we are excited to announce Next.js 9.1 with `src` and `public` directory support.
**New in This Release**
* [`src` Directory Support](/blog/next-9-1#src-directory-support)
* [`public` Directory Support](/blog/next-9-1#public-directory-support)
**Previewing in This Release**
* [Built-in CSS Support](/blog/next-9-1#built-in-css-support)
* [Static Error Pages](/blog/next-9-1#static-error-pages)
* [Module / Nomodule](/blog/next-9-1#module--nomodule)
* [Improved Bundle Splitting](/blog/next-9-1#improved-bundle-splitting)
[Read More](/blog/next-9-1)
September 30th, 2019
![](/_next/image?url=%2Fstatic%2Fteam%2Fjj.jpg&w=48&q=75)
![](/_next/image?url=%2Fstatic%2Fteam%2Ftimer.jpg&w=48&q=75)
+2![](/_next/image?url=%2Fstatic%2Fteam%2Flfades.jpg&w=48&q=75)
[Next.js 9.0.7](/blog/next-9-0-7)
Next.js 9.0 was released approximately two months ago. Since then, we’ve been busy with 7 smaller but quite important releases: [9.0.1](https://github.com/vercel/next.js/releases/tag/v9.0.1), [9.0.2](https://github.com/vercel/next.js/releases/tag/v9.0.2), [9.0.3](https://github.com/vercel/next.js/releases/tag/v9.0.3), [9.0.4](https://github.com/vercel/next.js/releases/tag/v9.0.4), [9.0.5](https://github.com/vercel/next.js/releases/tag/v9.0.5), [9.0.6](https://github.com/vercel/next.js/releases/tag/v9.0.6), and [9.0.7](https://github.com/vercel/next.js/releases/tag/v9.0.7).
Let’s dive into what these releases have brought to your websites and applications, with absolutely no breaking changes.
* [Improved Concurrency in Windows Environments](/blog/next-9-0-7#improved-concurrency-in-windows-environments)
* [Gzip Compression by Default](/blog/next-9-0-7#gzip-compression-by-default)
* [TypeScript Report on Active Pages Only](/blog/next-9-0-7#typescript-report-on-active-pages-only)
* [Telemetry](/blog/next-9-0-7#telemetry)
* [Improved next/head Element Tracking](/blog/next-9-0-7#improved-nexthead-element-tracking)
* [Preventing Non-Pages in the Pages Directory](/blog/next-9-0-7#preventing-non-pages-in-the-pages-directory)
* [Runtime Improvements](/blog/next-9-0-7#runtime-improvements)
[Read More](/blog/next-9-0-7)
July 8th, 2019
![](/_next/image?url=%2Fstatic%2Fteam%2Fconnor.jpg&w=48&q=75)
![](/_next/image?url=%2Fstatic%2Fteam%2Fjj.jpg&w=48&q=75)
+3![](/_next/image?url=%2Fstatic%2Fteam%2Ftimer.jpg&w=48&q=75)
[Next.js 9](/blog/next-9)
Today, we're excited to announce Next.js 9 with TypeScript support, Dynamic Routing, API Routes, Automatic Static Optimization, and more!
* [Built-in Zero-Config TypeScript Support](/blog/next-9#built-in-zero-config-typescript-support)
* [File system-Based Dynamic Routing](/blog/next-9#dynamic-route-segments)
* [Automatic Static Optimization](/blog/next-9#automatic-static-optimization)
* [API Routes](/blog/next-9#api-routes)
* [More Production Optimizations](/blog/next-9#production-optimizations)
* [Improved DX](/blog/next-9#developer-experience-improvements)
[Read More](/blog/next-9)
April 16th, 2019
![](/_next/image?url=%2Fstatic%2Fteam%2Fconnor.jpg&w=48&q=75)
![](/_next/image?url=%2Fstatic%2Fteam%2Fjj.jpg&w=48&q=75)
+2![](/_next/image?url=%2Fstatic%2Fteam%2Ftimer.jpg&w=48&q=75)
[Next.js 8.1](/blog/next-8-1)
Today, we're excited to announce we've extended the Next.js experience to authoring AMP pages.
* [What is AMP](/blog/next-8-1#what-is-amp)
* [AMP in Next.js](/blog/next-8-1#amp-in-nextjs)
* [Hybrid AMP pages](/blog/next-8-1#hybrid-amp-pages)
* [AMP-first pages](/blog/next-8-1#amp-first-pages)
* [AMP Validation](/blog/next-8-1#amp-validation)
[Read More](/blog/next-8-1)
April 2nd, 2019
![](/_next/image?url=%2Fstatic%2Fteam%2Fconnor.jpg&w=48&q=75)
![](/_next/image?url=%2Fstatic%2Fteam%2Fjj.jpg&w=48&q=75)
+2![](/_next/image?url=%2Fstatic%2Fteam%2Ftimer.jpg&w=48&q=75)
[Next.js 8.0.4](/blog/next-8-0-4)
We are happy to introduce the production-ready Next.js 8.0.4:
* [Build performance improvements](/blog/next-8-0-4#build-performance)
* [Deterministic builds](/blog/next-8-0-4#build-performance)
* [Smaller client runtime](/blog/next-8-0-4#smaller-runtime-footprint)
* [Smaller serverless functions](/blog/next-8-0-4#smaller-runtime-footprint)
* [Default viewport tag](/blog/next-8-0-4#default-viewport-meta-tag)
* [Learning guide improvements](/blog/next-8-0-4#learning-guide-improvements)
[Read More](/blog/next-8-0-4)
March 28th, 2019
[Styling Next.js with Styled JSX](/blog/styling-next-with-styled-jsx)
[Styled JSX](https://github.com/vercel/styled-jsx) is a CSS-in-JS library that allows you to write encapsulated and scoped CSS to style your components. The styles you introduce for one component won't affect other components, allowing you to add, change and delete styles without worrying about unintended side effects.
[Read More](/blog/styling-next-with-styled-jsx)
February 19th, 2019
![](/_next/image?url=%2Fstatic%2Fteam%2Fconnor.jpg&w=48&q=75)
![](/_next/image?url=%2Fstatic%2Fteam%2Ftim.jpg&w=48&q=75)
[Next.js 8 Webpack Memory Improvements](/blog/webpack-memory)
Recently [Next.js 8](/blog/next-8) was introduced. The release included a massive build-time memory usage reduction. This blog post will explore how we have helped optimize webpack for the community.
[Read More](/blog/webpack-memory)
February 11th, 2019
![](/_next/image?url=%2Fstatic%2Fteam%2Fconnor.jpg&w=48&q=75)
![](/_next/image?url=%2Fstatic%2Fteam%2Fshu.jpg&w=48&q=75)
![](/_next/image?url=%2Fstatic%2Fteam%2Ftim.jpg&w=48&q=75)
[Next.js 8](/blog/next-8)
We are proud today to introduce the production-ready Next.js 8, featuring:
* [Serverless Next.js](/blog/next-8#serverless-nextjs)
* [Massive build-time memory usage reduction](/blog/next-8#massive-build-time-memory-usage-reduction)
* [Build-time environment configuration](/blog/next-8#build-time-environment-configuration)
* [Prefetch performance improvements](/blog/next-8#prefetch-performance-improvements)
* [Smaller initial HTML size](/blog/next-8#smaller-initial-html-size)
* [Improved on-demand entries](/blog/next-8#improved-on-demand-entries)
* [Faster port listening in development](/blog/next-8#faster-port-listening-in-development)
* [Faster Static Export](/blog/next-8#faster-static-export)
* [Head element deduplication](/blog/next-8#head-element-deduplication)
* [New crossOrigin config option](/blog/next-8#new-crossorigin-config-option)
* [Removed inline Javascript](/blog/next-8#removed-inline-javascript)
* [Example of API Authentication](/blog/next-8#example-of-api-authentication)
[Read More](/blog/next-8)
September 19th, 2018
![](/_next/image?url=%2Fstatic%2Fcollaborators%2Fgiuseppe.jpg&w=48&q=75)
![](/_next/image?url=%2Fstatic%2Fteam%2Fshu.jpg&w=48&q=75)
![](/_next/image?url=%2Fstatic%2Fteam%2Ftim.jpg&w=48&q=75)
[Next.js 7](/blog/next-7)
After 26 canary releases and 3.4 million downloads, we are proud to introduce the production-ready Next.js 7, featuring:
* [DX improvements](#dx-improvements): 57% faster bootup, 42% faster re-compilation
* [Better error reporting](#better-error-reporting-with-react-error-overlay) with [react-error-overlay](https://www.npmjs.com/package/react-error-overlay)
* [Upgraded compilation pipeline](#webpack-4): [Webpack 4](#webpack-4) and [Babel 7](#babel-7)
* [Standardized Dynamic Imports](#standardized-dynamic-imports)
* [Static CDN support](#static-cdn-support)
* [Smaller initial HTML payload](#smaller-initial-html-payload)
* [React Context with SSR between App and Pages](#react-context-with-ssr-between-app-and-pages)
[Read More](/blog/next-7)
June 27th, 2018
![](/_next/image?url=%2Fstatic%2Fteam%2Ftim.jpg&w=48&q=75)
[Next.js 6.1](/blog/next-6-1)
We are proud today to introduce the production-ready **Next.js 6.1**, featuring:
* Increased hot reloading reliability
* Codebase improvements
* Next.js codemods
[Read More](/blog/next-6-1)
May 16th, 2018
![](/_next/image?url=%2Fstatic%2Fteam%2Farunoda.jpg&w=48&q=75)
![](/_next/image?url=%2Fstatic%2Fteam%2Ftim.jpg&w=48&q=75)
[Next.js 6 and Nextjs.org](/blog/next-6)
We are proud today to introduce the production-ready **Next.js 6**, featuring:
* Zero-configuration static exports. No need for `next.config.js` by default
* `_app.js`, an extension point that enables page transitions, error boundaries and more
* Babel 7 and Fragment syntax `<>` support
* Extended integration test suites with a strong focus on security
* Flow annotations in the core codebase
[Read More](/blog/next-6)
March 26th, 2018
![](/_next/image?url=%2Fstatic%2Fteam%2Farunoda.jpg&w=48&q=75)
![](/_next/image?url=%2Fstatic%2Fteam%2Ftim.jpg&w=48&q=75)
[Next.js 5.1: Faster Page Resolution, Environment Config & More](/blog/next-5-1)
We are happy to introduce Next.js 5.1, which features support for environment configuration, phases, source maps, and new Next.js plugins.
[Read More](/blog/next-5-1)
February 5th, 2018
![](/_next/image?url=%2Fstatic%2Fteam%2Farunoda.jpg&w=48&q=75)
![](/_next/image?url=%2Fstatic%2Fteam%2Ftim.jpg&w=48&q=75)
[Next.js 5: Universal Webpack, CSS Imports, Plugins and Zones](/blog/next-5)
We are very happy to introduce Next.js 5.0 to the world. It’s available on npm effective immediately.
[Read More](/blog/next-5) |
{
"contentLength": null,
"etag": "W/\"34011cc946c279e968cc22fa4dbe22e4\"",
"lastModifiedHeader": null,
"lastModifiedHtml": null
} | https://nextjs.org/ | ran **May 23**. Check out the announcements.
Vercel Ship
24
[Watch the Keynote](https://vercel.com/ship?utm_source=next_site&utm_medium=web&utm_campaign=vercel_ship&utm_content=next_site_home)
Vercel Ship
24
ran **May 23**. Check out the announcements.
[Watch the Keynote](https://vercel.com/ship?utm_source=next_site&utm_medium=web&utm_campaign=vercel_ship&utm_content=next_site_home)
![Next.js uwu logo by SAWARATSUKI](/_next/image?url=https%3A%2F%2Fassets.vercel.com%2Fimage%2Fupload%2Fv1714730590%2Ffront%2Fnextjs%2Fuwu%2Fnext-uwu-logo.png&w=1080&q=75)
The React Framework for the Web
===============================
Used by some of the world's largest companies, Next.js enables you to create **high-quality web applications** with the power of React components.
[Get Started](/docs)[Learn Next.js](/learn?utm_source=next-site&utm_medium=homepage-cta&utm_campaign=home)
▲ ~ npx create-next-app@latest
What's in Next.js?
------------------
Everything you need to build great products on the web.
[
Original
1440px
375px
Built-in Optimizations
Automatic Image, Font, and Script Optimizations for improved UX and Core Web Vitals.
](/docs/app/building-your-application/optimizing/images)[
Data Fetching
Make your React component async and await your data. Next.js supports both server and client data fetching.
](/docs/app/building-your-application/data-fetching)[
Server Actions
Run server code by calling a function. Skip the API. Then, easily revalidate cached data and update your UI in one network roundtrip.
](/docs/app/building-your-application/data-fetching/forms-and-mutations)[
Advanced Routing & Nested Layouts
Create routes using the file system, including support for more advanced routing patterns and UI layouts.
](/docs/app/building-your-application/routing)
[
Dynamic HTML Streaming
Instantly stream UI from the server, integrated with the App Router and React Suspense.
](/docs/app/building-your-application/routing/loading-ui-and-streaming)[
CSS Support
Style your application with your favorite tools, including support for CSS Modules, Tailwind CSS, and popular community libraries.
](/docs/app/building-your-application/styling)[
Route Handlers
Build API endpoints to securely connect with third-party services for handling auth or listening for webhooks.
](/docs/app/building-your-application/routing/router-handlers)[
Middleware
Take control of the incoming request. Use code to define routing and access rules for authentication, experimentation, and internationalization.
](/docs/app/building-your-application/routing/middleware)
[
![A tree structure of 3D spheres are connected by lines](/_next/image?url=https%3A%2F%2Fassets.vercel.com%2Fimage%2Fupload%2Ffront%2Fnextjs%2Fspheres-light.png&w=640&q=100)![A tree structure of 3D spheres are connected by lines](/_next/image?url=https%3A%2F%2Fassets.vercel.com%2Fimage%2Fupload%2Ffront%2Fnextjs%2Fspheres-dark.png&w=640&q=100)
React Server Components
Add components without sending additional client-side JavaScript. Built on the latest React features.
](/docs/getting-started/react-essentials)[
Client and Server Rendering
Flexible rendering and caching options, including Incremental Static Regeneration (ISR), on a per-page level.
](/docs/app/building-your-application/rendering)[
Next.js 14
The power of full-stack to the frontend. Read the release notes.
](/blog/next-14)
[
![Three abstract images are resized at three different sizes and stacked on top of each other](/_next/image?url=https%3A%2F%2Fassets.vercel.com%2Fimage%2Fupload%2Ffront%2Fnextjs%2Fwindows-light.png&w=640&q=100)![Three abstract images are resized at three different sizes and stacked on top of each other](/_next/image?url=https%3A%2F%2Fassets.vercel.com%2Fimage%2Fupload%2Ffront%2Fnextjs%2Fwindows-dark.png&w=640&q=100)
Built-in Optimizations
Automatic Image, Font, and Script Optimizations for improved UX and Core Web Vitals.
](/docs/app/building-your-application/optimizing/images)[
![A tree structure of 3D spheres are connected by lines](/_next/image?url=https%3A%2F%2Fassets.vercel.com%2Fimage%2Fupload%2Ffront%2Fnextjs%2Fspheres-light.png&w=640&q=100)![A tree structure of 3D spheres are connected by lines](/_next/image?url=https%3A%2F%2Fassets.vercel.com%2Fimage%2Fupload%2Ffront%2Fnextjs%2Fspheres-dark.png&w=640&q=100)
React Server Components
Add components without sending additional client-side JavaScript. Built on the latest React features.
](/docs/getting-started/react-essentials)[
Data Fetching
Make your React component async and await your data. Next.js supports both server and client data fetching.
](/docs/app/building-your-application/data-fetching)[
Server Actions
Run server code by calling a function. Skip the API. Then, easily revalidate cached data and update your UI in one network roundtrip.
](/docs/app/building-your-application/data-fetching/forms-and-mutations)[
Advanced Routing & Nested Layouts
Create routes using the file system, including support for more advanced routing patterns and UI layouts.
](/docs/app/building-your-application/routing)
[
Dynamic HTML Streaming
Instantly stream UI from the server, integrated with the App Router and React Suspense.
](/docs/app/building-your-application/routing/loading-ui-and-streaming)[
CSS Support
Style your application with your favorite tools, including support for CSS Modules, Tailwind CSS, and popular community libraries.
](/docs/app/building-your-application/styling)[
Route Handlers
Build API endpoints to securely connect with third-party services for handling auth or listening for webhooks.
](/docs/app/building-your-application/routing/router-handlers)[
Middleware
Take control of the incoming request. Use code to define routing and access rules for authentication, experimentation, and internationalization.
](/docs/app/building-your-application/routing/middleware)[
Client and Server Rendering
Flexible rendering and caching options, including Incremental Static Regeneration (ISR), on a per-page level.
](/docs/app/building-your-application/rendering)[
Next.js 14
The power of full-stack to the frontend. Read the release notes.
](/blog/next-14)
[
![Three abstract images are resized at three different sizes and stacked on top of each other](/_next/image?url=https%3A%2F%2Fassets.vercel.com%2Fimage%2Fupload%2Ffront%2Fnextjs%2Fwindows-light.png&w=640&q=100)![Three abstract images are resized at three different sizes and stacked on top of each other](/_next/image?url=https%3A%2F%2Fassets.vercel.com%2Fimage%2Fupload%2Ffront%2Fnextjs%2Fwindows-dark.png&w=640&q=100)
Built-in Optimizations
Automatic Image, Font, and Script Optimizations for improved UX and Core Web Vitals.
](/docs/app/building-your-application/optimizing/images)[
Dynamic HTML Streaming
Instantly stream UI from the server, integrated with the App Router and React Suspense.
](/docs/app/building-your-application/routing/loading-ui-and-streaming)[
![A tree structure of 3D spheres are connected by lines](/_next/image?url=https%3A%2F%2Fassets.vercel.com%2Fimage%2Fupload%2Ffront%2Fnextjs%2Fspheres-light.png&w=640&q=100)![A tree structure of 3D spheres are connected by lines](/_next/image?url=https%3A%2F%2Fassets.vercel.com%2Fimage%2Fupload%2Ffront%2Fnextjs%2Fspheres-dark.png&w=640&q=100)
React Server Components
Add components without sending additional client-side JavaScript. Built on the latest React features.
](/docs/getting-started/react-essentials)
[
Data Fetching
Make your React component async and await your data. Next.js supports both server and client data fetching.
](/docs/app/building-your-application/data-fetching)[
Server Actions
Run server code by calling a function. Skip the API. Then, easily revalidate cached data and update your UI in one network roundtrip.
](/docs/app/building-your-application/data-fetching/forms-and-mutations)[
Advanced Routing & Nested Layouts
Create routes using the file system, including support for more advanced routing patterns and UI layouts.
](/docs/app/building-your-application/routing)[
CSS Support
Style your application with your favorite tools, including support for CSS Modules, Tailwind CSS, and popular community libraries.
](/docs/app/building-your-application/styling)[
Route Handlers
Build API endpoints to securely connect with third-party services for handling auth or listening for webhooks.
](/docs/app/building-your-application/routing/router-handlers)[
Middleware
Take control of the incoming request. Use code to define routing and access rules for authentication, experimentation, and internationalization.
](/docs/app/building-your-application/routing/middleware)[
Client and Server Rendering
Flexible rendering and caching options, including Incremental Static Regeneration (ISR), on a per-page level.
](/docs/app/building-your-application/rendering)
[
Next.js 14
The power of full-stack to the frontend. Read the release notes.
](/blog/next-14)
Built on a foundation of fast, production-grade tooling
-------------------------------------------------------
![](/icons/mobile-lines.svg)
Powered By
[
![React Logo](/icons/react.svg)
ReactThe library for web and native user interfaces. Next.js is built on the latest React features, including Server Components and Actions.
](https://react.dev)[
![Turbopack Logo](/icons/turbopack.svg)
TurbopackAn incremental bundler optimized for JavaScript and TypeScript, written in Rust ![Rust Logo](/icons/rust.svg), and built into Next.js.
](https://turbo.build)[
![SWC Logo](/icons/swc.svg)
Speedy Web CompilerAn extensible Rust ![Rust Logo](/icons/rust.svg) based platform for the next generation of fast developer tools, and can be used for both compilation and minification.
](https://swc.rs)
Get started in seconds
----------------------
Deploy Next.js to Vercel
StarterEcommerceBlogAIEdge FunctionsEdge ConfigPortfolioSaaSMulti-tenant AppsRealtime AppsDocumentationVirtual EventWeb3
Vercel is a frontend cloud from the creators of Next.js, making it easy to get started with Next.js quickly.
Jumpstart your Next.js development with pre-built solutions from Vercel and our community.
[Deploy a Template on Vercel](https://vercel.com/templates/next.js?utm_source=next-site&utm_medium=deploy-template-on-vercel-cta&utm_campaign=homepage-new)
![A Next.js app and a Serverless Function API.](/_next/image?url=https%3A%2F%2Fassets.vercel.com%2Fimage%2Fupload%2Fv1677122002%2Fnextjs%2Fshowcase%2Ftemplate-next-boilerplate.jpg&w=3840&q=75)
Next.js Boilerplate
A Next.js app and a Serverless Function API.
![An image gallery built on Next.js and Cloudinary.](/_next/image?url=https%3A%2F%2Fassets.vercel.com%2Fimage%2Fupload%2Fv1677122387%2Fnextjs%2Fshowcase%2Ftemplate-next-gallery.jpg&w=3840&q=75)
Image Gallery Starter
An image gallery built on Next.js and Cloudinary.
![An all-in-one starter kit for high-performance ecommerce sites.](/_next/image?url=https%3A%2F%2Fassets.vercel.com%2Fimage%2Fupload%2Fv1677122003%2Fnextjs%2Fshowcase%2Ftemplate-next-commerce.jpg&w=3840&q=75)
Next.js Commerce
An all-in-one starter kit for high-performance ecommerce sites.
![](/icons/divider.svg)![](/icons/divider-mobile.svg)
The framework of choice when it matters
---------------------------------------
[![Screenshot of Audible's website](/_next/image?url=%2F_next%2Fstatic%2Fmedia%2Fpreview-audible.6063405a.png&w=828&q=75)
Audible
* * *
](/showcase)[![Screenshot of Sonos's website](/_next/image?url=%2F_next%2Fstatic%2Fmedia%2Fpreview-sonos.a3dbc334.png&w=828&q=75)
Sonos
* * *
](/showcase)
[![Screenshot of Twitch's website](/_next/image?url=%2F_next%2Fstatic%2Fmedia%2Fpreview-twitch.4ed9ddb3.png&w=640&q=75)
Twitch
* * *
](/showcase)
[![Screenshot of Notion's website](/_next/image?url=%2F_next%2Fstatic%2Fmedia%2Fpreview-notion.2bd1f0c5.png&w=828&q=75)
Notion
* * *
](/showcase)
[![Screenshot of Today's website](/_next/image?url=%2F_next%2Fstatic%2Fmedia%2Fpreview-today.98d66e07.png&w=640&q=75)
Today
* * *
](/showcase)[![Screenshot of ProductHunt's website](/_next/image?url=%2F_next%2Fstatic%2Fmedia%2Fpreview-ph.c43e26c6.png&w=640&q=75)
ProductHunt
* * *
](/showcase)
[![Screenshot of Nike's website](/_next/image?url=%2F_next%2Fstatic%2Fmedia%2Fpreview-nike.ae99d521.png&w=828&q=75)
Nike
* * *
](/showcase)[![Screenshot of Washington Post's website](/_next/image?url=%2F_next%2Fstatic%2Fmedia%2Fpreview-wapo.2769ff64.png&w=828&q=75)
Washington Post
* * *
](/showcase)
[![Screenshot of Sonos's website](/_next/image?url=%2F_next%2Fstatic%2Fmedia%2Fpreview-sonos.a3dbc334.png&w=640&q=75)
Sonos
* * *
](/showcase)[![Screenshot of Audible's website](/_next/image?url=%2F_next%2Fstatic%2Fmedia%2Fpreview-audible.6063405a.png&w=640&q=75)
Audible
* * *
](/showcase)[![Screenshot of Nike's website](/_next/image?url=%2F_next%2Fstatic%2Fmedia%2Fpreview-nike.ae99d521.png&w=640&q=75)
Nike
* * *
](/showcase)
[![Screenshot of Notion's website](/_next/image?url=%2F_next%2Fstatic%2Fmedia%2Fpreview-notion.2bd1f0c5.png&w=640&q=75)
Notion
* * *
](/showcase)[![Screenshot of ProductHunt's website](/_next/image?url=%2F_next%2Fstatic%2Fmedia%2Fpreview-ph.c43e26c6.png&w=640&q=75)
ProductHunt
* * *
](/showcase)[![Screenshot of Washington Post's website](/_next/image?url=%2F_next%2Fstatic%2Fmedia%2Fpreview-wapo.2769ff64.png&w=640&q=75)
Washington Post
* * *
](/showcase)
For **performance**, **efficiency** and **developer experience**. Next.js is trusted by some of the biggest names on the web.
[View the Next.js Showcase](/showcase)
Customer Testimonials
---------------------
> ### “With Next.js at the helm of our headless tech stack, our developers can create features with velocity and speed, ultimately enabling users to create whatever, whenever they want to.”
Tatiana Mac, Senior Software Engineer
> ### “My favorite UX feedback from customers is: "How is the app so fast?" Because we’ve built on Next.js and Vercel since day one, our pages load in an instant, which is important when it comes to mission-critical software.”
Fouad Matin, CEO
> ### “Next.js has been a game-changer for our agency work and team collaboration. Its powerful features have allowed us to build high-performance websites quickly and efficiently like never before.”
Daniel Lopes, Frontend Developer |
{"contentLength":null,"etag":"W/\"6cf2944589e9b377be2ef0f9101c0e9c\"","lastModifiedHeader":null,"las(...TRUNCATED) | https://nextjs.org/docs/app/api-reference/functions | "Menu\n\nUsing App Router\n\nFeatures available in /app\n\n* [Getting Started](/docs/getting-start(...TRUNCATED) |
{"contentLength":null,"etag":"W/\"34011cc946c279e968cc22fa4dbe22e4\"","lastModifiedHeader":null,"las(...TRUNCATED) | https://nextjs.org/?uwu=true | "ran **May 23**. Check out the announcements.\n\nVercel Ship\n\n24\n\n[Watch the Keynote](https://ve(...TRUNCATED) |
{"contentLength":null,"etag":"W/\"769d3ce6f9693fb26a2cb6f889ffc5d7\"","lastModifiedHeader":null,"las(...TRUNCATED) | https://nextjs.org/docs/app/building-your-application/data-fetching/fetching-caching-and-revalidating | "Menu\n\nUsing App Router\n\nFeatures available in /app\n\n* [Getting Started](/docs/getting-start(...TRUNCATED) |
End of preview. Expand
in Dataset Viewer.
urls included in this dataset: https://nextjs.org/docs/
- Downloads last month
- 34