# Node.js

The Node.js adapter builds your application into a standalone Node.js server. This is suitable for deploying to VPS providers (DigitalOcean, Linode), PaaS (Heroku, Railway, Render), or custom infrastructure.

## Usage

The Node adapter ships inside `@neutron-build/core` and is selected at build time via the CLI's `--preset` flag — no separate install needed. For a long-running Node server, use the `docker` preset (which produces a Node `server.mjs` you can run directly without containerizing).

1.  Build with the Docker preset (produces a standalone Node server):
    ```bash
    npx @neutron-build/cli build --preset docker
    ```

2.  Run the generated server:
    ```bash
    node dist/server.mjs
    ```

## `neutron-ts preview` vs. the production artifact

`npx neutron-ts preview` starts a **local** preview server that runs SSR through the
dev toolchain (Vite + your `src/` files). It is convenient for a quick local
check, but it is **not** the artifact you deploy:

- **Preview** needs `src/` and your dev dependencies present, and pulls Vite
  at runtime.
- **The deployed artifact** is the preset-generated entry (e.g.
  `dist/server.mjs` from `--preset docker`), which bundles everything and ships
  **no Vite** — it runs from `dist/` alone.

To validate what actually deploys, build with a preset and run the generated
server (the two commands above) rather than relying on `preview`.
