- All Courses
- Next.js for Production
- Shipping to Production
- Deploying and monitoring a Next.js app
Deploying and monitoring a Next.js app
Environment variables split cleanly: values the browser needs are inlined at build time and are therefore public, and everything else stays server-side.
Overview
Launch is the start of the feedback loop
Environment variables split cleanly: values the browser needs are inlined at build time and are therefore public, and everything else stays server-side. Getting this wrong is how a secret key ends up in a client bundle, and the build will not stop you.
Synthetic tests on a fast machine tell you the best case. Field data from real users tells you what is actually happening on mid-range phones, and the gap between the two is usually the whole problem.
Have the rollback path ready before you need it. A deploy you can reverse in a minute changes how a bad release feels — an inconvenience rather than an outage.
- Track largest contentful paint, interaction to next paint, and cumulative layout shift in the field
- Alert on error rate and latency, not on server metrics alone
- Keep the previous build deployable at all times
In this lesson you will:
- Separate build-time and runtime configuration
- Watch real-user metrics, not just synthetic ones
- Roll back quickly when a deploy goes wrong
Resources
Notes are not saved yet — they clear when you leave this page.
Image and font optimization
9m