Next.js
A React framework that adds routing, server rendering and a backend layer, so a React app loads fast and can be found on Google.
- Type
- Web framework built on React
- Created by
- Vercel, open source (MIT license)
- Renders
- On the server, at build time or in the browser, page by page
- In my stack
- Public web apps and sites that need SEO
What it is
React only draws the interface. A real web app also needs pages and URLs, data loading, server rendering for search engines, optimised images, and somewhere to run server code. Next.js is the framework that brings all of that together, with conventions instead of a pile of separate libraries to wire up.
Each page can be rendered the way that suits it: generated once at build time, regenerated in the background every few minutes, rendered on the server for every request, or run in the browser. Server components fetch data on the server and send finished HTML, so the browser downloads less JavaScript. Route handlers and server actions let the same project expose small API endpoints and handle forms.
Why I use it
Search engines see real content. Pages arrive as complete HTML with their titles and descriptions, instead of an empty page waiting for JavaScript. That matters for any page meant to be found on Google.
Fast first load. Server rendering, automatic code splitting and image optimisation keep pages quick on slow mobile connections.
It’s still React. Components, patterns and TypeScript types carry over from my React dashboards, so there is nothing new to learn on the UI side.
One project, front and light back. Forms, webhooks and small endpoints can live next to the pages that use them, without a separate server for simple needs.
Where I use it
When a project has public pages that depend on search traffic, such as a company or product site, a catalogue, a blog or the public side of a customer portal, I build it with Next.js rather than as a client-only React app. Heavier business logic stays in a dedicated backend, usually in Go, which Next.js calls from the server. It deploys most simply on Vercel, but it also runs in a Docker container on any cloud.
Best use cases
- Marketing and product sites that need good SEO and fast pages, with content that changes.
- E-commerce and catalogues: thousands of product pages generated from a database and kept fresh.
- Customer portals with public pages and a logged-in area in the same app.
- Content sites and blogs fed by a CMS or by Markdown files.
When I’d use something else
For a small static site with a handful of pages, like this portfolio, plain HTML and CSS are lighter still and have no framework to update. For an internal dashboard behind a login, SEO doesn’t matter, so a plain React app built with Vite is simpler. And for a large API with complex business rules, I keep a separate backend rather than putting everything in Next.js.
A small example
A product page rendered on the server, with its own title and description for search engines, and refreshed in the background every hour.
// app/products/[slug]/page.tsx
export const revalidate = 3600; // regenerate at most once an hour
export async function generateMetadata({ params }) {
const { slug } = await params;
const product = await getProduct(slug);
return { title: product.name, description: product.summary };
}
export default async function ProductPage({ params }) {
const { slug } = await params;
const product = await getProduct(slug); // runs on the server, never in the browser
return (
<main>
<h1>{product.name}</h1>
<p>{product.summary}</p>
</main>
);
}