3rd September, 2025

The History between Vite and Next JSMedieval royal scribes and court philosophers would fiercely debate the
kingdom’s representation. Some favored Vite, sending swift instructions for provinces to build themselves. Others insisted on Next JS, delivering the kingdom’s majesty fully-formed from the royal workshop.Whether the kingdom chose Vite or Next JS is unknown to this day.
Vite: Server Who?
If you’re coming from the land of Vite, this whole server thing probably feels like overkill. And why wouldn’t it? Vite is slick, fast, and works entirely on the client. It bundles your beautiful React project into a neatindex.html
file with a div
and a <script>
tag. That script tag sends down a JavaScript bundle.
Here’s the key: that bundle is a set of instructions. It tells the client’s browser how to build the page from scratch.
But there’s a catch. Let’s say we’re trying to load a user dashboard at https://example.com/dashboard
. You open your network tab and you see a waterfall of requests that looks something like this.
1
The Empty Shell
The client asks the server for the page. The server, knowing nothing, sends
back a completely empty HTML file. It’s a blank canvas with a single
instruction: “go fetch this giant JavaScript file.”
2
The Instruction Manual
The browser sees the script tag and dutifully fetches the JavaScript bundle.
It then has to parse and execute all of it. Buried in those instructions is
another one: “now that you’re running, make an authenticated request to our
API to get the dashboard data.”
3
The Actual Data
Finally, the browser makes a third request to fetch the metrics it
needs to actually render the dashboard. Only after this request completes
can it show the user the page they asked for in the first place.
Next JS
This is server rendering, and it’s the core principle that makes Next.js so powerful.The Big Idea
Shift the rendering work from the client’s browser to your own powerful server. The client gets a fully-formed page, not a to-do list.
Shift the rendering work from the client’s browser to your own powerful server. The client gets a fully-formed page, not a to-do list.

Client Rendering
- Components handling sensitive data or secret API keys should run on the server to keep credentials secure.
- Essential data for the first view of a page should be server-rendered for fast loading and better SEO.
- Computationally expensive tasks like data processing or file generation are best done on the server.

Server Rendering
- Components needing complex state management and immediate user feedback should run on the client.
- Components using browser-only features like geolocation, WebSockets, or local storage must be client components.
- Components requiring access to device hardware, such as camera, microphone, or GPU, must run on the client.
Not Just Pre-Built, Custom-Built
This is where the magic lies. The server doesn’t just send a single, static HTML file to every user. That wouldn’t work for a dynamic page like a user dashboard. With Next.js, the server can run code for every single request. This is dynamic rendering. When a request comes in for/dashboard
, the Next.js server can figure out who the user is, fetch their specific data, and generate a custom HTML page just for them, on the fly.
This dynamic rendering can take place based on any request header. The Authorization
token can be used to help the server identify you, or the X-Forwarded-For
header can be used to determine whether you should be shown the webpage in a different language.
Here’s what it looks like.
Diving Deeper
With a framework that gives you this much control, there are a lot of features that Next JS comes with.Page level SEO
Next.js makes SEO easy by letting you render pages on the server, so search engines can see the full content right away. You can also set custom meta tags for each page, like titles and descriptions, which helps your site show up better in search results. With server rendering, crawlers get the complete HTML, making your pages more discoverable.API Routes
Theapi
folder in Next.js lets you create server-side endpoints right inside your project. Any file you add to the app/api
directory automatically becomes an API route, and you can write backend logic using JavaScript or TypeScript. These routes run on the server, so you can securely handle requests, connect to databases, or process form submissions without exposing sensitive code to the client.
Fun factIf you deploy your Next.js app on Vercel (the company behind Next.js), your API routes can run on a variety of serverless environments—not just Node.js, but also PHP, Go, Python, and more!
Next.js isn’t complex for the sake of it. It’s a tool built to solve the very real performance, SEO, and user experience problems that arise from making the client do all the heavy lifting. It’s about changing where and when your application does its work. It’s the difference between sending someone a toolkit and delivering a finished product. And once you grasp that, the game is simple.