Next.js with Auth0 and Fauna

Robert Auld

Robert Auld

Software Developer

Create a Next.js app.

npx create-next-app --ts

Create a src directory at the project's root. Move pages and styles into src.

Install Prettier and the Prettier ESLint config npms.

npm install -D prettier eslint-config-prettier

Install Prettier VSCode extension.

Add a .prettierrc.json file:

{
"tabWidth": 2
}

Followed instructions here: https://vampiro.github.io/dev/docs/ for setting up husky for pre-commit hook Prettier formatting.

Auth#

Follow instructions for installing next-auth and adding the nextauth api endpoint and login/out component. https://github.com/nextauthjs/next-auth

Follow instructions for setting up your OAuth provider: https://next-auth.js.org/configuration/providers/oauth-provider

To configure in Google go here: https://console.cloud.google.com/apis/credentials. This involves setting up the origin and redirect urls inside Google. Should add localhost for development. Eventually add your Vercel domain.

Save off your client id and client secret into a .env.local file in your project.