Magic Link Authentication in Next.js with NextAuth and Fauna by AlterClass.io.
-
Learn to build this application step-by-step by following the tutorial on AlterClass.
-
Preview the app live here.
-
Deploy the same app using Vercel:
git clone https://github.com/AlterClassIO/magic-next-auth
cd magic-next-auth
npm install
Rename the .env.local.example
file in this directory to .env.local
(which will
be ignored by Git):
cp .env.local.example .env.local
Add details for the SMTP server.
To run your site locally, use:
npm run dev
To run it in production mode, use:
npm run build
npm run start
You must set the NEXTAUTH_URL
environment variable with the URL of your site,
before deploying to production.
e.g. in your .env.local
file - NEXTAUTH_URL=https://example.com
To do this with Vercel, you can use the
Vercel project dashboard or their cli via the
vc env
command:
vc env add NEXTAUTH_URL production