Description
📚 Subject area/topic
SSR, Adapters, Astro Output Configuration
📋 Page(s) affected (or suggested, for new content)
https://docs.astro.build/en/guides/on-demand-rendering
https://docs.astro.build/en/guides/integrations-guide/cloudflare/
https://docs.astro.build/en/guides/integrations-guide/netlify/
https://docs.astro.build/en/guides/integrations-guide/node/
https://docs.astro.build/en/guides/integrations-guide/vercel/
📋 Description of content that is out-of-date or incorrect
Problem:
The current deployment guides for official Astro adapters (Cloudflare, Netlify, Node, and Vercel) recommend setting output: 'server'
by default. However, this conflicts with the tip (and Astro's main philosophy of delivering the smallest amount of JavaScript possible) in the on-demand rendering guide, which suggests starting with output: 'static'
unless most pages require SSR.
Start with the default 'static' mode until you are sure that most or all of your pages will be rendered on demand! This ensures that your site is as performant as possible, not relying on a server function to render static content.
The 'server' output mode does not bring any additional functionality. It only switches the default rendering behavior.
For example, the Cloudflare manual installation guide instructs users to configure astro.config.mjs as follows:
import { defineConfig } from 'astro/config';
import cloudflare from '@astrojs/cloudflare';
export default defineConfig({
output: 'server',
adapter: cloudflare(),
});
Why this is confusing:
-
Astro’s docs recommend
output: 'static'
by default:- The [on-demand rendering guide](https://docs.astro.build/en/guides/on-demand-rendering/#server-mode) explicitly states:
"Start with the default 'static' mode until you are sure that most or all of your pages will be rendered on demand! This ensures that your site is as performant as possible, not relying on a server function to render static content."
- This suggests that
output: 'static'
should remain the starting point for most projects, yet all official adapter guides default tooutput: 'server'
.
- The [on-demand rendering guide](https://docs.astro.build/en/guides/on-demand-rendering/#server-mode) explicitly states:
-
Cloudflare Pages does not require
output: 'server'
:- I confirmed with an Astro core team member in Discord that Cloudflare Pages still supports SSR even when
output: 'static'
is used.
- I confirmed with an Astro core team member in Discord that Cloudflare Pages still supports SSR even when
-
Granular control with
prerender = false
already exists:- The correct way to enable SSR for specific pages is via
export const prerender = false
, makingoutput: 'server'
unnecessary for projects that are mostly static.
- The correct way to enable SSR for specific pages is via
-
All official adapter guides follow this pattern:
- Cloudflare, Netlify, Node, and Vercel all default to
output: 'server'
, despiteoutput: 'static'
being the suggested starting point in Astro’s other documentation.
- Cloudflare, Netlify, Node, and Vercel all default to
Suggestion:
- Clarify in adapter documentation that
output: 'static'
works too – Keepoutput: 'server'
as the default in deployment guides but explicitly mention thatoutput: 'static'
is also viable with a reminder on usingprerender: false
for SSR pages. - (Possible idea) Use
output: static
as the default when installing adapter, and then clarify that you need to addprerender: false
for SSR pages.
🖥️ Reproduction in StackBlitz (if reporting incorrect content or code samples)
No response