Web Development 2 min read 1,291 views

Next.js 15 Deep Dive: Server Actions, Partial Prerendering, and Beyond

Explore Next.js 15's groundbreaking features including stable Server Actions, Partial Prerendering, and the new caching strategies.

E
Next.js code on screen

Next.js 15 represents a major evolution in React frameworks, with stable Server Actions, groundbreaking Partial Prerendering, and a completely redesigned caching system.

Server Actions: Stable and Production-Ready

Server Actions are now stable and the recommended way to handle mutations in Next.js:

// app/actions.ts
"use server"

export async function createPost(formData: FormData) {
  const title = formData.get("title") as string;
  const content = formData.get("content") as string;

  await db.posts.create({ title, content });
  revalidatePath("/posts");
}

// app/new-post/page.tsx
import { createPost } from "./actions";

export default function NewPost() {
  return (
    <form action={createPost}>
      <input name="title" required />
      <textarea name="content" required />
      <button type="submit">Create Post</button>
    </form>
  );
}

Partial Prerendering (PPR)

PPR combines static and dynamic content on the same page:

  • Static shell loads instantly from CDN
  • Dynamic content streams in as it's ready
  • Best of both SSG and SSR worlds
// next.config.js
module.exports = {
  experimental: {
    ppr: true,
  },
};

// app/page.tsx
import { Suspense } from "react";

export default function Page() {
  return (
    <div>
      <StaticHeader />  {/* Prerendered */}
      <Suspense fallback={<Loading />}>
        <DynamicContent />  {/* Streamed */}
      </Suspense>
    </div>
  );
}

New Caching Defaults

Next.js 15 changes caching to be opt-in rather than opt-out:

  • fetch() requests are no longer cached by default
  • Route handlers are dynamic by default
  • Use cache: "force-cache" for static data

Migration Guide

  1. Update package: npm install next@15
  2. Review caching behavior for data fetching
  3. Convert API routes to Server Actions where possible
  4. Enable PPR for hybrid pages
Share this article:
ES

Written by Edrees Salih

Full-stack software engineer with 9 years of experience. Passionate about building scalable solutions and sharing knowledge with the developer community.

View Profile

Comments (0)

Leave a Comment

Your email will not be published.

No comments yet. Be the first to share your thoughts!