Static Sites

Static Sites

There is no separate static-site or CDN product. Ship a static frontend as a web service that serves the files in dist, out, or build.

Web service, not a CDN product

Service types are web, worker, and job. A marketing site or SPA is a web app: it listens on a port and StackBlaze gives it a *.stackblaze.app URL. Workers and jobs do not get a public hostname.

If you need server-side rendering, API routes, or request-time database access, you are still deploying a web service — just with a Node (or other) process instead of a file server.

A git-backed site builds once on commit and serves from its web.stackblaze.app URL.

Create the service

On the phase canvas, click + Service, then Git repository or Docker images.

  • Git repository — connect GitHub or a public URL. Set a build command that writes dist / out, and a start command that serves that folder.
  • Docker images — use an image that already contains nginx, Caddy, or serve, or set Start command on Settings → Process.

Keep the service type web so the app gets a public URL. Commit the staged change on the canvas when you are ready.

Start command

On Settings → Process, set a start command that serves the build output. Examples:

Start command
# Node: serve the Vite/CRA output
npx serve -s dist -l $PORT

# Next.js static export
npx serve -s out -l $PORT

# Image that already has nginx (listens on PORT in your config)
nginx -g 'daemon off;'

Bind to 0.0.0.0 and read PORT (default 8080). Leave the start command blank only if the image’s default process already serves the files.

Typical build output

These are common framework defaults — set them explicitly on Settings if auto-detect does not match your repo:

FrameworkBuild commandOutput directory
Next.js (static export)next buildout
Vitevite builddist
Create React Appnpm run buildbuild
Astroastro builddist
Hugohugopublic

Note

Next.js needs output: 'export' in next.config.js to produce a static out folder. Without it, run Next as a normal Node web service.

Next.js static export

next.config.js
/** @type {import('next').NextConfig} */
const nextConfig = {
  output: 'export',
  images: {
    unoptimized: true,
  },
}

module.exports = nextConfig

SPA routing and redirects

StackBlaze does not process a _redirects file. Configure fallbacks and 301s in nginx, Caddy, or your app. See Redirects.

nginx.conf
location / {
  try_files $uri $uri/ /index.html;
}

npx serve -s already falls back to index.html for unknown paths.

Environment variables

Add keys on the app Variables tab, then Commit N changes. For a purely static bundle, public values are baked in at build time (VITE_, NEXT_PUBLIC_, REACT_APP_). Do not put private API keys in those prefixes — they ship in the JavaScript.

Custom domains

Same path as any web app: Settings → Domains → Custom Domain, CNAME to the app’s *.stackblaze.app hostname. See Custom Domains.