This is a project that integrates Magic passwordless authentication into an app built with Next.js, FaunaDB, TailwindCSS, and TypeScript.
- Clone this project:
git clone https://github.com/kjmczk/nextjs-faunadb-magiclink-typescript.git
- Change into the directory:
cd nextjs-faunadb-magiclink-typescript
- Install the dependencies:
yarn install
- Login to the Magic Dashboard and get the keys of your app:
- Login to the Fauna Dashboard and create a new database:
- Go to the Fauna Shell and run the FQL functions in the
fauna
directory in the order of Collections, Indexes, Functions, Roles, Keys:
After creating the key, copy its secret
.
- Copy the
.env.local.example
file to.env.local
:
cp .env.local.example .env.local
Then set each variable in .env.local
:
NEXT_PUBLIC_MAGIC_PUBLISHABLE_KEY
should look likepk_live_91...
MAGIC_SECRET_KEY
should look likesk_live_B8...
FAUNA_GUEST_SECRET
should look likefnAELQh0NC...
ENCRYPTION_SECRET
should be a string with at least 32 characters
- Run the server:
yarn dev