{"id":17418,"library":"broadway","title":"Broadway Application Extensibility","description":"Broadway is a lightweight library designed for adding extensibility and hookable middleware customization to server applications. The current stable version is 4.1.0, though it was last published over eight years ago, indicating it is an abandoned project with no active release cadence. Its core differentiator is its minimal footprint and generic 'hook' mechanism, powered by the `understudy` library, which allows developers to inject custom logic into application lifecycle events and middleware chains. It is primarily intended for use with CommonJS modules and older Node.js environments (specifically requiring Node.js 8 or higher). While it demonstrates integration with frameworks like Express, it offers a foundational, unopinionated approach to modular application design through its `mixin` and `perform` capabilities.","status":"abandoned","version":"4.1.0","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/flatiron/broadway","tags":["javascript"],"install":[{"cmd":"npm install broadway","lang":"bash","label":"npm"},{"cmd":"yarn add broadway","lang":"bash","label":"yarn"},{"cmd":"pnpm add broadway","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Provides the generic hook mechanism for 'perform' and 'before' functions.","package":"understudy","optional":false},{"reason":"Used internally, likely for logging, though not explicitly shown in quickstart examples.","package":"winston","optional":false}],"imports":[{"note":"Broadway is a CommonJS-only library, primarily used with `require()`. Attempting to use ESM `import` will lead to runtime errors.","wrong":"import App from 'broadway';","symbol":"App","correct":"const App = require('broadway');"},{"note":"Methods like `mixin`, `preboot`, `use`, `start`, `before`, and `perform` are instance methods of an `App` object, not static methods on the `broadway` module itself.","wrong":"broadway.mixin(express());","symbol":"App instance methods (e.g., mixin, preboot, start)","correct":"app.mixin(express());"}],"quickstart":{"code":"const express = require('express');\nconst App = require('broadway');\n\n// Create a new base App instance, configuring it for an HTTP port.\n// Mix in Express functionality directly during instantiation.\nconst app = new App({ http: 8080 }, express());\n\n// Register a preboot hook to run logic before the application fully starts.\napp.preboot(function (appInstance, options, next) {\n  console.log('Broadway application is starting up...');\n  // Simulate an async operation\n  setTimeout(() => {\n    console.log('Preboot hook finished.');\n    next();\n  }, 100);\n});\n\n// Define a basic route using the mixed-in Express functionality.\napp.use((req, res, next) => {\n  if (req.url === '/') {\n    res.end('Hello from Broadway powered by Express!');\n  } else {\n    next();\n  }\n});\n\napp.use((req, res) => {\n  res.writeHead(404, { 'Content-Type': 'text/plain' });\n  res.end('404 Not Found');\n});\n\n// Start the application and begin listening for HTTP requests.\napp.start(function (err) {\n  if (err) {\n    console.error('Error on startup: %s', err.message);\n    return process.exit(1);\n  }\n\n  console.log('Listening over HTTP on port %s', this.given.http);\n});\n\n// To run this, save as app.js and run `node app.js`. Make sure express is installed (`npm i express broadway`).\n","lang":"javascript","description":"This quickstart demonstrates initializing a Broadway `App`, mixing in Express.js, registering a `preboot` hook, defining basic Express routes, and starting the HTTP server."},"warnings":[{"fix":"Consider migrating to a modern, actively maintained application framework or extensibility library. If forced to use Broadway, ensure thorough testing in your specific Node.js environment and be aware of potential security risks.","message":"The `broadway` package requires Node.js >= 8, which is an extremely old and End-of-Life (EOL) version of Node.js. Using this package with modern Node.js versions may lead to compatibility issues or security vulnerabilities due to its abandoned status and outdated dependencies.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Avoid using `broadway` for new projects. For existing projects, evaluate the risk of using unmaintained software and plan for migration to an actively supported alternative.","message":"Broadway is an abandoned project, with no updates in over eight years. This means there will be no future bug fixes, security patches, or feature enhancements. Dependencies may also be outdated and contain known vulnerabilities.","severity":"gotcha","affected_versions":">=4.1.0"},{"fix":"Always use `const App = require('broadway');` to import Broadway. If your project is ESM-first, you might need to use a CommonJS wrapper or reconsider using this library.","message":"The package is published exclusively as a CommonJS module. It does not provide ESM (ECMAScript Module) exports, and attempting to `import` it will result in `ReferenceError: require is not defined` in ESM-only contexts or other import resolution errors.","severity":"gotcha","affected_versions":">=4.0.0"}],"env_vars":null,"last_verified":"2026-04-22T00:00:00.000Z","next_check":"2026-07-21T00:00:00.000Z","problems":[{"fix":"Ensure you are using CommonJS `require` syntax: `const App = require('broadway');`.","cause":"Attempting to import `broadway` using ESM syntax (`import App from 'broadway';`) in a context where `require` is not globally available (e.g., in an ESM module without a compatibility layer).","error":"ReferenceError: require is not defined"},{"fix":"Confirm your import statement is `const App = require('broadway');` and you are instantiating it as `new App(...)`.","cause":"This error can occur if you're trying to instantiate `broadway` directly (e.g., `new broadway()`) instead of the exported `App` class, or if the import failed.","error":"TypeError: App is not a constructor"},{"fix":"Run `npm install broadway` or `yarn add broadway` in your project directory.","cause":"The `broadway` package has not been installed or is not accessible in the current project's `node_modules`.","error":"Error: Cannot find module 'broadway'"}],"ecosystem":"npm","meta_description":null}