Deploy previews for Express & Node.js apps
Push a branch, get a live preview URL. PreviewDrop installs your dependencies, runs your Node server as a real process, and posts the link to the pull request, usually within a couple of minutes.
npm ci and boots node server.js behind a TLS-terminated subdomain. Because it’s an always-on process, your websockets, SSE streams, in-memory caches and persistent DB pools all behave exactly as they do locally.What the build needs to do
You don't write this. PreviewDrop detects Expressfrom your repo and builds the container for you — a Dockerfile in your repo is not used. The reference below shows the install, build and start steps a working Express image needs. If detection gets one wrong, set the matching Install, Build or Start command in Project Settings. Your app must listen on $PORT.
Reference (not read by PreviewDrop)FROM node:22-slim WORKDIR /app COPY package*.json ./ RUN npm ci --omit=dev COPY . . # If you have a build step (TypeScript / bundler), run it here: # RUN npm run build -> then CMD ["node", "dist/server.js"] EXPOSE 3000 CMD ["node", "server.js"]
Environment variables
Set these in the Variables tab of your PreviewDrop project. They're encrypted at rest and injected into every preview container at start.
| Variable | Example value | Note |
|---|---|---|
| PORT | 3000 | PreviewDrop injects this. Read it with process.env.PORT and listen on it. |
| NODE_ENV | production | Enables Express production optimisations and disables verbose error pages. |
| DATABASE_URL | postgres://user:pass@host:5432/db | Point at a shared dev DB, or omit for stateless previews. |
Common gotchas
Listen on 0.0.0.0 and read process.env.PORT
app.listen(process.env.PORT || 3000, '0.0.0.0'). Omitting the host can bind to localhost inside the container, which the proxy can’t reach — the preview will 502.Commit your lockfile
npm ci requires a committed package-lock.json and fails without one. If you don’t keep a lockfile, set the Install command in Project Settings to npm install --omit=dev. (pnpm / yarn work too — use their install + lockfile.)Don’t commit node_modules
node_modules in .gitignore so the build installs fresh dependencies. Native modules (bcrypt, sharp, better-sqlite3) compile per-platform — a macOS/Windows node_modules will crash inside the Linux container.Run your build step
npm run build and point the Start command at the compiled output (node dist/server.js). Don’t rely on ts-node in previews — it’s slower and pulls dev deps you excluded with --omit=dev.Why not Vercel or Netlify?
node server.js as a genuine always-on process — the same way it runs in production.Preview your Express app in 5 minutes
Connect a repo, push a branch, get a URL. No credit card, no trial clock.
Start free