Roadmap › Next.js — App Router, Folder Structure, Rendering and Full Stack with SQL Server › Module: Production
Lessons in this course (8)
7. Authentication and deployment (Vercel, Azure, IIS, Docker)
IntermediateMediumLesson 7 of 8
Authentication: Auth.js/NextAuth (OAuth providers, credentials, Microsoft Entra ID), Clerk, or your own JWT/cookie session. Check auth in three places: proxy (fast redirects), Server Components/layouts (render), and every Server Action/route handler (security — they're public endpoints).
Deployment options:
| Target | How |
|---|---|
| Vercel | Connect the Git repo; every push deploys (preview per branch, production on main); env vars in project settings |
| Azure App Service (Linux, Node) / Azure Static Web Apps (hybrid Next.js) | next build with output: "standalone", deploy the .next/standalone folder, start with node server.js |
| Docker | Multi-stage build using the standalone output; run on Container Apps, AKS, ECS, Cloud Run |
| IIS (Windows Server) | Run node server.js as a service (PM2/NSSM) on a port and put IIS in front as a reverse proxy (URL Rewrite + ARR), or use iisnode |
| Static export | output: "export" for fully static sites (no server features) |
ts
// next.config.ts
const nextConfig = { output: "standalone" }; // self-contained server bundle for Docker/Azure/IIS
export default nextConfig;