{"id":15820,"library":"serdev","title":"Bundler-Independent Node.js Dev Server","description":"Serdev is a Node.js development server designed for complex project structures, particularly monorepos, where multiple components might have disparate build processes. It differentiates itself by being bundler-agnostic, allowing users to integrate various build tools like esbuild, Webpack, Rust's Cargo, or custom Node.js scripts. The server watches specified directories for changes, triggering rebuilds of components and serving the generated artifacts or proxying to embedded servers. It aims to streamline development workflows by consolidating diverse build and serving requirements into a single configuration. As of version 0.1.2, it is in a very early stage of development, implying potential instability and rapid evolution, without a specified regular release cadence. Its key strength lies in its flexibility to manage heterogeneous build ecosystems.","status":"active","version":"0.1.2","language":"javascript","source_language":"en","source_url":"https://github.com/jsscheller/serdev","tags":["javascript"],"install":[{"cmd":"npm install serdev","lang":"bash","label":"npm"},{"cmd":"yarn add serdev","lang":"bash","label":"yarn"},{"cmd":"pnpm add serdev","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The primary import pattern for accessing all serdev functionalities as a namespace. CommonJS `require` is also supported.","wrong":"const serdev = require('serdev')","symbol":"serdev","correct":"import * as serdev from 'serdev'"},{"note":"While `import * as serdev` is shown, `listen` is the main function and could be destructured if preferred, assuming it's a named export.","symbol":"listen","correct":"import { listen } from 'serdev'"}],"quickstart":{"code":"import * as serdev from \"serdev\";\n\nserdev.listen({\n  env: {\n    RUST_BACKTRACE: \"1\"\n  },\n  headers: {\n    \"Cross-Origin-Opener-Policy\": \"same-origin\",\n    \"Cross-Origin-Embedder-Policy\": \"require-corp\"\n  },\n  components: {\n    ui: {\n      dir: \"./ui\",\n      build: \"esbuild --entry-points=src/index.ts --outdir=out --bundle --write\",\n      watch: [\"src\"]\n    },\n    website: {\n      dir: \"./website\",\n      build: \"node scripts/build.js\",\n      watch: [\"src\"],\n      deps: [\"ui\"]\n    },\n    app: {\n      dir: \"./app\",\n      build: \"cargo build --target=wasm32-unknown-unknown\",\n      watch: [\"src\"]\n    },\n    api: {\n      dir: \"./api\",\n      build: \"cargo build --features=dev\",\n      start: \"target/debug/blob\",\n      port: 8001,\n      watch: [\"src\"]\n    },\n    cdn: {\n      dir: \"./cdn\",\n      start: \"node server.js\",\n      port: 8002\n    }\n  },\n  routes: {\n    \"/favicon.ico\": \"./website/favicon.ico\",\n    \"/app.js\": [\"app\", \"./app/out/index.js\"],\n    \"/api/*\": [\"api\"],\n    \"/assets/*rest\": (x) => `./assets/${x.rest}`\n  }\n});","lang":"javascript","description":"This example configures `serdev` to manage and serve multiple distinct components within a monorepo, including custom build steps for TypeScript, Rust/WASM, and Node.js servers, alongside static file serving and API proxying, all with automatic rebuilds on file changes."},"warnings":[{"fix":"Currently, there is no known workaround mentioned. Users on Windows should consider alternative development servers or use a Linux/macOS environment (e.g., WSL2) for `serdev` development.","message":"Serdev relies on process groups to manage and terminate child processes, which are not supported on Windows operating systems. This limitation means the server may not function correctly or reliably on Windows environments, particularly concerning the lifecycle management of spawned build tools and component servers.","severity":"breaking","affected_versions":">=0.1.0"},{"fix":"Pin to exact versions in `package.json` (`\"serdev\": \"0.1.2\"`) to prevent unexpected updates. Regularly review GitHub releases or changelogs for breaking changes when upgrading.","message":"As of version 0.1.2, `serdev` is in early development. This implies that APIs, configurations, and internal behaviors are subject to change without strict adherence to semantic versioning for minor or patch releases, potentially introducing breaking changes unexpectedly.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Verify that your `PATH` environment variable includes directories containing required executables. For `npm` installed binaries, consider using `npx` or explicit paths to `node_modules/.bin` within your build commands.","message":"Component build scripts and server start commands run as child processes. Ensure that all necessary binaries (e.g., `esbuild`, `cargo`, `node`) are available in the system's PATH or specified with full paths within the `build` and `start` commands in the `serdev` configuration.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-04-21T00:00:00.000Z","next_check":"2026-07-20T00:00:00.000Z","problems":[{"fix":"Check the console output for detailed errors from the failing build/start script. Ensure the command is correct, dependencies are installed (e.g., `npm install` in component directories), and paths are resolved correctly.","cause":"A component's `build` or `start` script (e.g., `esbuild`, `cargo`, `node scripts/build.js`) encountered an error during execution.","error":"Error: Command failed with exit code 1"},{"fix":"Identify the process using the port (`lsof -i :<port>` on Unix/macOS or `netstat -ano | findstr :<port>` on Windows) and terminate it, or change the `port` configuration in `serdev` for the conflicting component or for `serdev`'s main listening port.","cause":"`serdev` or one of its configured component servers is attempting to listen on a port that is already occupied by another process.","error":"Address already in use :::<port>"},{"fix":"Review your `routes` configuration in `serdev.listen()` to ensure it correctly maps paths to files or components. Verify that build processes for components linked to routes successfully produce the expected output files and paths.","cause":"The requested URL does not match any of the configured `routes` in `serdev`, or a component artifact specified in a route does not exist after its build step.","error":"404 Not Found"}],"ecosystem":"npm"}