Platforms
Node.js
Run the Node.js example in development, then build and start its production server.
Run the example
Install the current Node.js LTS and Vite+. Create a Node.js project and install its dependencies:
vp create effront -- my-app --platform node
cd my-app
vp install
vp devOpen the local URL printed by Vite. The single page displays Hello, world.
Find the application and server files
The example already contains the host configuration:
| File | Role |
|---|---|
src/entry.effront.tsx | Defines the document layout, one page, and its / route. |
src/entry.rsc.ts | Exports the application's HTTP handler for development and production. |
src/entry.server.ts | Starts the Node.js listener with @effront/server/node and NodeRuntime.runMain. |
vite.config.ts | Registers effront() and effrontServer(). |
package.json | Lists dependencies and the start command. |
Change <h1>Hello, world</h1> in src/entry.effront.tsx to <h1>Hello, Effront!</h1>.
Save the file.
The page updates without a server restart.
Check the production build locally
Stop development. Then run from the generated project:
vp buildThe build puts the server entry in dist/rsc/server.js and generated browser assets in dist/client/assets.
src/entry.server.ts serves those assets at /assets/.
Start the Node.js server
After the build, run from the generated project:
vp run startThe script runs node dist/rsc/server.js.
With PORT and HOST unset, open http://127.0.0.1:3000.
Before you start the server, set PORT and HOST to change the listening address.
For listener and asset options, see the server API reference. See the separate Bun example for that runtime.