Skip to content

Railway

Railway auto-detects your framework and runs builds from Git. pageflare integrates by customizing the build command to add a post-build optimization step.

Override Railway’s build command in the dashboard or railway.json to run pageflare after your framework’s build.

Terminal window
npm install -D @pageflare/cli

In your Railway service settings, set the Build Command to:

npm run build && npx @pageflare/cli dist/ --in-place --no-progress
railway.json
{
"$schema": "https://railway.com/railway.schema.json",
"build": {
"buildCommand": "npm run build && npx @pageflare/cli dist/ --in-place --no-progress"
}
}
  1. Go to your service in the Railway dashboard.
  2. Open the Variables tab.
  3. Add PAGEFLARE_LICENSE with your license key.

After deploying, check the Build Logs in the Railway dashboard for the pageflare summary:

Done 145.2 KB saved (38.1%) 1.2s
Files 42 total, 38 optimized, 4 unchanged, 0 errors
FrameworkOutput directory
Astrodist/
Next.js static exportout/
Hugopublic/
Vitedist/
Eleventy_site/

Build command not used Railway may use Nixpacks auto-detection instead of your custom build command. Set the build command explicitly in the dashboard to override auto-detection.

pageflare processes 0 files The output directory in the build command doesn’t match your framework’s output. Check the table above.