{"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.","language":"javascript","status":"active","last_verified":"Tue Apr 21","install":{"commands":["npm install serdev"],"cli":{"name":"serdev","version":null}},"imports":["import * as serdev from 'serdev'","import { listen } from 'serdev'"],"auth":{"required":false,"env_vars":[]},"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.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}