SSR and SSG
Builder supports SSR and SSG out-of-the-box for all components and frameworks.
This means that you can leverage the benefits of SSR (Server-Side Rendering) and SSG (Static Site Generation), such as improved performance, SEO, and initial page load times, without any additional setup.
For more detail on how Builder works, read How Builder Works: a Technical Overview.
Make sure you're using a framework that supports these features (check your framework's documentation) and follow your framework's guidelines for fetching data server-side when integrating Pages or Sections.
Framework-specific limitations
React doesn't support server-side data fetching for custom components. For React custom components that need to fetch data server-side, you must use Builder's getAsyncProps utility.
To use getAsyncProps(), call the loader function to fetch the Page content and asynchronously resolve any additional data. When the data is resolved, the loader function returns the content for your Remix component:
If you have React custom components that depend on external data sources and need that data server-side, such as a products API, use Builder's getAsyncProps() utility to fetch any data needed server-side before render.
Fetching data for use in the Visual Editor
When using getAsyncProps with the Gen 1 React SDK for SSR or SSG, any data fetched server-side will not be available in the Builder Visual Editor. Since the Visual Editor renders content client-side, components relying on getAsyncProps need a way to fetch data on the client side during editing.
To make your data available in the Visual Editor, you can fetch the data on the client side by extracting any logic you're already using in getAsyncProps, and calling that logic on the client-side with the caveat that you should only employ this workaround when editing and revert when editing is complete.
React doesn't support server-side data fetching for custom components. For React custom components that need to fetch data server-side, you must use Builder's getAsyncProps utility.
To use getAsyncProps(), call the loader function to fetch the Page content and asynchronously resolve any additional data. When the data is resolved, the loader function returns the content for your Remix component:
Fetching data for use in the Visual Editor
When using getAsyncProps with the Gen 2 React SDK for SSR or SSG, data fetched server-side will not be available in the Builder Visual Editor. Since the Visual Editor renders content client-side, components relying on getAsyncProps need a way to fetch data on the client side during editing.
Use the isEditing() or isPreviewing() helper functions check that you are in editing mode and conditionally fetch data on the client side:
React doesn't support server-side data fetching for custom components. For React custom components that need to fetch data server-side, you must use Builder's getAsyncProps utility.
To use getAsyncProps(), call the loader function to fetch the Page content and asynchronously resolve any additional data. When the data is resolved, the loader function returns the content for your Remix component:
Fetching data for use in the Visual Editor
When using getAsyncProps with the Gen 1 React SDK for SSR or SSG, any data fetched server-side will not be available in the Builder Visual Editor. Since the Visual Editor renders content client-side, components relying on getAsyncProps need a way to fetch data on the client side during editing.
To make your data available in the Visual Editor, you can fetch the data on the client side by extracting any logic you're already using in getAsyncProps, and calling that logic on the client-side with the caveat that you should only employ this workaround when editing and revert when editing is complete.
React doesn't support server-side data fetching for custom components. For React custom components that need to fetch data server-side, you must use Builder's getAsyncProps utility.
To use getAsyncProps(), call the loader function to fetch the Page content and asynchronously resolve any additional data. When the data is resolved, the loader function returns the content for your Remix component:
Fetching data for use in the Visual Editor
When using getAsyncProps with the Gen 2 React SDK for SSR or SSG, data fetched server-side will not be available in the Builder Visual Editor. Since the Visual Editor renders content client-side, components relying on getAsyncProps need a way to fetch data on the client side during editing.
Use the isEditing() or isPreviewing() helper functions check that you are in editing mode and conditionally fetch data on the client side:
React doesn't support server-side data fetching for custom components. For React custom components that need to fetch data server-side, you must use Builder's getAsyncProps utility.
To use getAsyncProps(), call the loader function to fetch the Page content and asynchronously resolve any additional data. When the data is resolved, the loader function returns the content for your Remix component:
Fetching data for use in the Visual Editor
When using getAsyncProps with the Gen 2 React SDK for SSR or SSG, data fetched server-side will not be available in the Builder Visual Editor. Since the Visual Editor renders content client-side, components relying on getAsyncProps need a way to fetch data on the client side during editing.
Use the isEditing() or isPreviewing() helper functions check that you are in editing mode and conditionally fetch data on the client side:
React doesn't support server-side data fetching for custom components. For React custom components that need to fetch data server-side, you must use Builder's getAsyncProps utility.
To use getAsyncProps(), call the loader function to fetch the Page content and asynchronously resolve any additional data. When the data is resolved, the loader function returns the content for your Remix component:
Fetching data for use in the Visual Editor
When using getAsyncProps with the Gen 1 React SDK for SSR or SSG, any data fetched server-side will not be available in the Builder Visual Editor. Since the Visual Editor renders content client-side, components relying on getAsyncProps need a way to fetch data on the client side during editing.
To make your data available in the Visual Editor, you can fetch the data on the client side by extracting any logic you're already using in getAsyncProps, and calling that logic on the client-side with the caveat that you should only employ this workaround when editing and revert when editing is complete.
React doesn't support server-side data fetching for custom components. For React custom components that need to fetch data server-side, you must use Builder's getAsyncProps utility.
To use getAsyncProps(), call the loader function to fetch the Page content and asynchronously resolve any additional data. When the data is resolved, the loader function returns the content for your Remix component:
Fetching data for use in the Visual Editor
When using getAsyncProps with the Gen 2 React SDK for SSR or SSG, data fetched server-side will not be available in the Builder Visual Editor. Since the Visual Editor renders content client-side, components relying on getAsyncProps need a way to fetch data on the client side during editing.
Use the isEditing() or isPreviewing() helper functions check that you are in editing mode and conditionally fetch data on the client side:
React doesn't support server-side data fetching for custom components. For React custom components that need to fetch data server-side, you must use Builder's getAsyncProps utility.
To use getAsyncProps(), call the loader function to fetch the Page content and asynchronously resolve any additional data. When the data is resolved, the loader function returns the content for your Remix component:
Fetching data for use in the Visual Editor
When using getAsyncProps with the Gen 1 React SDK for SSR or SSG, any data fetched server-side will not be available in the Builder Visual Editor. Since the Visual Editor renders content client-side, components relying on getAsyncProps need a way to fetch data on the client side during editing.
To make your data available in the Visual Editor, you can fetch the data on the client side by extracting any logic you're already using in getAsyncProps, and calling that logic on the client-side with the caveat that you should only employ this workaround when editing and revert when editing is complete.
SSR works out-of-the-box with Svelte.
For any Vue-based framework, such as Nuxt, SSR works out-of-the-box.
For any Vue-based framework, such as Nuxt, SSR works out-of-the-box.
SSR works out-of-the-box with Qwik.
SSR works out-of-the-box with the Angular Gen 2 SDK.
React doesn't support server-side data fetching for custom components. For React custom components that need to fetch data server-side, you must use Builder's getAsyncProps utility.
The Gatsby tooling fetches the required data at build time and passes that data to the component when the browser renders the content.
Fetching data for use in the Visual Editor
When using getAsyncProps with the Gen 1 React SDK for SSR or SSG, any data fetched server-side will not be available in the Builder Visual Editor. Since the Visual Editor renders content client-side, components relying on getAsyncProps need a way to fetch data on the client side during editing.
To make your data available in the Visual Editor, you can fetch the data on the client side by extracting any logic you're already using in getAsyncProps, and calling that logic on the client-side with the caveat that you should only employ this workaround when editing and revert when editing is complete.
React doesn't support server-side data fetching for custom components. For React custom components that need to fetch data server-side, you must use Builder's getAsyncProps utility.
Fetching data for use in the Visual Editor
When using getAsyncProps with the Gen 2 React SDK for SSR or SSG, data fetched server-side will not be available in the Builder Visual Editor. Since the Visual Editor renders content client-side, components relying on getAsyncProps need a way to fetch data on the client side during editing.
Use the isEditing() or isPreviewing() helper functions check that you are in editing mode and conditionally fetch data on the client side:
Angular workarounds for SSR and SSG custom components
The Angular SDK does not support SSR and SSG with custom components.
Angular's default is client-side rendering, where components and pages are rendered in the browser. This means that Angular's architecture is optimized for dynamic and interactive applications that rely heavily on client-side JavaScript execution.
On the other hand, SSR and SSG require the generation of fully rendered HTML on the server before it's sent to the client. This approach is critical for SEO, performance, and usability, especially for content-rich pages.
If you need to use SSR with your Angular custom components and Builder, there are a couple of workarounds worth considering:
- Using a prerendering tool: Consider leveraging a prerendering tool like prerender.io. This can help generate pre-rendered versions of your custom components so search engines and users receive fully rendered content.
- Using Symbols for your components: To facilitate server-side rendering and static site generation, consider building out your custom components as Symbols. This approach helps with smoother integration with Builder's rendering process.
For more context on Angular and SSR, visit Angular's document SSR with Angular Universal.
If published changes don't appear on your live site, it may be due to caching issues rather than a problem with Builder.
Builder publishes content to its API immediately. Delays in displaying changes are typically due to caching at the hosting provider level or within your application's caching strategy.
Work directly with your hosting provider to adjust caching for your deployed application. Some common guides are included below:
What's next
For more information on server-side data, refer to the getAsyncProps README.