The Cost of Rendering: Why You Do Not Need SSR By Default
A deep dive into SSR, SSG, and client-side rendering—their costs, benefits, and how we evolved from simple websites to today’s complex rendering landscape.
The SSR Cost Problem
Server-Side Rendering has become the default choice for many new projects, but before jumping on the bandwagon, let’s talk about what it’s actually costing you—and whether you really need it.
The rise of SSR frameworks like Next.js has made server-side rendering feel inevitable, but the reality is more nuanced. Every rendering choice is fundamentally about who pays for computation: your servers or your users’ devices.
SSR introduces a fundamental cost structure change that many developers don’t fully consider:
SPA Economics:
- Server costs: Minimal (just serving static files)
- Scaling: More users = same server costs
- Computation: Free (users’ devices do the work)
SSR Economics:
- Server costs: Significant (CPU + memory for every request)
- Scaling: More users = proportionally higher costs
- Computation: You pay for every page render
This isn’t just a technical decision—it’s a business strategy decision.
How We Got Here: The Rendering Evolution
To understand why we have these choices, we need to look at how web development evolved. The traditional distinction between “websites” and “web apps” has completely broken down.
The Old Categories
The traditional thinking was simple:
- Websites: Static content, minimal interactivity, primarily informational
- Web Apps: Dynamic functionality, complex user interactions, app-like experiences
The Modern Reality
Today’s applications exist in a gray area. Consider a modern e-commerce platform built with Next.js:
- Product listings use Static Site Generation (SSG) - feels like a traditional website
- User dashboards render client-side - classic web app territory
- Checkout flows use Server-Side Rendering (SSR) for security and SEO
- Blog sections are statically generated
- Real-time features use client-side rendering with WebSockets
The answer to “is this a website or a web app?” doesn’t matter anymore. It’s whatever it needs to be, page by page, feature by feature. This flexibility led to our current rendering complexity.
The SPA Revolution: Crowdsourcing Computation
For developers coming from the Single Page Application (SPA) world, the concept is beautifully simple:
- Server delivers a minimal HTML shell
- Browser downloads JavaScript bundles
- JavaScript builds the entire user interface
- Application becomes interactive
<!-- What the server sends -->
<div id="root"></div>
<script src="app.js"></script>
<!-- What JavaScript creates -->
<div id="root">
<h1>Welcome to Our App</h1>
<p>Loading your personalized content...</p>
</div>
SPAs are, in many ways, brilliant. They essentially crowdsource computational work to users’ devices. Every visitor becomes a tiny server, rendering your application using their own CPU and memory. From a cost perspective, it’s genius—you’re getting free labor from every user’s device.
Enter Server-Side Rendering: The Plot Twist
Server-Side Rendering (SSR) flips this model:
- Browser requests a specific page
- Server runs your application code server-side
- Server generates complete HTML
- Browser receives fully-rendered page
- JavaScript “hydrates” the existing HTML
<!-- What the server sends (already complete!) -->
<div id="root">
<h1>Welcome back, Sarah!</h1>
<p>Here are your recent orders...</p>
<div class="order-list">
<!-- Fully rendered content -->
</div>
</div>
<script src="app.js"></script>
The key insight: SSR is like running your SPA on the server first, then sending the results to the browser.
The Strategic Framework: When to Choose What
Understanding the cost implications helps inform better architectural decisions:
Choose SPA when:
- Budget constraints are primary concern
- Users have reliable devices and internet
- SEO isn’t critical to business success
- You want predictable, low hosting costs
- Building internal tools or dashboards
Choose SSR when:
- SEO is crucial for discoverability
- First-page load speed directly impacts conversion
- You have users on slower devices/networks
- You can afford the computational costs
- Building content-heavy or e-commerce sites
The Hybrid Approach: Best of Both Worlds
Modern frameworks like Next.js allow you to be surgical about your choices:
// Static for SEO and performance
export async function getStaticProps() {
return { props: { posts: await fetchBlogPosts() } };
}
// Server-side for dynamic, SEO-critical content
export async function getServerSideProps() {
return { props: { user: await fetchUserData() } };
}
// Client-side for interactive features
useEffect(() => {
// Handle real-time updates
}, []);
This lets you optimize each page or feature for its specific needs and constraints.
The Middle Ground: Static Site Generation
Static Site Generation (SSG) represents perhaps the most balanced solution of all. It gives you:
- SSR benefits: SEO-friendly, fast loading, complete HTML
- SPA costs: Pre-built at deployment time, served as static files
- Best performance: No server rendering delay, cacheable everywhere
You’re essentially doing the computational work once at build time, then serving the results infinitely at near-zero cost.
Real-World Examples: How Companies Choose
Consider how different companies approach this:
- Netflix: SSR for homepage (SEO, first impression), SPA for video interface (no need to re-render server-side for play/pause)
- GitHub: SSG for documentation, SSR for user-specific pages, SPA for code editors
- Shopify stores: SSR for product pages (SEO critical), SPA for checkout flow (user experience focus)
Advanced Rendering Techniques
We’re moving toward even more sophisticated approaches:
- Incremental Static Regeneration: Update static content without full rebuilds
- Edge-side rendering: Render closer to users geographically
- Selective hydration: Only hydrate components that need interactivity
- Streaming SSR: Send HTML as it’s generated, not all at once
Conclusion: There’s No Universal Right Answer
The key insight is recognizing that rendering strategy is fundamentally about who pays for computation: your servers or your users’ devices. Both approaches have their place, and the best applications use both strategically.
Instead of defaulting to SSR, make informed decisions based on:
- Business requirements and constraints
- User needs and device capabilities
- Performance requirements
- Budget and scaling considerations
- SEO and discoverability needs
In the end, the “best” approach is the one that serves your users effectively while maintaining sustainable economics for your business. Sometimes that means crowdsourcing computation to users’ devices. Sometimes it means investing in server-side rendering. Often, it means being smart about using both.
The web has evolved beyond simple categories, and our architectural thinking should evolve with it.
What’s your experience with SPA vs SSR tradeoffs? Have you noticed the cost implications in your own projects? Share your thoughts and war stories in the comments below.
Comments