Your team is deciding whether to run a Next.js App Router app on a managed Next.js platform or self-host it as a container on your own infrastructure. What responsibilities move to you when you self-host, and how would you make the call?
answer
- same build, different operator
- the platform was doing a list of things
- constraints usually decide it
- engineer time is the uncounted cost
- keep the exit cheap from day one
basics
~20 sSelf-hosting runs identical application code but hands you the operational layer a managed platform supplied: a shared regeneration cache, static asset delivery, the image optimizer's cost, deploy atomicity and observability. Decide on constraints and team capacity, not on framework features.
solid answer
~50 sThe build output is the same either way — the difference is entirely operational. Self-hosting means you now own: a cache shared across replicas so regeneration and on-demand revalidation behave consistently, a CDN in front of hashed static assets rather than serving them from the Node process, the CPU and memory that image optimization consumes in your own container, middleware running in your server rather than on a distributed network, atomic rollouts so two builds never serve mismatched assets, and the logging and metrics the platform gave you for free. None of that is hard in isolation; together it is a real ongoing commitment. I would decide on constraints first — data residency, an existing platform your organisation already operates, network policy — then on cost at your actual traffic shape, then on whether the team has the capacity to own the list above. Where nothing forces the choice, start managed and keep a standalone build in CI so the exit stays cheap.
go deeper
Know that the same Next.js build runs in both places, and that a managed platform handles delivery, caching and deploys that you would otherwise set up yourself.
Be able to list what you take on when self-hosting: shared cache, CDN for hashed assets, image optimization cost, deploy atomicity, and observability, and explain why the application code does not change.
Show you can execute the self-host checklist end to end and diagnose the failures it prevents, and be honest about which items your organisation already solves and which it does not.
Own the decision framing: constraints, then true cost including engineering time, then team capacity, then geography — and keep portability verified in CI so the choice stays reversible.
## Start from what is actually the same The application code, the build, and the framework semantics are identical. Server Components, Server Actions, route handlers and caching behave the same way in both places. Anyone framing this as "which one supports more features" has the wrong model. The question is which team operates the layer around the build. ## What a managed platform is doing for you Worth naming explicitly, because these are the exact gaps you inherit: - **A shared regeneration cache.** Every machine serving the app reads one cache, and an invalidation triggered anywhere is visible everywhere. - **Static asset delivery.** Hashed, immutable assets served from a distributed network, so the origin only does rendering. - **Image optimization as a service.** Transformation and its result cache run outside your app's process budget. - **Middleware close to users** rather than as a hop through your single origin region. - **Deploy mechanics.** Atomic cutover, previous-version assets still resolvable during rollover, per-branch preview environments, instant rollback. - **Baseline observability** — request logs, error surfaces, function-level timing — without you assembling it. ## The self-host checklist Self-hosting is entirely viable; it is a checklist, not a compromise. Build a standalone image so the runtime layer is small and starts fast. Put a CDN in front of the hashed asset paths and make sure both the outgoing and incoming build's assets are resolvable during a rollout. Configure a shared cache handler backed by a store all replicas reach, and disable the per-instance in-memory cache so invalidation is not shadowed locally. Decide where image optimization runs — in-process, accepting the CPU and memory, or delegated to an external image service through a custom loader. Wire logs and metrics into whatever your organisation already runs. Set up a rollout strategy that does not leave two builds serving mismatched assets. Then keep all of it working as the app and the framework evolve. ## How to actually decide **Constraints first.** If data must stay inside a private network, if a regulator dictates where compute runs, or if your organisation has a mandated platform, the decision is already made and the rest is implementation. Say this first in an interview; candidates who lead with a features comparison miss that most real decisions are settled here. **Then the cost curve.** Managed platforms are excellent value at low and medium traffic and can become expensive at high, steady, predictable volume — particularly for image transformation and bandwidth. But compare honestly: the alternative cost includes engineer time to build and maintain the checklist above, and that is the line teams systematically under-count. **Then capacity.** A five-person product team with no platform group self-hosting a Next app will spend real weeks on cache handlers, CDN behaviour and deploy atomicity — weeks not spent on the product. An organisation that already runs dozens of containerised services has most of that solved and self-hosting is nearly free. **Then geography and latency.** If your users are global and your infrastructure is one region, you are trading away distribution that the managed option had by default. Sometimes that is fine; it should be a decision rather than a discovery. ## Keep the door open Whichever way you go, keep the escape cheap. Build the standalone output in CI from day one even while deploying managed, so "can we run this ourselves" is a verified fact rather than a hope. Avoid platform-specific APIs in application code, or isolate them behind a thin module. Keep environment configuration portable. The cost of migrating is dominated by how much platform-shaped assumption leaked into the codebase, and that is controllable from the start. ## The anti-patterns to name Two failure modes are worth calling out. The first is self-hosting for ideology and then rebuilding a poor imitation of the platform — a half-working shared cache, no CDN, image optimization eating the app's CPU — for an app whose traffic never justified it. The second is treating the managed platform as a reason not to understand the mechanics: teams that cannot say where their cache lives are equally unable to debug it when something does go wrong, in either environment.
- Which single self-hosting gap surprises teams most on their first production week?The shared cache. Everything works on one instance, then scaling to several makes regeneration and on-demand revalidation look intermittently broken because each replica holds its own cached copy. It reads as a framework bug and is a topology gap, and it is the item to solve before the first scale-out rather than after the first incident.
- How would you keep a managed deployment from becoming hard to leave?Produce the standalone container image in CI from the beginning and run it in at least one environment, so portability is tested rather than assumed. Keep platform-specific APIs out of application code or behind one thin adapter, and keep configuration in ordinary environment variables. Migration cost is mostly leaked assumptions, and that is preventable.
- At what point does the cost argument for self-hosting actually hold?When traffic is high, steady and predictable — especially image transformation and bandwidth — and when the organisation already operates container infrastructure, so the marginal work is small. If either half is missing, the engineering time to build and maintain cache sharing, asset delivery and deploy atomicity usually erases the savings.
saying these in an interview costs you the question
- Frames it as which option supports more Next.js features
- Ignores engineer time when comparing cost
- Assumes a container image alone replaces the platform
- Overlooks data residency and network constraints
- Plans to self-host with no shared cache or CDN