Skip to content

AlterClassIO/magic-next-auth

Repository files navigation

Magic NextAuth

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:

Deploy with Vercel

Getting Started

1. Clone the repository and install dependencies

git clone https://github.com/AlterClassIO/magic-next-auth
cd magic-next-auth
npm install

2. Configure your local environment

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.

3. Start the application

To run your site locally, use:

npm run dev

To run it in production mode, use:

npm run build
npm run start

4. Preparing for Production

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

License

MIT