Next.js  

Edge Rendering vs SSR vs CSR: Choosing the Right Strategy

1. Understanding Web Rendering

Rendering means converting your HTML, CSS, and JavaScript into visible, usable content in the browser.

But where this rendering happens — client, server, or edge — affects:

  • Load time

  • SEO crawlability

  • Caching strategy

  • Infrastructure cost

  • Developer experience

2. Client-Side Rendering (CSR)

Definition

Client-Side Rendering means the browser downloads a minimal HTML file and loads all the content dynamically using JavaScript.
Frameworks like Angular, React, and Vue mostly use CSR by default.

How it Works

  1. The browser requests a page from the server.

  2. The server returns an almost empty HTML shell with JavaScript bundle links.

  3. The browser executes JavaScript, fetches data via APIs, and builds the DOM.

Workflow (CSR)

User Request → Web Server (serves HTML + JS) → Browser executes JS → API Call → Data Rendered

Advantages

  • Rich and interactive UI

  • Smooth single-page experience

  • Easy front-end deployment (just host static files)

  • Works well with modern CDNs

Limitations

  • Slow first load (blank page until JS loads)

  • Poor SEO (bots may not execute JS properly)

  • Requires more client CPU and memory

Angular + ASP.NET Core Example

// Angular: app.component.tsngOnInit() {
  this.http.get('https://api.yourdomain.com/products')
    .subscribe(data => this.products = data);
}
// ASP.NET Core API Controller
[ApiController]
[Route("api/[controller]")]
public class ProductsController : ControllerBase
{
    [HttpGet]
    public IActionResult GetProducts() => Ok(_service.GetAll());
}

This is a pure CSR flow — API data loads after the page renders.

3. Server-Side Rendering (SSR)

Definition

Server-Side Rendering means the server generates the complete HTML for a page before sending it to the browser.
Frameworks like Next.js, Angular Universal, and Nuxt.js use SSR.

How it Works

  1. Request hits the web server.

  2. Server executes the rendering logic (Angular Universal / Next.js).

  3. Fully formed HTML (with data) is sent to the browser.

  4. Browser hydrates the app for interactivity.

Workflow (SSR)

User Request → SSR Server → HTML with Data → Browser Renders Page → Hydration

Advantages

  • Fast First Contentful Paint (FCP)

  • SEO-friendly (search bots get ready HTML)

  • Better perceived performance for users

Limitations

  • Higher server load

  • Slower navigation between internal routes

  • More complex build/deployment process

Example (Angular Universal + ASP.NET Core)

Server.ts (SSR entry point)

import 'zone.js/node';
import { ngExpressEngine } from '@nguniversal/express-engine';
import * as express from 'express';
import { AppServerModule } from './src/main.server';

const app = express();
app.engine('html', ngExpressEngine({ bootstrap: AppServerModule }));
app.set('view engine', 'html');
app.set('views', 'dist/browser');

This setup renders the Angular app on the server, sends pre-rendered HTML to the client, and then hydrates it.

4. Edge Rendering

Definition

Edge Rendering is an advanced form of SSR that happens closer to the user — at CDN or edge network nodes.
Platforms like Vercel Edge Functions, Cloudflare Workers, and Netlify Edge make this possible.

How it Works

  1. User requests a page.

  2. The nearest edge server (geographically) handles rendering.

  3. The result is cached and served quickly.

Workflow (Edge Rendering)

User → CDN Edge Node → Edge Function (HTML Render) → Cached Response → Browser

Advantages

  • Extremely low latency

  • Dynamic yet globally distributed rendering

  • High scalability

  • Reduced origin server load

Limitations

  • Limited runtime (edge functions are lightweight)

  • Requires serverless-compatible code

  • Cost may increase based on usage

Example (Next.js on Vercel Edge)

export const runtime = 'edge';

export async function GET() {
  const products = await fetch('https://api.yourdomain.com/products').then(res => res.json());
  return new Response(<ProductList products={products} />, { status: 200 });
}

Here, rendering happens at the edge using Vercel’s distributed runtime.

5. Technical Workflow Diagram

Rendering Lifecycle Comparison

                ┌───────────────────────────────┐
                │         User Request           │
                └───────────────────────────────┘
                             │
     ┌───────────────────────┼─────────────────────────┐
     │                       │                         │
     ▼                       ▼                         ▼
┌──────────────┐       ┌──────────────┐         ┌──────────────┐
│ CSR (Client) │       │ SSR (Server) │         │ Edge Render  │
└──────────────┘       └──────────────┘         └──────────────┘
     │                       │                         │
 JS loads & API call   Server builds HTML        CDN Node builds HTML
     │                       │                         │
Browser builds DOM     Send full HTML           Cached & served instantly
     ▼                       ▼                         ▼
 Fast interactivity     Fast first paint         Ultra-low latency

6. Performance Comparison

FeatureCSRSSREdge Rendering
First Load SpeedSlowFastVery Fast
SEOWeakStrongStrong
Server LoadLowHighModerate
ScalabilityHighMediumVery High
LatencyDependent on clientDepends on server regionVery low (edge node)
ComplexityLowMediumHigh
Best Use CaseSPAs, DashboardsSEO-heavy apps, blogsGlobal apps, e-commerce

7. Choosing the Right Strategy

ScenarioRecommended Rendering
Internal Admin PanelCSR (Angular / React)
Public SEO-driven WebsiteSSR (Angular Universal / Next.js)
Global E-Commerce PlatformEdge Rendering
Hybrid (Partial SSR)CSR + Pre-rendered routes

In many real-world applications, teams combine these — for example, using Angular SSR for landing pages and CSR for dashboards.

8. ASP.NET Core as the Backend

In all rendering models, ASP.NET Core plays the same role — as the data provider via APIs.

It remains stateless and independent, making it easy to scale horizontally.

Example

[ApiController]
[Route("api/[controller]")]
public class OrdersController : ControllerBase
{
    [HttpGet("{id}")]
    public async Task<IActionResult> GetOrder(int id)
    {
        var order = await _orderService.GetOrderByIdAsync(id);
        return Ok(order);
    }
}

This API can be consumed equally by a CSR (Angular app), SSR (Next.js app), or Edge-rendered front-end.

9. Hybrid Rendering (Future Trend)

Modern frameworks are adopting progressive rendering or islands architecture, where parts of a page render differently:

  • Static parts (at build time)

  • Dynamic parts (at runtime)

  • Personalized parts (at edge)

This hybrid approach gives a perfect balance of performance, cost, and flexibility.

10. Conclusion

Choosing between CSR, SSR, and Edge Rendering depends on your project goals:

  • For interactive dashboards, go with CSR.

  • For SEO-sensitive apps, use SSR.

  • For global reach and scalability, use Edge Rendering.

If you are using Angular + ASP.NET Core, you can start with CSR, add Angular Universal for SSR, and later migrate specific routes to Edge Rendering with serverless deployments.