Skip to content

tbdsux/nextjs-fauna-auth0

Repository files navigation

NextJS - FaunaDB w/ Auth0

This is just a starter template for working with a fullstack app with Nextjs as a frontend, FaunaDB as the database and Auth0 as the main user authentication.

NOTE: I am not sure if this is the best way in configuring this app, if there is a better solution, you can push a PR and I will gladly accept it.

Deploy

Deploy with Vercel

Development

  • Install required dependencies

    yarn
    
  • Start the development server

    yarn dev
    

Setting Up the Database

The scripts folder contains the setup code.

Auth0 Configuration

The utils/auth0-rules is a rule for Auth0 that you can configure so that new users can be automatically registered or created to the database.

  • Create an empty rule in your Auth0 app.
  • Copy and paste the contents (/utils/auth0-rules/newuser.js) to the provided editor and save.
  • You can configure it the way you want.

You need to set your FAUNADB_SECRET_KEY in your .env.local file or your process environment.

yarn setup:db

Cypress Testing

  • Create a Test User in your app and the following to your Environment Variables

    TEST_USER_EMAIL= #testusermail
    TEST_USER_PASSWORD= #testuserpassword
    
  • You can see the sample workflow for basis in integrating with Github Workflows

Deps

  • NextJS
  • FaunaDB Driver
  • Nextjs-Auth0 SDK
  • Prettier
  • ESLint

© TheBoringDude - 2021