Skip to Content

Deployment

Build your site and put it online.

fumapress build writes the site to dist/. Deploy to a platform if anything renders on demand, or to a static host if nothing does.

The render mode of a page follows its content source, and one site can have both kinds:

Content sourceIts pages
Static, like MDX filesPrerendered at build time
Dynamic, like NotionRendered on demand

Files generated from your content, like .md files, the sitemap and Open Graph images, use the render mode of their pages.

What Needs a Server

The default plugins don't need a server. On a static build, they leave out what needs one, like the Markdown content negotiation of llms.txt.

Render Mode

The mode option of createPress() changes when content renders, for every source or by source key:

press.config.tsx
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.

Cache Headers

A dynamic source with staleTime, in milliseconds, is read again once that time has passed:

press.config.tsx
createPress({ ...notion.dynamicSource(), staleTime: 60_000 });

Its pages rendered on demand, with their .md files and Open Graph images, have the same time as s-maxage in their Cache-Control header, so a CDN keeps them that long. Without staleTime, Fumapress sets no Cache-Control.

Platforms

The adapter for Vercel, Netlify or Cloudflare is detected at build time. Other platforms get the Node.js adapter. When nothing needs a server, the build has no function, like a Vercel Function, and the platform serves static files.

The platforms serve prerendered pages and the files of public/ without your function, so middleware only runs for routes rendered on demand. On a Node.js server, it runs for every request.

Node.js

npm run build
npm run start

To run the server without the CLI, like in a container:

PORT=8080 node dist/serve-node.js

Vercel

Import the repository.

Netlify

Import the repository. The build generates a netlify.toml, unless your project has one. Commit it, or copy its settings into yours.

Keep Pretty URLs off in your own netlify.toml, so that pages keep their URLs without a trailing slash.

Cloudflare

Workers Builds is detected for you. To deploy from elsewhere, set the adapter, build, then run:

npx wrangler deploy

Workers Builds doesn't expose the site URL, so set site.baseUrl.

The build generates a wrangler.jsonc, unless your project has a Wrangler config. In your own config, keep html_handling: "drop-trailing-slash", and set assets.directory to ./dist/public when nothing needs a server.

Open Graph images rendered on demand can exceed the 10 ms of CPU time per request on the Workers Free plan.

Building for Another Platform

To build for a platform outside of its own build system, like in your own CI, set adapter:

vite.config.ts
press({
  adapter: "waku/adapters/cloudflare",
});

Static Hosts

For GitHub Pages, a CDN or any file host, the site must have nothing that needs a server.

Turn Off Image Optimization

If you installed sharp, turn off image optimization.

Upload the Build

Build, then upload dist/public.

The build generates a 404.html, which most hosts use automatically. With internationalization, it is in the default language.

Base Path

For a URL like https://user.github.io/repo/, set basePath and include the path in site.baseUrl. On Cloudflare, this needs Wrangler 4.148 or later.

press({
  basePath: "/repo/",
});

Build Errors

Last updated on

On this page