Next.js Analytics and MonitoringCheatsheet
Track page views, Web Vitals, and errors in Next.js with analytics and monitoring tools.
One-page quick reference sheets on code. Clear, example-driven build help when you need it.
Track page views, Web Vitals, and errors in Next.js with analytics and monitoring tools.
Apply common API patterns in Next.js route handlers: validation, auth, CORS, errors, and webhooks.
Build API endpoints in Next.js with route handlers that read requests and return JSON responses.
Build routes, nested layouts, and loading states with file-based routing in the Next.js App Router.
Cache data in Next.js with use cache, set lifetimes, and refresh it on demand with tags.
Understand how Next.js builds your code with Turbopack, SWC compiler options, and the React Compiler.
Decide between Server and Client Components, and place the client boundary to keep pages fast.
Connect a database to Next.js, query it in Server Components, and write with Server Actions.
Deploy a Next.js app to Vercel, a Node.js server, a Docker container, or static hosting.
Use the use client, use server, and use cache directives to control where code runs.
Manage environment variables in Next.js with env files, the NEXT_PUBLIC prefix, and runtime access.
Handle errors in Next.js with error boundaries, custom 404 pages, and safe form error messages.
Fetch data in Server Components, run requests in parallel, and load data on the client when needed.
Organize a Next.js project with the app folder, route groups, private folders, and colocated files.
Load web fonts in Next.js with next/font for fast pages and no layout shift.
Set up a Next.js project, add pages and layouts, and run the dev server in minutes.
Optimize images in Next.js with the Image component for faster pages and stable layouts.
Use the Link component, useRouter, and redirects for fast navigation between pages in Next.js.