Node.js, Next.js and NestJS
Deploy Express, Fastify, Next.js, Nuxt, NestJS or any Node.js app.
What we detect
A package.json at your app's root makes it a Node.js app. We recognise Next.js, Nuxt, NestJS, Express, Fastify, Koa and Hono from your dependencies.
- Install:
npm,yarnorpnpm, from your lockfile. - Build: your
buildscript, if there is one. - Start: your
startscript. - Node version: the one in
.nvmrc,.node-versionorenginesinpackage.json; otherwise Node 22.
Listen on PORT
const express = require("express");
const app = express();
app.get("/", (req, res) => res.send("Hello from DockHosting"));
const port = process.env.PORT || 3000;
app.listen(port, "0.0.0.0", () => console.log(`listening on ${port}`));{
"scripts": {
"start": "node server.js"
}
}Next.js
Next.js works as-is: we run next build, then next start, which reads PORT.
{
"scripts": {
"build": "next build",
"start": "next start"
}
}NEXT_PUBLIC_ variables are baked in at build time
Set NEXT_PUBLIC_* variables before deploying. After changing one, redeploy so the build picks it up.
NestJS
NestJS builds with nest build. Listen on PORT in main.ts:
const app = await NestFactory.create(AppModule);
await app.listen(process.env.PORT ?? 3000, "0.0.0.0");{
"scripts": {
"build": "nest build",
"start": "node dist/main"
}
}Databases
Link a database and read DATABASE_URL: Prisma, Drizzle, Sequelize, TypeORM, Mongoose and pg all accept a connection URL. For MongoDB, read MONGODB_URI; for Redis, REDIS_URL.
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}Run migrations on start
Prisma: start with npx prisma migrate deploy && node server.js (in the start script, or the start command in Settings).
