Skip to main content

Static Sites

Deploy static sites, SPAs, and JAMstack applications. RailPush runs your build command, then serves the output directory with CDN-optimized caching -- hashed assets are served with immutable 1-year cache headers, while HTML is always fresh. CORS headers are enabled for cross-origin asset loading.

railpush.yaml
services:
- type: static
name: my-site
buildCommand: npm run build
staticPublishPath: dist
envVars:
- key: VITE_API_URL
value: https://api.myapp.com

type: static vs type: web with runtime: static

Both produce a static site, but they work differently:

Featuretype: statictype: web + runtime: static
Served bynginx (optimized static file server)Nixpacks static buildpack
Build stepRuns buildCommand, serves staticPublishPathNixpacks detects and builds
Best forPre-built sites, SPAs (React, Vue, Svelte)Sites needing Nixpacks auto-detection
RecommendationPreferred for most static sitesUse if you need Nixpacks features