Authentication example with Next.js, Auth0, Fauna and ZEIT Now
MIT License
Small web application built with Next.js that uses Auth0 for Authentication, FaunaDB as database and ZEIT Now for hosting. The API is built with Python Serverless Functions that use Bottle to handle requests.
The example uses the the API-frontend architecture that ZEIT recommends. Our Python functions inside an api/
folder and our Next.js frontend in the root folder.
Clone the repository.
$ git clone https://github.com/j0lv3r4/nextjs-auth0-fauna.git
Copy the .env.example
file into .env
for our Serverless Functions and .env.build
for our Next.js build.
Fill the values in both .env
and .env.build
files with the following:
Your files should look like below.
SECRET=a secret!
SALT=salty
FAUNADB_SERVER_KEY=your fauna server key
AUTH0_CLIENT_ID=your auth0 client id
AUTH0_CLIENT_SECRET=your auth0 client secret
AUTH0_DOMAIN=https://your-auth0-domain.auth0.com
APP_URL=http://localhost:3000
DEBUG=True
In the root directory of the project, we install our npm dependencies.
$ cd nextjs-auth0-fauna
$ npm install
In the api/
folder, install the Python dependencies.
$ cd api
$ poetry install
Inside the root project folder we run our local server.
$ now dev --listen 3000
> Ready! Available at http://localhost:3000