SitecoreAI logo and a glowing N.js cube on a dark, futuristic background with light trails.
Back to home

SitecoreAI Content SDK v1.3.1: App Router is now GA! - Time to Make the Move

Miguel Minoldo's picture
Miguel Minoldo

SitecoreAI Content SDK v1.3.1 has just landed, and the App Router support has officially moved from Beta to General Availability. This isn't just another incremental update, it's the green light we've been waiting for to align with the future of Next.js development within the Sitecore ecosystem.

If you've been following the evolution of the Content SDK, you'll know that version 1.2 introduced App Router support in beta back in October 2024. Now, with v1.3.1, it's production-ready, stable, and recommended for all new projects.

Let's dive into what this means and why App Router should be your default choice moving forward.

What's New in Content SDK v1.3.1?

The release brings some critical updates that solidify the Content SDK as a mature, production-grade tool:

  • App Router moves to GA: The App Router is now stable and fully supported, providing a solid foundation for building modern SitecoreAI (formerly XM Cloud) applications.
  • Critical security fixes: Version 1.3.0 has been deprecated due to a vulnerability in React Server Components, which is fully resolved in v1.3.1.
  • Performance and stability improvements: Enhanced developer experience across the board.

If you're still on v1.3.0, it's time to upgrade immediately. The security patch alone makes this update mandatory, for details check here.

Understanding Next.js App Router: The Foundation

Before we talk about why this matters for SitecoreAI, let's take a step back and understand what the App Router is and why the Next.js team built it.

The Shift from Pages Router

For years, Next.js relied on the Pages Router, a file-system based approach where every file in the pages directory became a route. It was simple, battle-tested, and got the job done. But as applications grew more complex and React evolved with new capabilities, the limitations became apparent:

  • Global layouts: Layouts were applied to all pages, making nested or route-specific layouts difficult.
  • Limited SSR flexibility: Server-side rendering was powerful but not granular enough.
  • Client-heavy by default: Most components ran on the client, shipping unnecessary JavaScript.

What is App Router?

Introduced in Next.js 13, the App Router is a complete reimagining of how routing works in Next.js. Built on top of React Server Components, Suspense, and other modern React features, it addresses the core limitations of the Pages Router while unlocking powerful new capabilities. For more details check the official Next.js documentation.

Here's what makes it different:

1. React Server Components (RSC) by Default

Components in the App Router are Server Components by default. This means they run exclusively on the server and never ship to the client unless explicitly marked with use client. The benefits are immediate: smaller JavaScript bundles, faster load times, and improved performance.

Server Components allow you to:

  • Keep heavy dependencies server-side.
  • Fetch data directly in components without the need for separate data-fetching methods.
  • Reduce client-side JavaScript dramatically, especially for content-heavy pages.
  • Data fetching happens at render time and integrates with Next.js caching automatically.

2. Nested Layouts

One of the most requested features is finally here. With the App Router, you can create nested layouts that wrap specific routes, sharing UI while preserving state and avoiding expensive re-renders.

For example, you might have:

  • A root layout that provides global navigation
  • A site-specific layout that handles site-level configuration
  • A section layout for blogs or products

Layouts can render independently using Suspense, reducing waterfalls and improving performance.

3. Built-in Loading and Error States

The App Router introduces first-class support for loading states (through loading.js) and error boundaries (through error.js). These leverage React Suspense to enable streaming, where parts of your page can load independently without blocking the entire render.

This is huge for user experience. Instead of staring at a blank screen, users see content progressively as it becomes available.

4. Improved Data Fetching

Data fetching in the App Router is cleaner and more intuitive. Instead of getServerSideProps or getStaticProps, you can use async/await directly in your Server Components:

javascript
1export default async function ProductPage({ params }) {
2 const product = await fetchProduct(params.id);
3 return <ProductDetails product={product} />;
4}

It's straightforward, readable, and powerful.

5. Granular Caching Control

The App Router gives you fine-grained control over caching at the route and component level. You can specify revalidation intervals, opt into static or dynamic rendering per route, and leverage Next.js's caching mechanisms to optimize performance.

Why Should You Migrate?

The Next.js team isn't just recommending the App Router, they're making it clear: this is the future. The Pages Router isn't going away tomorrow, but it's no longer the focus of active development. New features, optimizations, and innovations are all happening in the App Router.

Here's why you should consider migrating or starting with App Router:

  • Performance: Smaller JavaScript bundles, faster page loads, and better Core Web Vitals.
  • Developer experience: Cleaner code, better separation of concerns, and modern patterns.
  • Scalability: As your application grows, the App Router's architecture scales with you.
  • Future-proof: Stay aligned with the direction of both React and Next.js.

App Router in the Context of SitecoreAI

Now let's bring this back to SitecoreAI and the Content SDK.

The Content SDK is purpose-built for SitecoreAI (formerly XM Cloud) and represents Sitecore's commitment to modern, headless architectures. It's lighter, faster, and more aligned with contemporary development practices than the legacy JSS SDK. With App Router now in GA, the Content SDK takes another step forward.

What App Router Brings to SitecoreAI

1. Better Performance for Content-Heavy Sites

Sitecore applications often deal with rich, dynamic content. With Server Components, you can fetch content on the server, render it into HTML, and send it to the client without the hydration overhead of traditional React apps.

This is particularly impactful for marketing sites, blogs, and product catalogs, where much of the content is static or semi-static. By keeping this content as Server Components, you drastically reduce the JavaScript shipped to browsers.

2. Cleaner Component Architecture

The Content SDK's App Router support includes proper handling of the use client directive, ensuring that your components are correctly classified as Server or Client Components. This gives you precise control over where code runs and prevents accidental hydration of server-only components.

For example, your editorial components can remain as Server Components, while interactive elements like forms or dynamic widgets can be Client Components. The architecture is clear, intentional, and efficient.

3. Improved Visual Editing Experience

Sitecore's visual editing tools, like Pages and the Design Library, benefit from the App Router's architecture. The Content SDK includes optimized middleware for editing scenarios, performing internal server-side requests to return HTML directly. This reduces overhead and speeds up the editing experience for marketers.

4. First-Class Support for Internationalization

The Content SDK's App Router implementation includes full i18n support with the next-intl package. Managing localized content across multiple sites and languages is seamless, with routing, data fetching, and rendering all handled elegantly.

Should You Migrate Existing Projects?

If you're running a Pages Router project on the Content SDK, the question is: should you migrate?

The answer depends on your situation:

  • New projects: Absolutely start with App Router. It's stable, supported, and the recommended path forward.
  • Existing projects: Evaluate the complexity of your application. If it's running smoothly and you don't need the new features, there's no urgent need to migrate. However, if you're planning significant updates or want to leverage Server Components, now is a great time.

You might want to take a Content SDK incremental migration by moving one route at a time, testing and validating as you go. If something doesn't work, you can roll back that specific route without impacting the rest of your application.

Check the official upgrade guides here:

Practical Considerations for Migration

If you decide to migrate, here are some key points to keep in mind:

1. Understand Server vs. Client Components

The biggest shift is understanding when to use Server Components vs. Client Components. Server Components are great for static content, data fetching, and anything that doesn't require interactivity. Client Components are for forms, event handlers, state management, and anything that needs browser APIs.

A common mistake is marking components with use client too early in the component tree. This removes the benefits of Server Components. Instead, push the client boundary as far down as possible.

2. Update Data Fetching Patterns

If your components use getComponentServerProps, you'll need to refactor them. For Server Components, you can fetch data directly in the component using async/await. For Client Components, you'll fetch data client-side or pass it down from a parent Server Component.

3. Migrate API routes

If you don’t have any custom routes or modifications to the out-of-the-box Content SDK API routes located under pages/api, copy the /src/app/api folder and all the files under it from the sample App Router application into your existing application.

4. Replace Placeholder with AppPlaceholder

Throughout your app, you must replace all instances of Placeholder with AppPlaceholder. This new component dynamically handles both Server and Client Component rendering based on context. For example, in your Layout.tsx:

1{route && (
2 <AppPlaceholder
3 page={page}
4 componentMap={componentMap}
5 name="headless-header"
6 rendering={route}
7 />
8)}

5. Consolidate Providers

Replace the old ComponentPropsContext and SitecoreProvider setup with the new unified Providers.tsx file. This simplifies context management across your app.

6. Replace Localization Libraries

The Pages Router uses next-localization, while the App Router uses next-intl. You'll need to swap these out and update your localization setup accordingly. The Content SDK provides sample code to guide you.

For a more detailed migration path, refer to the official Content SDK documentation.

The Future of SitecoreAI Development

With App Router now in GA, the Content SDK is ready for rapid evolution. Sitecore has hinted at upcoming features like Partial Prerendering (PPR), tag-based cache invalidation, and deeper integrations with emerging React capabilities.

The message is clear: the Content SDK is the foundation of SitecoreAI's enabled digital experience stack. If you're building on SitecoreAI or planning to migrate, now is the time to embrace it.

Final Thoughts

The move to GA for App Router in the Content SDK v1.3.1 is a milestone to celebrate. It represents stability, maturity, and confidence in a modern development approach that prioritizes performance, scalability, and developer experience.

Kudos to Liz Nelson and team for all the efforts on improving the SitecoreAI's developers experience!

For new projects, the choice is simple: start with App Router.

For existing projects, evaluate your needs and consider the benefits. Either way, the tools, documentation, and community support are there to guide you.

The future of Next.js is the App Router. The future of Sitecore development is the Content SDK. Bring them together to have a powerful, flexible, and scalable foundation for building exceptional digital experiences.

Resources