Node & Next.js apps
The Node plan runs your JavaScript or TypeScript app and publishes it on its own HTTPS address.
Listen on the right port
Section titled “Listen on the right port”Your app must listen on the port in the SERVER_PORT environment variable, on all interfaces:
import http from 'node:http';
const port = Number(process.env.SERVER_PORT);http .createServer((req, res) => res.end('Hello from Fleeq\n')) .listen(port, '0.0.0.0', () => console.log(`listening on ${port}`));Express: app.listen(process.env.SERVER_PORT, '0.0.0.0'). An app listening on 3000 or localhost isn’t reachable.
What runs, and how
Section titled “What runs, and how”On every start the runtime:
- installs any extra packages listed in
NODE_PACKAGES; - runs
npm installif there’s apackage.json; - starts
MAIN_FILE(defaultindex.js) withnode, or withts-node --esmif it ends in.ts.
Set MAIN_FILE in Startup if your entry point is elsewhere (dist/server.js, src/index.ts).
Next.js
Section titled “Next.js”Build on your computer or in CI, upload the project including .next/, and start Next’s server from a small entry file:
import { spawn } from 'node:child_process';
spawn('npx', ['next', 'start', '-H', '0.0.0.0', '-p', process.env.SERVER_PORT], { stdio: 'inherit' });Set MAIN_FILE to start.js. A plain next build on the server works too, but uses much of the plan’s memory while it runs.
Deploying from Git
Section titled “Deploying from Git”Instead of uploading files, let the server clone your repository:
| Variable | Set to |
|---|---|
USER_UPLOAD |
0 — install from Git instead of your uploads |
GIT_ADDRESS |
your repository’s HTTPS URL |
BRANCH |
the branch to deploy (default branch if empty) |
USERNAME, ACCESS_TOKEN |
for a private repository: a user and a personal access token with read access |
AUTO_UPDATE |
1 to git pull on every start |
Then Settings → Reinstall server. With AUTO_UPDATE on, deploying a new version is a Restart.
Configuration and secrets
Section titled “Configuration and secrets”Put settings in a .env file next to your code (in Files) and load it when your app starts — with the dotenv package (import 'dotenv/config'), or Node’s built-in process.loadEnvFile(). Don’t commit .env to Git.
NODE_ARGS is appended after your start file, so it reaches your app as process.argv — it can’t pass flags to Node itself.
Everything your app prints goes to the Console. If the app crashes, the last lines there say why.