---
title: "Render selected pages on-demand with on-demand builders | Netlify"
description: "Realize the speed, agility and performance of a scalable, composable web architecture with Netlify. Explore the composable web platform now!"
source: "https://www.netlify.com/blog/2021/12/29/render-selected-pages-on-demand-with-on-demand-builders/"
last_updated: "2026-07-10T19:03:26.000Z"
---
> Throughout December we’ll be [highlighting a different Netlify feature each day](/blog/2021/12/01/highlighting-a-different-netlify-feature-each-day-in-december/?utm_campaign=featdaily21&utm_source=netlify&utm_medium=blog&utm_content=odb). It might just be the thing you need to unlock those creative juices, and [dust off that domain](https://www.netlify.com/blog/2021/12/01/dusty-domains-your-forgotten-domains-raise-money-for-charity/?utm_campaign=featdaily21&utm_source=netlify&utm_medium=blog&utm_content=odb) you registered but never deployed! Keep an eye [on the blog](https://www.netlify.com/blog/2021/12/01/highlighting-a-different-netlify-feature-each-day-in-december/?utm_campaign=featdaily21&utm_source=netlify&utm_medium=blog&utm_content=odb) and on [Twitter](https://twitter.com/netlify) for each feature!

For greater flexibility over when you render your pages, Netlify provide [On-demand builders](https://docs.netlify.com/configure-builds/on-demand-builders/?utm_campaign=featdaily21&utm_source=netlify&utm_medium=blog&utm_content=odb). They are a great way to defer the generation and persistence of some of your pages until they are first requested.

This can be a helpful way to keep site build times manageable, even for very extensive sites with large numbers of pages. Or you can use them to generate pages which contain dynamic data, perhaps data contributed by your visitors and not available during the build of your site.

![Screenshot of the Every Color demo site](/v3/img/blog/screenshot-every-color.jpg)

## What does an on-demand builder look like?

On-demand builder are serverless functions with a particular configuration. We’ve already mentioned the [Netlify Functions workflow](/blog/2021/12/11/serverless-functions-made-simple-just-add-files/?utm_campaign=featdaily21&utm_source=netlify&utm_medium=blog&utm_content=odb) this month, and on-demand builder functions are just an extension of those.

There are 2 main pieces to consider when building a site using on-demand builders:

### 1\. What URLs will resolve to an on-demand builder function?

You can decide exactly which URLs will have their views generated by on-demand builders by using [Netlify’s Redirects](/blog/2021/12/13/setting-up-redirects-on-netlify/?utm_campaign=featdaily21&utm_source=netlify&utm_medium=blog&utm_content=odb) configuration. Here’s an example from a `netlify.toml` file which would specify a function.

```
# Generate the view of a less commonly requested page# the first time it is requested via a serverless functions[[redirects]]  from = /not/popular/but/still/important/*  to = /.netlify/builders/page-from-the-archive.js  status = 200
```

Any on-demand build functions you create will available with the path `/.netlify/builders/{function_name}`, but how do you create them in the first place?

### 2\. Create an on-demand builder function

You can write your functions in JavaScript or TypeScript and place them in either the default functions serverless directory, or wherever you chose and configure. Netlify provides a library function for you which tells [Netlify’s Edge infrastructure](https://www.netlify.com/products/edge/?utm_campaign=featdaily21&utm_source=netlify&utm_medium=blog&utm_content=odb) how to serve and cache the response from your functions.

Here’s an example of `page-from-the-archive.js`:

```
// Make "builder" method available from the Netlify functions package// (don't forget to add the package to your package.json)const { builder } = require("@netlify/functions");
```

```
// A handler function to generate a responseasync function handler(event, context) {
  // Logic to generate the required content  const htmlResponse = "<h1>Your content, on-demand!</h1>";
  // A response to return  return {    body:htmlResponse ,    statusCode: 200,    ttl: 3600, // An optional time to live for this response.  }}
```

```
// Wrap the handler function with Netlify's builder methodexports.handler = builder(handler);
```

On-demand functions are Netlify’s implementation of the [Distributed Persistent Rendering (DPR)](https://www.netlify.com/blog/2021/04/14/distributed-persistent-rendering-a-new-jamstack-approach-for-faster-builds/?utm_campaign=featdaily21&utm_source=netlify&utm_medium=blog&utm_content=odb) pattern. We think that it’s particularly powerful as it adds the ability to serve large sites, and sites with dynamic content without undermining some of the core attributes of Jamstack sites such as atomic and immutable deploys (which lead to some of those goodies we discussed this month such as [instant rollbacks](/blog/2021/12/08/instant-deploy-rollbacks/?utm_campaign=featdaily21&utm_source=netlify&utm_medium=blog&utm_content=odb), [deploy previews](/blog/2021/12/15/glimpse-the-future-with-deploy-previews/?utm_campaign=featdaily21&utm_source=netlify&utm_medium=blog&utm_content=odb), and so on).

We have a simple demo site and repo which uses on-demand builder for you to explore. You can even deploy it yourself with a quick click of the button below.

[![Deploy to Netlify](https://www.netlify.com/img/deploy/button.svg)](https://app.netlify.com/start/deploy?repository=https://github.com/netlify/example-every-color&utm_campaign=featdaily21&utm_source=netlify&utm_medium=blog&utm_content=odb)

Have fun!

## More information

-   [Docs: Create on-demand builders](https://docs.netlify.com/configure-builds/on-demand-builders/?utm_campaign=featdaily21&utm_source=netlify&utm_medium=blog&utm_content=odb)
-   [Introducing Distributed Persistent Rendering](https://www.netlify.com/blog/2021/04/14/distributed-persistent-rendering-a-new-jamstack-approach-for-faster-builds/?utm_campaign=featdaily21&utm_source=netlify&utm_medium=blog&utm_content=odb)
-   [Presentation: Rendering models that scale. Whatever your framework](https://noti.st/philhawksworth/1mPur6/rendering-models-that-scale-whatever-your-framework)
-   [Example site: Every Color](https://every-color.netlify.app/)
-   [Example repo: Every Color](https://github.com/netlify/example-every-color)

### Share

-   [X (fka Twitter)](https://twitter.com/intent/tweet?text=Render selected pages on-demand with on-demand builders&url=https://www.netlify.com/blog/2021/12/29/render-selected-pages-on-demand-with-on-demand-builders//)
-   [LinkedIn](https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fwww.netlify.com%2Fblog%2F2021%2F12%2F29%2Frender-selected-pages-on-demand-with-on-demand-builders%2F%2F)
-   [Facebook](https://www.facebook.com/sharer.php?u=https://www.netlify.com/blog/2021/12/29/render-selected-pages-on-demand-with-on-demand-builders//)
-   [Bluesky](https://bsky.app/intent/compose?text=Render selected pages on-demand with on-demand builders+https://www.netlify.com/blog/2021/12/29/render-selected-pages-on-demand-with-on-demand-builders//)

* * *

### Tags

-   [Tools](/blog/tags/tools/)
-   [Serverless](/blog/tags/serverless/)
-   [Scale](/blog/tags/scale/)

## Keep reading

![](/images/blog-fallback-thumbnail.svg)

News & Announcements December 14, 2021

[

### On-demand Builders are now generally available

](/blog/2021/12/14/on-demand-builders-are-now-generally-available/)

-   ![Profile picture of Joey Aiello](/_astro/25200030a88292283718f0790ad80b0fdd8439b3-512x512_1JNFW2.webp)
    
    Joey Aiello
    

![](/images/blog-fallback-thumbnail.svg)

News & Announcements April 22, 2021

[

### Next.js on Netlify: Now with support for On-demand Builders and Distributed Persistent Rendering

](/blog/2021/04/22/next.js-on-netlify-now-with-support-for-on-demand-builders-and-distributed-persistent-rendering/)

-   ![Profile picture of Netlify team](/_astro/2ded7a52db41c7613be0baa648ac9bf9c1e8a985-300x300_DNhVu.svg)
    
    Netlify team
    

## Recent posts

News & Announcements June 25, 2026

[

### Netlify Functions, designed for Agent Experience

](/blog/netlify-functions-designed-for-agent-experience)

-   ![Profile picture of Eduardo Bouças](/_astro/52958f21e8450baf6d8e60302341a984e220c0cd-512x512_13VDlu.webp)
    
    Eduardo Bouças
    

News & Announcements June 24, 2026

[

### How we measure Netlify’s Agent Experience

](/blog/how-we-measure-netlify-agent-experience)

-   ![Profile picture of Sean Roberts](/_astro/bbf2243f8171dbddd80ab2103622106cef84d125-512x512_Z1d2LKE.webp)
    
    Sean Roberts
    

Guides & Tutorials May 15, 2026

[

### How to build a real-time AI chatbot in minutes with Netlify Agent Runners (no backend)

](/blog/how-to-build-a-real-time-ai-chatbot-in-minutes-with-netlify-agent-runners-no-backend)

-   ![Profile picture of Nahrin Jalal](/_astro/f0e7c8f227a03fe58340c99ef5439d5a896c0733-272x272_Z23kDpD.webp)
    
    Nahrin Jalal
    

![](/_astro/3f255b372fa958df35802666ee33b4609b2d71bd-1200x1586_1VtE2D.webp)

### How do the best dev and marketing teams work together?

[Access the report](https://www.netlify.com/reports/2024-leadership-trend-report/access/)