When building an authentication system, one crucial feature to implement is email validation before creating a user account. In this article, I'll show you how to implement this process using Fastify, Prisma, and Nodemailer to ensure that a user cannot register with someone else's email—whether by accident or on purpose. The approach follows these steps: Register the user data in a temporary table (unconfirmed users) Send an email with a confirmation button Confirm the email by clicking the button Create the official user account Delete temporary user data Send a success email Redirect the user

When building an authentication system, one crucial feature to implement is email validation before creating a user account. In this article, I'll show you how to implement this process using Fastify, Prisma, and Nodemailer to ensure that a user cannot register with someone else's email—whether by accident or on purpose.
The approach follows these steps:
- Register the user data in a temporary table (unconfirmed users)
- Send an email with a confirmation button
- Confirm the email by clicking the button
- Create the official user account
- Delete temporary user data
- Send a success email
- Redirect the user