Deployment
Build your site and put it online.
astro build writes the site to dist/. Without an adapter, the whole site is static, so deploy it to any static host. With an adapter, your output and prerender settings work as they do in Astro.
Pages of a static source are prerendered. Pages of a dynamic source, like Notion, render on demand, and one site can mix both. Files generated from your content, like .md files, the sitemap and Open Graph images, use the same render mode as their pages.
What Needs a Server
Without an adapter, the build fails on anything in this list and prints the reason.
- A dynamic source, like Notion and Sanity.
- AI chat and MCP.
- The OpenAPI proxy.
- Feedback with actions on the server. Actions in the browser don't need a server.
- Server-side search, when you enable it.
- Custom pages and API routes rendered on demand.
A plugin with middleware doesn't fail the build. Without an adapter, the build warns that its middleware never runs.
Render Mode
The mode option of createPress() changes when content renders, for every source or by source key:
createPress(
{
docs: docsSource,
guides: notion.dynamicSource({ baseDir: "guides" }),
},
{ mode: { guides: "force-static" } },
);auto: the default described above.force-dynamic: render on demand, so that every request reaches middleware, like for authentication.force-static: load a dynamic source once at build time, and prerender its pages.
With output: "server", auto renders every source on demand, like other Astro routes. To build a dynamic source without an adapter, set mode: "force-static".
Cache Headers
A dynamic source with staleTime, in milliseconds, is read again once that time has passed. Its pages rendered on demand, with their .md file and Open Graph image, get Cache-Control: public, s-maxage=<staleTime in seconds>, so a CDN keeps them for the same time:
createPress({ ...notion.dynamicSource(), staleTime: 60_000 });Without staleTime, Fumapress sets no Cache-Control.
Adapters
Add an adapter to render routes on demand. Pages of static sources stay prerendered.
export default defineConfig({
site: "https://acme.dev",
adapter: node({ mode: "standalone" }),
integrations: [press()],
});With the Node.js adapter, start the server with NODE_ENV=production. Without it, React runs its
development build on the server.
NODE_ENV=production node dist/server/entry.mjsRendering Every Page on Demand
With output: "server", pages of static sources render on demand too, unless mode prerenders them. Use it when every page must run middleware, like authentication.
export default defineConfig({
output: "server",
adapter: node({ mode: "standalone" }),
integrations: [press()],
});Post-Build Plugins
Plugins like link validation read the pages that Astro prerenders during the build. A build that prerenders elsewhere, with experimental.parallelPrerender or an adapter prerendering outside of Node.js, fails and prints the reason.
Files written by these plugins go to your Astro outDir, which is public on a static host.
Base Path
For a URL like https://user.github.io/repo/, set site and base:
export default defineConfig({
site: "https://user.github.io",
base: "/repo",
integrations: [press()],
});page.url and other loader paths don't include base, so use withBase() on custom pages.
Build Errors
The build stops with one of these messages:
Last updated on