Next.js Comparison

Side-by-side feature mapping for developers migrating from Next.js App Router to Astro 6.

Architecture

AspectNext.jsAstro
Mental modelFull-stack React appContent site with islands
Default JS shippedReact runtime on every pageZero JS (opt-in per component)
Component modelReact everywhere.astro (server-only) + framework islands
Rendering defaultServer Components (on-demand)Static (prerendered)
BundlerTurbopack/WebpackVite
Framework lock-inReactUI-agnostic (React, Svelte, Vue, Solid, none)

Routing

FeatureNext.jsAstro
File locationapp/src/pages/
Page filepage.tsx in directoryfilename.astro directly
Dynamic route[slug]/page.tsx[slug].astro
Catch-all[...slug]/page.tsx[...slug].astro
Route groups(group)/page.tsxNot built-in (use directories)
Parallel routes@slot/page.tsxNot applicable
Intercepting routes(.)/page.tsxNot applicable
Nested layoutslayout.tsx (automatic nesting)Manual layout wrapping
Loading statesloading.tsxNot applicable (no React tree)
Error boundarieserror.tsxTry/catch in frontmatter
API routesroute.ts.ts files exporting HTTP methods

Data Fetching

PatternNext.jsAstro
Server datafetch() in server componentfetch() in frontmatter (top-level await)
Static paramsgenerateStaticParams()getStaticPaths()
Client data"use client" + useEffect/SWR/React QueryClient island with any fetching library
Form mutationsServer Actions ("use server")Endpoints or form handlers
Request contextheaders(), cookies()Astro.request, Astro.cookies

Rendering and Caching

FeatureNext.jsAstro
Static generationDefault (no dynamic APIs)Default (output: 'static')
On-demand renderingDynamic APIs trigger itexport const prerender = false
ISRrevalidate exportCDN Cache-Control headers
Tag invalidationrevalidateTag()Experimental route caching or CDN API
Path invalidationrevalidatePath()CDN purge or rebuild
StreamingReact SuspenseNot applicable
PPRPartial prerenderingServer islands (different mechanism, similar goal)

Metadata and SEO

FeatureNext.jsAstro
Page titlemetadata.title or generateMetadata()<title> in HTML template
Meta tagsmetadata object<meta> tags in HTML
Open Graphmetadata.openGraph<meta property="og:*"> tags
Structured dataJSON-LD in componentJSON-LD in <script type="application/ld+json">
Canonical URLmetadata.alternates.canonical<link rel="canonical">
SitemapThird-party or manual@astrojs/sitemap integration

Astro’s approach is more verbose but completely transparent. You write the actual HTML that goes in <head>.

Styling

FeatureNext.jsAstro
CSS ModulesSupportedSupported
Scoped stylesCSS Modules<style> tag (scoped by default)
Global stylesglobal.css import<style is:global> or CSS import
TailwindPlugin@astrojs/tailwind integration or Vite plugin
CSS-in-JSSupported (with caveats in RSC)Limited (prefer scoped styles or Tailwind)

Framework Features

FeatureNext.jsAstro
Image optimizationnext/image (runtime)<Image /> from astro:assets (build-time)
Font optimizationnext/fontFonts API in astro.config.mjs
Script loadingnext/script<script> (Vite-bundled)
Link prefetching<Link> (automatic)Configurable prefetch strategies
MiddlewareEdge runtime (limited APIs)Full Node.js runtime
i18nBuilt-in routingBuilt-in i18n routing
View transitionsNot built-inBuilt-in with <ViewTransitions />
Content managementManualContent collections with schema validation

Deployment

PlatformNext.jsAstro
VercelOptimized (first-party)Supported via adapter
CloudflareCommunity adapterOfficial adapter
Node.js/DockerStandalone buildOfficial Node adapter
NetlifySupportedOfficial adapter
Static hostingoutput: 'export'Default mode
DenoCommunityCommunity adapter

When Next.js is still better

  • Highly interactive apps where most pages need client-side React
  • Apps heavily invested in React Server Components streaming
  • Teams that want a single React mental model everywhere
  • Apps using Vercel-specific features (Edge Config, KV, etc.)

When Astro is better

  • Content-heavy sites (news, blogs, docs, marketing, portfolios)
  • Sites where SEO and metadata correctness are critical
  • Sites with isolated interactivity (islands, not app shells)
  • Teams that want simpler, more transparent rendering behavior
  • Multi-framework teams or teams moving away from React-only