Deploy a Node.js app in Europe
Express, Hono, Fastify or plain node:http — HostStack builds it from package.json and runs it as an always-on service in the EU, with a managed database a link away.
A Node.js API is the simplest thing to deploy here: HostStack sees package.json, installs your dependencies, runs your build script if you have one, and starts the app with npm start. It does not care which framework is inside — Express, Hono and Fastify deploy the same way, as long as the server listens on the port in PORT.
What HostStack detects and builds
- Node.js is recognised from package.json. With bun.lock, bun.lockb or bunfig.toml — or bun in your commands — it builds on Bun instead.
- pnpm works as the package manager: commands that call it get pnpm installed first, at the version in packageManager when package.json pins one, and pnpm-lock.yaml is in place before the install runs.
- The version comes from .nvmrc, .node-version, .tool-versions, volta.node or engines.node; Bun’s from packageManager, .bun-version or engines.bun. With none, the newest LTS (Node.js) or newest release (Bun).
- The build step is skipped, rather than failed, when package.json has no build script — so a plain JavaScript API needs no build command at all.
- There are no framework-specific presets for Express, Hono or Fastify. What matters is the start command and the port.
- Turn on build.multistage and the image is built in two stages: dev dependencies are pruned after the build, and only the lean tree ships.
| Step | Default when you leave it empty |
|---|---|
| Install | npm install (Bun: bun install) |
| Build | npm run build (skipped if there is no build script) |
| Start | npm start (Bun: bun run start) |
| Port | PORT=3000 unless you set another |
Whatever the start command, the server has to listen on 0.0.0.0 at process.env.PORT — not on localhost, and not on a hard-coded port.
hoststack.yaml for Node.js
Optional. Commit it next to your code and every deploy applies it; leave a key out and the service keeps its dashboard value. It configures a service that already exists — it never creates one. The full schema and hoststack validate are in the docs.
services:
api:
install:
command: npm ci
build:
command: npm run build
multistage: true
start:
command: node dist/server.js
healthCheck:
path: /health
env:
NODE_ENV: productionmultistage prunes devDependencies after the build, so anything the running server imports must be in dependencies. Leave it out if you are not sure.
Database and environment variables
Link a managed Postgres, MySQL, MongoDB or Redis to the service and the next deploy has DATABASE_URL, MONGO_URL or REDIS_URL set — the names pg, Prisma, Drizzle, mongoose and ioredis already look for.
hoststack db create --project prj_... --name app-db --engine postgres --plan micro
hoststack db link db_... --service svc_...
hoststack db create --project prj_... --name cache --engine redis
hoststack db link db_... --service svc_...Secrets belong on the service, not in the file — see environment variables and databases.
Deploy Node.js step by step
- 1Make the server listen on process.env.PORT and host 0.0.0.0.
- 2Create a web service from your repository, in the dashboard or with hoststack services create --name api --type web_service --project prj_... --repo acme/api.
- 3Commit the hoststack.yaml above with your own start command and health-check path.
- 4Create a managed database and link it to the service; DATABASE_URL or REDIS_URL is injected on the next deploy.
- 5Set secrets with hoststack env set svc_... KEY=value --secret, and migrations with --pre-deploy-command.
- 6Push to deploy. Every later push to the branch deploys again, with zero downtime.
Hosted in Europe, by a European company
An API usually holds the personal data: accounts, orders, the request logs with IP addresses. Running it — and the database it talks to — on an EU-incorporated platform keeps that whole path in one jurisdiction, with one data processing agreement.
Every service, database and backup runs in Helsinki, Finland, on Hetzner, and HostStack is operated by MICCI, a Danish company — so the US CLOUD Act has no hold on it, the GDPR data processing agreement is signed at signup on every plan, and the invoice is in EUR. Why that differs from a US platform's EU region is on EU data residency.
Things that catch people out
Fastify listens on localhost by default.
Call fastify.listen({ port: Number(process.env.PORT), host: "0.0.0.0" }). Without the host, the server never answers the health check and the deploy fails while the old version keeps serving. Express’s app.listen(port) already listens on every interface.
Hono needs a server adapter on Node.js.
On Node.js, serve it with @hono/node-server and pass port: Number(process.env.PORT). On Bun, export { port: process.env.PORT, fetch: app.fetch } from the entry file.
The root filesystem is read-only.
Write temporary files to /tmp and anything that must survive a deploy to a persistent disk. Uploads written next to the code fail with EROFS.
Frequently asked questions
Which Node.js frameworks can I deploy on HostStack?
Any that runs as a server process: Express, Hono, Fastify, Koa, NestJS, AdonisJS or node:http on its own. HostStack builds from package.json and runs your start command; it needs no framework-specific configuration, only a server listening on 0.0.0.0 at the port in PORT.
Does HostStack support Bun?
Yes. A repo with bun.lock, bun.lockb or bunfig.toml builds on the official Bun image, with bun install, bun run build and bun run start as defaults, and the Bun version from packageManager, .bun-version or engines.bun.
Is there a free tier for Node.js hosting in Europe?
Yes: one Nano service (256 MB) and one Starter Postgres, with no card and no end date. A free Nano sleeps after 60 minutes without traffic and wakes on the next request. Paid services start at €1/month for Pico (128 MB) and stay on.
Can I run background workers and cron jobs next to the API?
Yes. Create a Worker service from the same repo with its own start command, or a Cron Job service with a schedule. They share the project’s private network and can link the same database.
Other stacks
All guides are on the deploy guides index. Moving an existing Node.js app? The Heroku, Render, Railway and Fly.io guides have the cutover order.