Is it possible to share a single Node.js server for multiple Next.js apps in production (IIS setup)?
Answered
Yves posted this in #help-forum
YvesOP
Hello everyone, I have 140 clients who need my app in production here in Brazil, my infrastructure is with Windows IIS and the problem I currently have is that to host a Nextjs app I need a Node server, and each Node server consumes 70MB idle, and scaling this to 140 clients would be very heavy, my intention is to share the NodeJs servers for the applications, is it possible to do this?
Answered by joulev
No. It is not possible. Each next start call is for one nextjs application only.
3 Replies
YvesOP
Just to clarify the intent of my question and avoid confusion:
I'm not asking whether a single Node.js server can handle multiple concurrent users of a shared app — I know that is the case for most APIs or multi-tenant architectures.
What I'm specifically asking is:
My current setup:
- I have 140 white-label instances of the same Next.js app (same codebase, different builds/configs),
- Each client gets a custom
- Then I run
- But each process consumes ~70MB of memory, and I want to know if there's a supported way to optimize this by somehow reusing a single Node.js process.
I’m fully aware that a multi-tenant architecture could solve this in the long run — and I’m open to that in the future — but the question here is about how Next.js actually works in production, especially regarding:
- Whether
- Whether
Thanks in advance for any technical clarification!
I'm not asking whether a single Node.js server can handle multiple concurrent users of a shared app — I know that is the case for most APIs or multi-tenant architectures.
What I'm specifically asking is:
❓ Can I use a single Node.js process (started withnext start
) to serve multiple separately built Next.js apps, each one with its own.env
file, branding, and configuration?
My current setup:
- I have 140 white-label instances of the same Next.js app (same codebase, different builds/configs),
- Each client gets a custom
.env
, and a custom build is generated for them using next build
,- Then I run
next start
per instance,- But each process consumes ~70MB of memory, and I want to know if there's a supported way to optimize this by somehow reusing a single Node.js process.
I’m fully aware that a multi-tenant architecture could solve this in the long run — and I’m open to that in the future — but the question here is about how Next.js actually works in production, especially regarding:
- Whether
.env
files and builds can be dynamically served,- Whether
next start
supports multiple apps under one process (if at all).Thanks in advance for any technical clarification!
No. It is not possible. Each next start call is for one nextjs application only.
Answer