This is a simple example of how to implement magic link authentication in your app. The step by step tutorial is available on medium here.
In this tutorial we are using Prisma as ORM and Postgres as database. So you need to have a postgres database running on your machine.
You should create a .env
file at the root of the project and add the following variables:
DATABASE_URL="postgresql://postgres:@localhost:5432/yourdatabasename?schema=public"
SESSION_EXPIRATION_IN_SECONDS="A number in seconds"
SESSIONS_SECRETS="A random string"
HASH_SECRET="A valid salt for bcrypt"
MAILJS_PUBLIC_KEY="Your mailjs public key"
MAILJS_PRIVATE_KEY="Your mailjs private key"
MAILJS_SERVICE_ID="Your mailjs service id"
MAILJS_TEMPLATE_ID="Your mailjs template id"
npm install
From your terminal:
npm run dev
This starts your app in development mode, rebuilding assets on file changes.