App hosting ยท Next.js

Next.js hosting on a plain Node.js server

Push the repository, let the build run, give the app an address. Next.js is built with next build on every deploy and served with next start; a static export is served as files. No platform lock-in and no per-request pricing.

Free app
256 MB, Node.js, Python, Go, Java and more
Address
https://name.fadehost.app, sleeps when idle on free
Paid
from $2/mo or $20/yr for 1 GB, with an always-on address included
Regions
France, Montreal, Oregon, Singapore

What the repository needs

  1. The standard scripts: "build": "next build" and "start": "next start -p $PORT -H 0.0.0.0".
  2. Nothing committed from .next: the build runs on deploy because the start script's output is not in the repository.
  3. Server-side secrets in environment variables; NEXT_PUBLIC_* values are baked in at build time, so they belong there too.

Memory for the build

next build is the heavy part. A small app builds within the free tier's memory; an app with many pages or a large dependency tree is more comfortable building on Starter with 1 GB. The console shows the build's own output, so a failed build is never a mystery.

Static export, when you do not need a server

With output: "export" the build writes out. Set the app's Language to static and that folder is served as files, with no Node process at all: less memory, instant restarts. Route handlers, server actions and ISR need the Node server, so keep next start for those.

Frequently asked questions

Does image optimization work?

The default loader runs on the Node server and works. For a static export, use a custom loader or unoptimized images, as Next.js requires anywhere without a server.

Which port does the app listen on?

The PORT environment variable, 8080 by default, on 0.0.0.0. A server bound to 127.0.0.1 answers only itself and the web address gets nothing.

How does the public address work?

Give the app a web address in the panel and it is served at https://name.fadehost.app behind the Cloudflare proxy with a certificate. It comes with the plan on every tier. On the free tier the address sleeps when nobody has used it for a while and wakes on the next request; on a paid tier it stays awake. Your own domain can point at it.

What happens on a deploy?

The repository is cloned at your branch, dependencies install, the build runs when there is one, the app starts. With auto-deploy on, every push does the same. The live console shows each step; a failed one is explained in plain words.

Where do files and databases live?

Files written under /data survive redeploys; everything else is rebuilt from the repository. Every paid app includes a one-click MySQL database; PostgreSQL, MongoDB and Redis are managed databases on the same private network, never on the public internet.

Related

Next.js hosting on a plain Node.js server

Deploy a Next.js app free