# Node.js hosting for static builds

> Host static assets produced by Node.js tooling. StaticX does not run long-lived Node servers.

Canonical: https://staticx.site/nodejs-hosting

## Use Node as the build tool

StaticX hosts the static output that Node tooling generates, not the Node process itself.

## Keep dependencies out of public files

Upload dist, build, public, out, or another browser-ready folder, not node_modules or server internals.

## Pair with external backends

If your static frontend calls APIs, host those APIs on a runtime service and keep StaticX focused on the site.

## Publish static output produced by Node.js tooling

Use npm scripts to build files, then deploy only the public browser assets to StaticX.

1. **Run the npm build** — Use the project script that writes HTML, CSS, JavaScript, and assets into a static output folder.
2. **Remove server-only files** — Exclude package caches, private config, server code, and files not meant for visitors.
3. **Deploy static assets** — Upload the output root and publish a new StaticX version for history and rollback.

## Node.js can build the site without serving it.

Many static sites use Node.js only during development: bundling, minifying, generating HTML, or compiling assets.

StaticX fits that model. It receives the generated files and serves them as immutable deployments while any server-side API remains outside the static hosting layer.

## Node.js static output boundaries

- **No long-running process** — StaticX does not run Express servers, queues, scheduled jobs, or WebSocket services.
- **No node_modules upload** — Dependencies are build inputs, not public website assets.
- **API URLs are client config** — Browser calls should target external API endpoints configured safely at build time.

## FAQ

### Can StaticX run my Node.js app?

No. StaticX hosts static files generated by Node tooling. Runtime Node apps need another host.

### Which Node output folder should I upload?

Upload the folder your build script creates for browser assets, commonly dist, build, public, out, or _site.

### Can a Node-based generator deploy through CLI?

Yes. Run the build script, then call the StaticX CLI or API with a scoped token.

### Can Node projects still use StaticX forms?

Yes, when the generated HTML includes StaticX-compatible form markup.

[View on staticx.site](https://staticx.site/nodejs-hosting)
