Skip to content
Next.js deploy guide

Next.js hosting in Europe

Run Next.js as an always-on server on EU infrastructure. HostStack detects it, builds it, and runs next start in Helsinki — with managed Postgres next to it.

Next.js runs well as one long-lived Node.js process: server components, route handlers, server actions, streaming, ISR and middleware all work under next start. HostStack runs it that way, as a service with no execution time limit, in Helsinki, under a Danish company — so the app, its database and its logs stay in the EU and the invoice comes in EUR.

What HostStack detects and builds

  • Next.js is recognised from a next dependency in package.json, and builds on Node.js — or on Bun when the repo has bun.lock, bun.lockb or bunfig.toml.
  • The package manager follows your lockfile — bun.lock for Bun, pnpm-lock.yaml for pnpm, yarn.lock for Yarn, package-lock.json for npm — and install, build and start all use it. pnpm is installed into the image for you, at the version in packageManager when package.json pins one.
  • The Node.js version comes from .nvmrc, .node-version, .tool-versions, volta.node or engines.node, in that order; with none, the newest LTS.
  • You do not need output: "standalone". The plain next build and next start run as they are.
  • Dependencies are installed in their own image layer, so a deploy that does not touch package.json or the lockfile reuses them.
StepDefault when you leave it empty
Installnpm install (or pnpm / yarn / bun install)
Buildnpm run build
Startnpm run start
PortPORT=3000 — next start reads it

Swap npm for pnpm, yarn or bun when that is your lockfile. The build step is skipped, not failed, if package.json has no build script.

hoststack.yaml for Next.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.

hoststack.yaml
services:
  web:
    install:
      command: npm ci
    build:
      command: npm run build
    start:
      command: npm run start
    healthCheck:
      path: /
    env:
      NEXT_TELEMETRY_DISABLED: "1"

The key under services is the service’s name; with one entry, it is used whatever the service is called. Values in env reach the running server, not next build — so NEXT_PUBLIC_* variables go on the service instead, where they are passed to the build.

Database and environment variables

Create a managed Postgres in the same project and link it. The link injects DATABASE_URL on the next deploy — the name Prisma and Drizzle read by default — and the connection never leaves the project’s private network.

bash
hoststack db create --project prj_... --name app-db --engine postgres --plan micro
hoststack db link db_... --service svc_...
hoststack env set svc_... AUTH_SECRET=... --secret
hoststack services update svc_... --pre-deploy-command "npx prisma migrate deploy"

Secrets belong on the service, not in the file — see environment variables and databases.

Deploy Next.js step by step

  1. 1Create a web service from your repository, in the dashboard or with hoststack services create --name web --type web_service --project prj_... --repo acme/app.
  2. 2Commit the hoststack.yaml above, so the install, build and start commands live in Git.
  3. 3Create a managed Postgres and link it to the service, which injects DATABASE_URL on the next deploy.
  4. 4Set secrets such as AUTH_SECRET with hoststack env set --secret, and put NEXT_PUBLIC_* variables on the service so they reach next build.
  5. 5Set your migrations as the pre-deploy command, for example npx prisma migrate deploy.
  6. 6Push. The service is live on a hoststack.dev URL with HTTPS; add your own domain when you are ready.

Hosted in Europe, by a European company

For a European SaaS on Next.js, the parts that matter for GDPR — the server rendering your pages, the database behind it, the logs with IP addresses in them — all sit in one EU region with one processor, rather than across a US platform’s edge network.

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

NEXT_PUBLIC_* variables are fixed at build time.

next build inlines them into the client bundle. Set them on the service with the default Build + Runtime scope; a variable marked secret, or one written under env in hoststack.yaml, never reaches the build.

Have a Dockerfile? It is used when the service is created.

A service created from a repo with a Dockerfile at its root, and with no runtime or commands chosen, builds that Dockerfile. An existing service keeps building the way it always has: run hoststack services update svc_... --dockerfile-path Dockerfile to switch it.

ISR and the image cache live in .next/cache.

The container’s root filesystem is read-only, so Next.js cannot write there. Mount a persistent disk at /app/.next/cache to keep regenerated pages and optimised images across deploys, or use a Redis cache handler if you run more than one instance.

Frequently asked questions

Can I host Next.js in Europe without Vercel?

Yes. Next.js runs as a normal Node.js server with next start, and that is how HostStack runs it: an always-on service in Helsinki, Finland, operated by a Danish company. App Router, server actions, route handlers, streaming, ISR and middleware all work; middleware runs in the region rather than at a global edge.

Do I need output: "standalone" or a Dockerfile?

No. HostStack detects Next.js from package.json and runs next build and next start with your package manager. Standalone output and your own Dockerfile both work if you prefer them — a root Dockerfile is picked up when you create the service without choosing a runtime or commands; for an existing service, set its Dockerfile path.

How much does it cost to host a Next.js app?

The free tier runs one Nano service (256 MB, sleeps after 60 minutes without traffic) and one Starter Postgres with no card. Paid services start at €1/month; a Next.js app with real traffic is comfortable on Small (1 GB, €10/month), and managed Postgres starts at €4/month. 200 GB of bandwidth per team is included.

Where is my Next.js app hosted?

In Hetzner’s Helsinki data centre in Finland, region eu-central-1, together with its database and backups. HostStack is operated by MICCI, a company registered in Denmark, and the GDPR data processing agreement is part of signup on every plan.

Other stacks

All guides are on the deploy guides index. Moving an existing Next.js app? The Vercel migration guide has the cutover order.

Deploy your Next.js app

Free tier, no card: one service and one Postgres, in the EU.

Essential cookies only — for login sessions. No tracking. Details