
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
dx-server-js
Advanced tools
A high-performance, lightweight development/production server and build tool designed for modern frontend applications. It provides essential developer experience (DX) features out of the box, including hot-reloading, Single Page Application (SPA) routing
DX Server is a high-performance, lightweight development/production server and build tool designed for modern frontend applications. It provides essential developer experience (DX) features out of the box, including hot-reloading, Single Page Application (SPA) routing, automatic SSL generation, and a unique Build Ingestion system to monitor your build processes directly from the browser.
index.html automatically for client-side non static asset routes.stdout directly to DX Server. It analyzes the logs to show real-time build states (compiling, success, error) in the browser.mkcert.console.error (for better object inspection) and enforce global fetch timeouts (preventing browser freezes during reloads or infinite loops)./dx-lang) to update translation JSON files dynamically.You can install DX Server via NPM:
npm install dx-server-js
# or
# as a dev dependency in your project:
npm install -D dx-server-js
Run the server from your project root (defaults to serving the www folder on port 80):
npx dx-server-js --dev
| Flag | Description |
|---|---|
--dev | (Default) Enables hot-reload, caching disabled, and activates the /dx-lang endpoint. |
--prod | Disables hot-reload and lang endpoints. Enables gzip compression and static file caching. |
--built | Enables Build Ingestion mode to monitor another process's stdout piped into DX Server. |
--ingest | Enables only ingestion (does not start the HTTP server). Useful when combined with --watch-command. |
| Flag | Default | Description |
|---|---|---|
--port <number> | 80 / 443 | Set the server port. Defaults to 443 if --ssl is enabled, otherwise 80. |
--root <path> | cwd() | Set the project root directory. |
--public <path> | www | Set the public folder to serve static files from. |
--lang <path> | lang | Set the directory for saving translation JSON files. |
--network <ip> | :: | Bind to a specific network interface (e.g., 0.0.0.0 for local network access). |
--silent | false | Suppresses non-critical terminal logs (info/warn). |
--no-kill | false | Disables the automatic port-killing feature. Throws an error if the port is busy. |
--cache <ms> | 86400000 | Set maxAge (in ms) for static files caching. Note: This is automatically forced to 0 in --dev mode to prevent stale assets. |
--fallback <path> | 404.html | Define a custom HTML fallback file to be served (with a 404 status) when a static asset is not found. By default it is served from the public folder. |
--version | - | Prints the current DX Server version and exits. |
--help | - | Prints the list of available server modes and options. |
| Flag | Description |
|---|---|
--no-ssl | (Default) Runs the server over HTTP. |
--ssl | Enables HTTPS. Automatically generates self-signed certificates using mkcert if custom certs are not provided. |
--cert <path> | Path to a custom SSL .crt file (Requires --ssl). |
--key <path> | Path to a custom SSL .key file (Requires --ssl). |
| Flag | Default | Description |
|---|---|---|
--watch <path> | src | Directory to observe for hot-reloading and command execution. |
--watch-command <cmd> | - | CLI command to execute when files in the watch folder change. |
--watch-command-timeout <ms> | 5000 | Debounce timeout (in ms) before executing the watch command. |
--watch-depth <number> | 5 | Maximum subdirectory depth the watcher will traverse. |
--watch-ignore <string> | node_modules, .* | Comma-separated list of files/folders/regex to ignore. |
--shell | false | Executes the --watch-command in shell mode. |
--built)| Flag | Default | Description |
|---|---|---|
--built-confirm-keywords <str> | - | Comma-separated keywords to identify a successful build completion. |
--built-error-keywords <str> | ERROR, bundle generation failed | Comma-separated keywords to identify build errors. |
--ingest-limit <bytes> | 1048576 (1MB) | Maximum byte limit of stdout chunks retained for analysis. |
| Flag | Default | Description |
|---|---|---|
--frontend | false | Injects polyfills and patches fetch and console.error into the client. |
--frontend-fetch-timeout <ms> | 30000 | Timeout (in ms) for the injected fetch interceptor. |
stdout)DX Server can read the output of your bundler (Webpack, Vite, Esbuild, etc.) to understand the state of your build. If an error occurs during compilation, DX Server will catch it via regex/keywords and display an error overlay directly in your browser.
Example:
# Pipe your bundler's watch mode into DX Server
npm run build:watch | npx dx-server-js --built --built-error-keywords "SyntaxError, Failed to compile"
How it works: The server buffers the stdin up to the --ingest-limit. It scans for error keywords. If found, it updates the internal state to error and notifies the connected browsers via SSE.
--frontend)When enabled, DX Server injects a lightweight script into your index.html that provides:
AbortController to all global fetch requests. If a request exceeds --frontend-fetch-timeout, it is aborted. This prevents the browser from freezing during browser reloads or development if you accidentally create an infinite fetch loop.console.error to stringify complex objects. This is highly useful for debugging on mobile devices or environments with limited object inspection capabilities.Object.hasOwn, Promise.prototype.finally, and AbortController.In --dev mode, DX Server exposes a POST /dx-lang endpoint. This allows your frontend application (e.g., an admin panel or translation UI) to save JSON translation files directly to the disk.
Security Mechanism: To prevent accidental data loss, the server compares the incoming JSON with the existing file. It will reject (400 Bad Request) the update if the new JSON contains fewer keys than the original file, ensuring you don't accidentally overwrite and delete translations.
Frontend Fetch Example:
fetch('http://localhost/dx-lang', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
dir: 'en', // Target language sub-folder
code: 'navbar', // Filename (will become "en/navbar.json")
keys: { // The JSON content to save
"welcome": "Welcome to my app!"
}
})
});
Additional Note: This endpoint features strict Path-Traversal protection. It also implements an asynchronous Mutex lock to prevent Race Conditions if multiple keys are saved simultaneously, guaranteeing zero data corruption.
Payload Limit: To prevent memory abuse, the JSON body payload is strictly limited to 1MB by default (equivalent to roughly 1,000 large key-value pairs).
DX Server is optimized for Single Page Applications with a highly performant in-memory cache system. When a request hits the server, a custom middleware evaluates it before serving static files:
Accept header.image/*, css, js, json), it bypasses the interceptor and continues to express.static. If the asset is missing, it serves the --fallback file (e.g., 404.html) with a 404 Not Found status.html (a client-side route navigation), it intercepts the request.index.html, injects the hot-reload script, and caches the result in memory. It will serve this cached version instantly on subsequent requests, only re-reading the file if its modification time changes.DX Server includes an intelligent feature for custom fallbacks: it automatically detects the HTTP status code from your filename.
If you name your fallback file with a valid HTTP status code (e.g., 404.html, 403.html, or 500.html), the server will parse that number and use it as the HTTP response status. This allows you to serve semantic error pages automatically without any extra configuration.
404.html → Server responds with 404 Not Found.403.html → Server responds with 403 Forbidden.200.html → Server responds with 200 OK (useful for specific SPA configurations).When running, DX Server creates a dx-server folder in your project root to manage its internal state:
dx-server/self-signed-certificates/: Stores the cert.crt and cert.key generated by mkcert.dx-server/_built.tmp: Tracks the current build state (compilation, built, error).dx-server/_error.tmp: Stores the latest build error message to serve to the browser.dx-server/_browserOpen.tmp: Prevents opening multiple browser tabs on rapid restarts.Note: It is recommended to add dx-server/ to your .gitignore.
--network): By default, DX Server binds to :: (IPv6 Unspecified), which usually covers both IPv4 and IPv6 on modern OS. If you encounter network availability errors (EADDRNOTAVAIL), explicitly set it to IPv4 using --network 0.0.0.0.process.cwd()) as the root. If you need to run it from a different folder, use the --root ./path/to/project argument to ensure the www, src, and lang folders are resolved correctly.sudo privileges. If you don't want to run as root, use a higher port (e.g., --port 8080).--no-kill if you want traditional safe behavior.--dev mode exposes endpoints that allow disk writes (/dx-lang). Never use --dev in a publicly exposed network or a production environment. Always use --prod for deployments.MIT License.
Copyright © 2026 OKZGN
FAQs
A high-performance, lightweight development/production server and build tool designed for modern frontend applications. It provides essential developer experience (DX) features out of the box, including hot-reloading, Single Page Application (SPA) routing
We found that dx-server-js demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.