{"id":17098,"library":"fastboot-express-middleware","title":"FastBoot Express Middleware","description":"This package provides an Express.js middleware for rendering Ember.js applications on the server side using FastBoot. It allows developers to integrate server-side rendering (SSR) capabilities into existing Express.js applications, primarily for SEO, improved initial page load performance, and serving non-JavaScript clients. The current stable version is 4.1.2. While there isn't a strict public release cadence, it typically follows major Ember/FastBoot updates and critical bug fixes, with `v3.0.0` introducing significant breaking changes. Its key differentiator is its direct integration with Express, offering maximum flexibility for users who prefer to manage their own server stack, in contrast to the more opinionated `FastBoot App Server`. It's designed for scenarios where an existing Express server needs to incorporate Ember FastBoot rendering without adopting a full FastBoot-specific server solution.","status":"active","version":"4.1.2","language":"javascript","source_language":"en","source_url":"https://github.com/ember-fastboot/fastboot-express-middleware","tags":["javascript","fastboot","ember","express","middleware"],"install":[{"cmd":"npm install fastboot-express-middleware","lang":"bash","label":"npm"},{"cmd":"yarn add fastboot-express-middleware","lang":"bash","label":"yarn"},{"cmd":"pnpm add fastboot-express-middleware","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core dependency; this middleware is a wrapper around the FastBoot engine.","package":"fastboot","optional":false},{"reason":"Peer dependency; required as the host web framework for the middleware.","package":"express","optional":true}],"imports":[{"note":"The package is primarily CommonJS. While Node.js allows `import` for CJS modules, the documented and most reliable approach is `require`.","wrong":"import fastbootMiddleware from 'fastboot-express-middleware';","symbol":"fastbootMiddleware","correct":"const fastbootMiddleware = require('fastboot-express-middleware');"},{"note":"When passing a custom FastBoot instance, import `FastBoot` directly from the `fastboot` package, not from `fastboot-express-middleware`.","symbol":"FastBoot","correct":"const FastBoot = require('fastboot');"}],"quickstart":{"code":"const express = require('express');\nconst fastbootMiddleware = require('fastboot-express-middleware');\nconst path = require('path');\n\n// IMPORTANT: Replace '/path/to/your/ember-app/dist' with the actual path\n// after running 'ember build'. For example, if your Express app is in the\n// root and your Ember app is in a subdirectory named 'my-ember-app',\n// this path might be path.join(__dirname, '..', 'my-ember-app', 'dist');\nconst distPath = process.env.EMBER_APP_DIST_PATH || path.join(__dirname, 'dist'); \n\nlet app = express();\n\n// Serve static assets from the Ember app's 'dist' folder\napp.use(express.static(distPath));\n\n// Apply the FastBoot middleware for all routes\napp.get('/*', fastbootMiddleware(distPath));\n\nconst PORT = process.env.PORT || 3000;\napp.listen(PORT, function () {\n  console.log(`FastBoot app listening on port ${PORT}! Serving from: ${distPath}`);\n});","lang":"javascript","description":"This quickstart sets up a basic Express server that serves static assets from an Ember app's `dist` directory and then uses `fastboot-express-middleware` to render Ember applications on all remaining routes, demonstrating a minimal SSR setup."},"warnings":[{"fix":"Upgrade Node.js to a supported version (12.*, 14.*, or >=16) or pin `fastboot-express-middleware` to a version prior to 3.0.0.","message":"Version 3.0.0 dropped support for Node.js 4, 6, 8, 9, 11, and 13. Ensure your Node.js environment is 12.*, 14.*, or >=16.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Review the changelog for `fastboot@3.1.0` and `ember-cli-fastboot` for any potential incompatibilities with your Ember application. Test thoroughly after upgrading.","message":"Version 3.0.0 updated its internal `fastboot` dependency to `fastboot@3.1.0`. This might introduce breaking changes from the underlying `fastboot` package itself if your Ember app relies on specific older FastBoot behaviors or APIs.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"If you need to customize error responses, handle errors *before* the `fastbootMiddleware` or disable `resilient` mode to allow 500 status codes for render errors.","message":"When `resilient: true` is enabled, errors during rendering will result in an HTTP 200 status code and an empty HTML page. While subsequent error handling middleware will still be called via `next(err)`, you *cannot* alter the HTTP response within these post-FastBoot middleware because FastBoot has already sent a response.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure `ember-cli-fastboot` is installed in your Ember project and run `ember build` before deploying your Express application. Verify `distPath` in your middleware configuration is correct.","message":"For the middleware to function correctly, your Ember application must be built using `ember-cli-fastboot` and the `distPath` option must point to the resulting `dist` directory. This is not a runtime dependency but a prerequisite for your Ember app.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-22T00:00:00.000Z","next_check":"2026-07-21T00:00:00.000Z","problems":[{"fix":"Run `npm install fastboot-express-middleware` or `yarn add fastboot-express-middleware` in your project directory.","cause":"The package `fastboot-express-middleware` is not installed or not resolvable in your project.","error":"Error: Cannot find module 'fastboot-express-middleware'"},{"fix":"Ensure your Ember application has `ember-cli-fastboot` installed and run `ember build`. Then, verify that the `distPath` option in your middleware configuration correctly points to the `dist` folder of your built Ember app.","cause":"The `distPath` provided to the `fastbootMiddleware` function does not point to a valid Ember application build directory, or the Ember application has not been built yet.","error":"ENOENT: no such file or directory, stat '/path/to/dist'"},{"fix":"Ensure you have `const express = require('express');` and `let app = express();` correctly set up before using `app.get` or `app.use`.","cause":"This error indicates that `app` is not an Express application instance, or that `express` was not properly imported/initialized.","error":"TypeError: app.get is not a function"}],"ecosystem":"npm","meta_description":null}