Migrating production infrastructure? Get up to ₹10,000 in migration credits. Apply now
voroaBlog
Web Services

Next.js Hosting in India with Server Rendering

· · 3 min read

Next.js Hosting in India with Server Rendering

Next.js hosting in India needs a little thought, because Next.js can be two different things. It can be a static site that you export once, or a server that renders pages on each request. The choice decides what you host, what it costs and how fast pages feel for users in India. This post explains the difference and how to run the server version close to your users.

A Next.js app built on each push and served from a server in Mumbai

Advertisement

Static export or server?

Static export

If every page can be built ahead of time, set output: 'export' and next build gives you plain files. The Next.js static exports guide lists what does not work in this mode. Commit the built files and host them as a static site, which is free on Voroa. No build runs on a static site, so the built files must be in the repository.

Server rendering

If you use server-side rendering, API routes, middleware or image optimisation, you need a running Node.js server. That is a web service.

How to decide

If you are not sure, you probably need the server: most apps with login, a dashboard or data that changes per user do.

Running Next.js as a web service

Build command

bash
npm install && npm run build

Start command

bash
npm start

next start reads the PORT environment variable, which Voroa sets for you. The build and start commands guide shows where to set both.

Environment variables at build time

Variables that start with NEXT_PUBLIC_ are baked into the browser bundle during the build. Set them before you deploy, and redeploy after you change them. Server-only secrets must not start with NEXT_PUBLIC_, or they end up in every visitor’s browser. See environment variables.

Deploys and rollbacks

Every push to your branch builds a new release. The old release keeps serving until the new one is ready, so visitors do not see a broken page mid-deploy. If a release is wrong, roll back in one click. The full steps are in our Next.js deploy guide.

Why host it in India

Server-rendered pages are built on each request, often with a database call or two inside. A server in Mumbai keeps that request short for users in India. You are billed in rupees with a GST invoice, and paid sizes start at Rs 298 a month plus GST.

Caching and performance

Pages that do not change per user can be generated once and reused instead of rendered on every request. Use Next.js’s own caching and revalidation for those pages, keep database calls in server components short, and put repeated reads in a cache. Every millisecond a server-rendered page spends waiting is a millisecond the visitor waits too.

Next.js build and runtime errors to expect

  • Build runs out of memory: build resources come from your workspace plan, not the service size - trim the build or move to a higher plan.
  • A variable is empty in the browser: it was added after the build; redeploy.
  • Images do not load: remote image hosts must be listed in next.config.js.

Host Next.js on Voroa

Your Next.js app calls its own API? Read backend API hosting in India. For sizes and what is included, see Next.js and web app hosting on Voroa.

Advertisement