homeprojectstemplates
 
   

Next.js app in production

Published March 6, 2022Last updated February 4, 20241 min read

Consider the following things when the Next.js app is running in production.

  • Error tracking and alerting

Error tracking and alerting are crucial in the production environment, proactively fixing the errors leads to a better user experience. Sentry is one of the error tracking services, and it provides alerting for unhandled exceptions. You should receive an email when something wrong happens.

Sentry issues show the error stack trace, device, operating system, and browser information. The project dashboard shows an unhandled exception once it's thrown. Run the following commands for integration with the Next.js app.

npm i @sentry/nextjs
npx @sentry/wizard -i nextjs
  • Intl API is not supported in some browsers. Cover it with a fallback.

  • localStorage API is not available when cookies are blocked. Cover it with a fallback.

Boilerplate

Here is the link to the boilerplate I use for the development.