Skip to content
🏷️ Note 🏷️ Web 🏷️ Front-end

Understanding Web Rendering: Part 1

March 23, 2025 • 12 min read

When I was still a beginner in web development, I never heard of the term "web rendering." The concept was completely unfamiliar to me. I still remember that time when people were hyped about single-page applications built using popular frameworks such as React, Vue, and Angular. I simply followed the trends and started learning and building web applications with these libraries and frameworks without actually understanding how they worked behind the scenes.


When I was still a beginner in web development, I never heard of the term web rendering. The concept was completely unfamiliar to me. I still remember that time when people were hyped about single-page applications built using popular frameworks such as React, Vue, and Angular. I simply followed the trends and started learning and building web applications with these libraries and frameworks without actually understanding how they worked behind the scenes. Until recently, with more powerful frameworks like Next.js and Nuxt.js emerging, I started to realize the importance of knowing how web rendering works. Moving to these new frameworks might bring many questions, and things might get super complicated if we want to build a production-ready and maintainable application.

To understand how web rendering works, we need to understand how the Web works first. Most people just take the web for granted. You type in a URL, and boom, a web page appears like magic. But behind the scenes, there's a fascinating interplay of technology that makes it all happen.

How the Web works

Here are 5 simple steps explaining how the web works. I'm using the analogy of ordering DIY furniture online:

Step 1: Placing Your Order (Typing the URL):

When you want to visit a website, you type its address, called a URL, into your web browser. Think of this as deciding to order a specific piece of DIY furniture from an online store and typing its name into the store's website. The URL is like the precise name and model number of the furniture you want.

furniture-store

Step 2: Finding the Store (DNS Lookup):

Your browser needs to find the actual location of the website on the internet, which is a server with a numerical IP address. It does this by asking a special internet address book called the Domain Name System (DNS) to translate the website name (like "furniturestore.com") into its IP address. This is similar to your browser acting like a personal shopper who looks up the physical address of the online furniture store in a massive address book (DNS) using the name you typed.

Step 3: Requesting Instructions and Parts (HTTP Request):

Once your browser knows the server's address, it sends a message called an HTTP request asking the server to send the files needed to display the webpage. This request travels over the internet, our "digital highway," using protocols like TCP/IP. Think of this as your personal shopper contacting the furniture store and saying, "Hey, I want the instructions (HTML), the look and feel (CSS), and the interactive bits (JavaScript) for that DIY furniture you have listed."

Step 4: Shipping the Package (Server Response):

The server receives your browser's request. It finds all the necessary files (like HTML for structure, CSS for styling, and JavaScript for interactivity, as well as images) and sends them back to your browser in small chunks called data packets. This is like the furniture store packaging up the assembly instructions (HTML), the pictures of the finished product and color swatches (CSS), and all the individual pieces and hardware (JavaScript and other assets) and shipping them to your computer in several boxes (data packets).

shipping packages

Step 5: Assembling and Interacting (Browser Rendering and Hydration):

Your browser receives all the data packets, puts them back together, and then renders the webpage. It uses the HTML to build the basic structure, the CSS to style it and make it look good, and the JavaScript to make it interactive, like buttons that work or animations. For web pages that use server-side rendering (SSR) or static site generation (SSG), much of the initial assembly (HTML) is done by the server before it's sent. To make these initially static pages interactive, a process called hydration takes place, where the JavaScript code "wakes up" the HTML and attaches interactive behaviors. This final step is like you receiving all the boxes and the assembly instructions. You then follow the instructions to put the furniture together, and the JavaScript is like the mechanisms that allow drawers to open, doors to swing, or lights to turn on, making the furniture (webpage) interactive.

drilling

All in all, the web is simply about computers communicating with each other remotely through the internet. Here's how the web works in a simplified diagram.

how-web-works

Now we know exactly how websites work and that the basic principle is just browsers retrieving files from servers when users request them. But what exactly is Web Rendering?

Definition of Rendering on the Web

Web rendering is the process of transforming code into visually engaging and interactive web content. Think of it like this: after your browser, acting as a personal shopper, requests the instructions and parts for your desired online DIY furniture (website data) from the store (server), and the store ships these files back to your computer in data packets, your browser then takes on the role of an assembler. It receives all the data packets, puts them back together, and renders the webpage, using the HTML for structure, the CSS for styling, and the JavaScript to make it interactive, allowing you to see and interact with the final product.

This rendering process can occur on the server-side before the content is sent to your browser, on the client-side within your browser, or even involve a combination of both approaches. For example, with server-side rendering, components are converted into HTML strings on the server, while with client-side rendering, the browser uses JavaScript to build the page.

Key factors when considering Web Rendering strategies

When deciding on web rendering strategies, several criteria should be taken into account. Here are some key factors to consider:

  1. Performance

    This refers to how quickly a website loads and how responsive it is to user interactions. Faster initial loading and smooth interaction are crucial for a positive user experience. For example, a delay in loading can cause users to abandon a website.

  2. Search Engine Optimization (SEO)

    This is about how easily search engines can crawl and index your website's content. Content that is readily discoverable by search engines can improve a website's visibility. For instance, product pages on an e-commerce site need good SEO to attract customers.

  3. User Experience (UX)

    This encompasses how users perceive and interact with your website. A seamless and engaging experience encourages users to explore and achieve their goals. For example, interactive elements should respond quickly to user input.

  4. Dynamic Content Requirements

    This factor considers how frequently and what type of content on your website changes. Choose a technique that effectively handles the required level of content dynamism. For instance, a news website with constantly updating articles has different needs than a static portfolio site.

  5. Website Type and Complexity

    The nature and scale of your website or application play a significant role. Select a rendering approach that aligns with the overall structure and features of your project. For example, a single-page application might favor a different technique than a content-heavy website.

  6. Security

    Different rendering patterns can have various security implications. Some methods inherently offer better protection against certain types of threats. For example, static sites can have a reduced attack surface compared to server-rendered applications.

  7. Target Audience

    Consider the characteristics of your users, including their devices and internet connection speeds. The chosen technique should provide a good experience for the intended users. For example, a website for users with slow mobile connections might prioritize faster initial load times.

Ultimately, the ideal rendering technique often involves considering the trade-offs between these factors and choosing the approach that best aligns with the website's goals and user expectations. In some cases, combining different rendering techniques might be the optimal solution.

Now that we understand the key considerations that influence our rendering decisions, let's explore the specific strategies available to developers. Each approach has its distinct advantages and ideal use cases, so understanding the full spectrum of options will help you make informed architectural choices for your web projects. From traditional server-side rendering to newer hybrid approaches, these strategies represent the evolving landscape of web development techniques.

Web Rendering Strategies

Here are the web rendering strategies and techniques with descriptions that highlight their relationship to the key factors we discussed:

  • Static Rendering involves serving pre-built HTML files directly to the browser, making it extremely fast for content that doesn't change often. This approach excels in performance and security since there's no server-side processing at request time, but lacks support for personalized or frequently updated content. Static rendering is perfect for documentation sites, landing pages, or blogs where content updates are infrequent and SEO is important – for example, a company's "About Us" page that rarely changes.

  • Server-Side Rendering (SSR) generates the full HTML on the server for each request before sending it to the browser. This approach provides excellent since search engines receive complete HTML, faster perceived initial load times for users, and works well for dynamic content that changes frequently. However, it may increase server load and time-to-interactive can be slower without proper optimization. E-commerce product pages are a great use case, where product information changes regularly and SEO is critical for business success.

  • Client-Side Rendering (CSR) sends minimal HTML and relies on JavaScript in the browser to dynamically render content and handle user interactions. This creates highly interactive experiences with smooth transitions between pages and reduced server load. The drawbacks include poorer SEO (unless implemented with proper techniques) and potentially slower initial load, especially on low-powered devices. Dashboard applications like project management tools are perfect examples, where interactivity and state management are more important than SEO.

  • Static Site Generation (SSG) pre-renders HTML files at build time rather than at request time, combining the performance benefits of static rendering with the templating power of server rendering. This approach delivers excellent performance and SEO while reducing server costs, but it requires rebuilding the entire site when content changes. Marketing websites and blogs are ideal candidates for SSG, as they benefit from the speed and SEO advantages while typically not requiring real-time content updates.

  • Incremental Static Regeneration (ISR) extends SSG by allowing specific pages to be regenerated after the initial build without rebuilding the entire site. This approach maintains the performance and SEO benefits of static generation while enabling more frequent content updates for specific pages. The complexity increases slightly, but the result is well worth it for sites with mixed content update frequencies. News websites with both evergreen and breaking content demonstrate ISR's value – static articles remain unchanged while breaking news sections can update independently.

  • The Islands Architecture breaks a webpage into independently rendered and hydrated components, with each "island" of interactivity functioning separately. This approach dramatically improves performance by loading only necessary JavaScript for each interactive element, which means faster Time to Interactive and better user experience on mobile devices. Content-heavy sites with selective interactive elements benefit most – like a news site with static articles but interactive comment sections and polls.

  • Streaming SSR sends HTML in chunks as it's generated on the server rather than waiting for the entire page to complete. This progressive rendering approach improves perceived performance by allowing the browser to start rendering content immediately while the rest is still being generated. Users see content appear quickly even on complex pages, making it ideal for content-rich applications with varying data sources – such as social media feeds that need to display the initial content quickly while loading more complex elements.

  • Edge Side Rendering (ESR) renders content on servers geographically closer to the user (at the network edge) rather than in a central location. This proximity reduces latency dramatically, improving speed for users worldwide while enabling location-specific personalization. Global e-commerce platforms particularly benefit from ESR, as product availability, pricing, and language can be rendered differently based on the user's location without sacrificing performance.

  • Hydration is the client-side process of making server-rendered HTML interactive by attaching JavaScript event listeners and dynamic behavior after the initial page load. This approach bridges the gap between server rendering and client interactivity, providing both SEO benefits and rich user interactions. The challenge is managing the hydration process efficiently to avoid performance issues. Most modern frameworks like Next.js and Nuxt.js use hydration to provide the best of both worlds – for example, an online forum where the content is server-rendered for SEO but user interactions like voting and commenting are hydrated for interactivity.

Wrapping Up

Understanding web rendering is crucial for modern web development, especially as frameworks and user expectations continue to evolve. We've covered the basics of how the web works and introduced the various rendering strategies available to developers today. While it might seem overwhelming at first, remember that each approach exists to solve specific problems. The key is identifying which rendering strategy aligns best with your project requirements, user needs, and performance goals. In many real-world applications, you'll likely use a combination of these techniques to achieve the optimal balance between performance, user experience, and developer productivity. Stay tuned for Part 2, where we'll dive deeper into implementing these rendering strategies with practical code examples and performance comparisons across different frameworks!

References & Credits

Last updated: