Rethinking the Client-Server Boundary
For a decade, Single Page Applications (SPAs) forced web browsers to download megabytes of JavaScript, initialize component trees, and then issue multiple client-side API waterfalls to fetch data.
React Server Components (RSC)
Server Components execute exclusively on the server during request time or build time. They render to a virtual DOM representation without adding a single byte to the client JavaScript bundle.
// app/invoices/page.js - Server Component
import { db } from '@/lib/db';
export default async function InvoicesPage() {
// Direct database query with zero client API waterfall
const invoices = await db.query('SELECT * FROM invoices ORDER BY created_at DESC LIMIT 50');
return (
<div>
<h1>Enterprise Billing Ledger</h1>
<InvoiceTable data={invoices} />
</div>
);
}
Server Actions for Mutations
Rather than managing manual Express REST controllers, Server Actions allow asynchronous functions defined on the server to be called directly from interactive client forms with automatic progressive enhancement.