Static Export, Adapters, Platforms & Production Design Review
The final deployment decision is not βVercel or Docker.β
The real decision is:
Which runtime and platform primitives does this application require, and which deployment model satisfies them with acceptable complexity, cost, control, and reliability?
1. Four broad deployment choicesβ
managed Next.js platform
self-hosted Node/container
static export
custom adapter/platform integration
Each removes some responsibilities and introduces others.
2. Managed platformβ
Advantages can include:
- framework-aware build/deploy integration
- CDN and routing
- server/runtime scaling
- cache integration
- image optimization
- deployment previews
- observability integrations
Trade-offs can include:
- platform pricing
- runtime constraints
- provider-specific behaviour
- portability concerns
Label provider-specific behaviour clearly; Next.js core and a hosting platform are not identical concepts.
3. Self-hosted Node/containerβ
Best fit when you need:
- full infrastructure control
- custom networking
- specific compliance/runtime requirements
- existing Kubernetes/container platform
- custom cache/storage topology
But you own:
- reverse proxy/load balancer
- scaling
- caches
- streaming support
- graceful shutdown
- version skew
- security patches
- observability plumbing
- on-call operations
Control is not free.
4. Static exportβ
Configure:
module.exports = {
output: 'export',
}
next build generates static output into:
out/
which can be hosted on a conventional static web server/CDN/object-storage website host.
5. Static export mental modelβ
build has all required route output
β no Next.js server at request time
This can be excellent for:
- marketing sites
- documentation
- public catalogues with build-time data
- SPAs that call external APIs directly
when server runtime features are not required.
6. Unsupported static runtime featuresβ
Current App Router static-export guidance excludes server-dependent features such as:
- redirects requiring Next runtime
- headers requiring Next runtime
- Proxy
- ISR
- default runtime Image Optimization
- Draft Mode
- Server Actions
- Intercepting Routes
- other request-time dynamic features
Do not enable output: 'export' and then attempt to rebuild missing server capabilities manually inside random client code.
Choose the correct deployment model instead.
7. Static image handlingβ
The default Next image optimizer is runtime server functionality.
For static export, use an appropriate custom loader/external image service or another static-compatible strategy.
Phase 12 covers image API details; Phase 17 asks who operates the optimizer.
8. Static routingβ
The static host must map URLs to emitted files correctly.
For example, trailingSlash strategy affects whether output resembles:
/about.html
or:
/about/index.html
Configure CDN/web-server rewrites accordingly.
9. Static deployment is still production engineeringβ
You still need:
- immutable asset caching
- HTML cache invalidation
- TLS
- DNS
- CSP/security headers where host supports them
- deployment atomicity
- rollback
- monitoring
Static does not mean operations-free.
10. Serverless/platform deploymentβ
A platform may decompose one Next.js build into:
static assets
server functions
edge/proxy functions
cache entries
routing configuration
Verify capabilities against official Next.js deployment requirements, particularly:
- streaming
- Server Actions
- shared cache
- PPR
- image optimization
after()lifecycle
11. Adapter APIβ
Next.js now documents a deployment Adapter API for platforms/custom integrations.
Current 16.2 guidance exposes adapterPath as a stable top-level configuration surface after earlier experimental versions.
Conceptually:
next build
β
adapter receives build/config/output information
β
adapter translates to platform artifacts/routing/runtime primitives
This is primarily for hosting/runtime authors, not ordinary feature code.
12. Adapter responsibilitiesβ
A serious adapter may need to implement or coordinate:
- routing phases
- Node/Edge entrypoints
- static assets
- server outputs
- PPR/resume handling
- cache interfaces
- deployment metadata
- platform-specific packaging
Partial support can produce applications that build successfully but fail on advanced features.
13. Adapter compatibility testingβ
A platform adapter should be validated against:
- static routes
- dynamic routes
- Route Handlers
- Server Actions
- Proxy
- streaming
- Cache Components
- PPR
- image/static assets
- error/not-found behaviour
- rolling deployment
Use Next.js compatibility tests where available plus platform-specific integration tests.
14. Do not build a custom server casuallyβ
Custom servers can be useful for unusual integration requirements, but they can remove assumptions/optimizations of the normal Next.js server path and increase operational ownership.
Before creating one, ask whether:
- reverse proxy config
- Route Handlers
- Proxy
headers/redirects/rewrites- instrumentation
- platform adapter
already solves the problem.
15. Platform portabilityβ
Separate application code from infrastructure-specific integrations where practical.
Examples:
application domain code
Next.js framework integration
platform adapter/infrastructure code
This reduces migration cost.
But do not create an abstraction layer for every platform API without a real portability requirement.
16. Production topology design reviewβ
For a large application, draw the complete path:
DNS
β
CDN/WAF
β
load balancer
β
Next.js replicas
ββ shared cache
ββ PostgreSQL
ββ object storage
ββ queue
ββ external APIs
workers β queue
telemetry β collector/backend
Then review every arrow for:
- auth/trust
- latency
- timeout
- retry
- capacity
- failure mode
- observability
17. Failure-domain reviewβ
Ask what happens if each dependency fails.
| Failure | Expected response |
|---|---|
| CDN unavailable | alternate/bypass policy if available |
| one app replica dies | traffic moves to healthy replicas |
| shared cache unavailable | explicit fail-open/degrade policy |
| DB unavailable | controlled errors; no restart storm |
| queue unavailable | mutation durability policy |
| object storage unavailable | upload/download degradation |
| telemetry provider unavailable | app continues with bounded telemetry loss |
Avoid dependencies whose failure mode is βeverything waits forever.β
18. Region strategyβ
Place compute relative to:
- users
- database
- cache
- external services
A globally distributed frontend calling one distant primary DB can still have poor request latency.
Multi-region write architecture adds consistency complexity; do not deploy globally just because the platform offers a region selector.
19. Data residencyβ
Some systems require tenant/user data to remain in specific jurisdictions.
Deployment design then affects:
- region routing
- DB/storage placement
- logs/traces
- backups
- third-party processors
Application-level tenancy and infrastructure residency must agree.
20. Backups and restoreβ
Production readiness includes data recovery.
For stateful dependencies define:
- backup frequency
- retention
- encryption
- restore test
- RPO
- RTO
A backup that has never been restored is an assumption.
21. Disaster recoveryβ
Document:
region loss
DB loss/corruption
cache loss
object-storage issue
secret compromise
DNS/CDN provider issue
Not every app needs active-active multi-region architecture.
Choose recovery complexity proportional to business requirements.
22. Framework upgrade operationsβ
Next.js deployment security depends on supported patched releases.
Production ownership includes:
- tracking security advisories
- using supported LTS lines
- testing patch upgrades
- rolling them out quickly
Phase 20 covers migration mechanics; Phase 17 owns the patch/runbook responsibility.
23. Final production review checklistβ
Build and artifactβ
- exact source/release identity recorded
- reproducible dependencies
- one immutable artifact promoted
- production build and smoke tests pass
Runtimeβ
- compatible hosting model selected
- streaming/PPR supported where used
- reverse proxy/security limits defined
- graceful shutdown tested
Stateβ
- DB pools/capacity safe
- cache layers mapped and coordinated
- object storage durable
- queues durable/idempotent
Deploymentβ
- deployment/build/Action key consistency
- version skew strategy
- old assets retained
- migration compatibility
- rollback artifact known
Securityβ
- secrets injected and rotatable
- production access least-privileged
- trusted forwarded headers controlled
- dynamic/private output cannot become shared cache
Operationsβ
- liveness/readiness defined
- SLOs/alerts/runbooks exist
- release IDs in logs/traces/errors
- backups/restores tested for stateful systems
- incident owners known
24. Senior design questionsβ
Why choose static export?β
When all required application output can be produced at build time and the product does not need Next.js request-time server features. It reduces runtime complexity but removes dynamic capabilities.
When should you use a deployment adapter?β
When implementing a hosting/platform integration that must translate Next.js build and runtime contracts into custom infrastructure primitives. Ordinary applications rarely need to author one.
What is the biggest risk in self-hosting Next.js?β
Not the Node process itselfβthe risk is incomplete ownership of the surrounding contracts: streaming, cache coordination, version skew, shutdown, stateful dependencies, secrets, scaling, observability, patching, and rollback.
Exercise: production architecture reviewβ
For a multi-tenant SaaS, choose one of:
- managed platform
- Kubernetes self-hosting
- static export
- custom platform adapter
Write an architecture decision record covering:
- required Next.js features
- platform capability match
- request topology
- caching
- storage/DB/queue
- version-skew handling
- rollout/rollback
- security ownership
- SLO/observability
- disaster recovery
- cost/complexity trade-off