Node.js
This is an Early Access feature. See the Early Access documentation for more information.
Posit Connect can run Express, Fastify, and other Node.js HTTP servers. Before publishers deploy Node.js content, an administrator must enable Node.js support. See the Node.js section of the Admin Guide for setup instructions, supported versions, and platform requirements.
Deploying
Use the rsconnect command from the rsconnect-python package (version 1.29.0 or later) to deploy Node.js content.
Terminal
rsconnect deploy nodejs -n myServer ./MyAppPath/The bundle directory must contain both package.json and package-lock.json. Connect installs the production dependencies from package-lock.json during the environment build.
Entry point
The entry point is the JavaScript or TypeScript file that starts your HTTP server. rsconnect-python auto-detects the entry point from package.json in this order:
The
mainfield.The
scripts.startfield, when it follows the patternnode <file>.A common filename in the bundle root:
app.js,index.js,server.js, ormain.js, including their.tsequivalents.
To deploy from a different file, pass --entrypoint:
Terminal
rsconnect deploy nodejs -n myServer --entrypoint src/server.js ./MyAppPath/TypeScript
Connect runs TypeScript entry points natively without a build step. Deploy your .ts entry point directly.
Example
A minimal Express API:
app.js
const express = require('express');
const app = express();
const port = process.env.PORT || 3000;
app.get('/', (req, res) => {
res.json({ message: 'Hello from Posit Connect' });
});
app.listen(port);package.json
{
"name": "my-express-app",
"version": "1.0.0",
"main": "app.js",
"engines": {
"node": ">=22.18.0"
},
"dependencies": {
"express": "^4.18.0"
}
}Run the following to deploy:
Terminal
npm install
rsconnect deploy nodejs -n myServer ./