Heroku
Build an application and Flame together, then serve the static artifact through one Heroku web process.
Heroku needs a web process to serve the built files. This example uses a static application, such as React or Vue with Vite, and Express. Start with the shared setup and the framework's combined build, which writes the application and /docs into dist/.
Add the runtime server
Install Express as a runtime dependency:
Create a server at the project root. The docs handler must run before the application's SPA fallback:
The mounted static handler serves /docs/, flat .html pages and their extensionless forms. The next handler returns Flame's 404 with status 404 for any unmatched docs path. Express documents these static file options. For a multi-page application, replace the final SPA handler with the application's own 404 handling.
Configure build and startup
Merge these fields into package.json, keeping the existing combined build script and dependencies:
Heroku's classic Node.js buildpack runs heroku-postbuild in place of its automatic build step. This command therefore calls the combined build explicitly. Build dependencies such as Flame and Vite must be installed during this step; Express stays in dependencies for startup after pruning. Commit package-lock.json. See Node.js build steps and supported Node versions.
Add the web process declaration:
The server listens on Heroku's assigned PORT. One web process serves both application and docs; running two independent development servers does not expose both through the same Heroku app. See Heroku's process and port requirements.
Use the Node.js classic buildpack for this recipe. It builds the artifact during deployment; flame dev and flame preview are local development tools rather than the production process.
Verify before and after deployment
Run locally:
In another terminal:
The application and guide should succeed, and the last request should return 404. Deploy using your Heroku Git or dashboard integration, then repeat the checks against the app URL. If startup fails, inspect the build log for the combined build and the runtime log for the assigned port. Keep meta.baseURL set to the public domain.
For an npm monorepo, install from the repository lockfile, run the two workspace builds in heroku-postbuild, copy into apps/web/dist/, and start the server from the web workspace. Adjust the server's output path to its own location.
For an existing server-rendered app, add a docs static mount or upstream proxy to the production server before its framework catch-all, and keep the framework's startup command. A serverless deployment adapter may need a different integration; use a separate docs deployment when the server cannot mount static files.
Last updated Nov 7, 2026