A guestbook template for builders to build with Next.js and Fauna.
This Guestbook Single-Page Application (SPA) example shows you how to use Fauna's GraphQL endpoint in your Next.js project.
Deploy the example using Vercel:
By importing a .gql
or .graphql
schema into Fauna (see our sample schema file), Fauna will generate required Indexes and GraphQL resolvers for you -- hands free 👐 (some limitations exist).
Execute create-next-app
with npm, Yarn, or pnpm to bootstrap the example:
npx create-next-app --example with-fauna with-fauna-app # or yarn create next-app --example with-fauna with-fauna-app # or pnpm create next-app --example with-fauna with-fauna-app
You can start with this template using create-next-app
or by downloading the repository manually.
To use a live Fauna database, create a database at dashboard.fauna.com and generate an admin token by going to the Security tab on the left and then click New Key. Give the new key a name and select the 'Admin' Role. Copy the token since the setup script will ask for it. Do not use it in the frontend, it has superpowers which you don't want to give to your users.
The Next.js and Fauna example includes a setup script (npm run setup
). After providing your admin token, the script will:
After the script completes, a .env.local
file will be created for you with the newly generated client token assigned to an Environment Variable.
Install packages, set up if needed, then run the development server:
npm install npm run dev
Your app should be up and running on http://localhost:3000!
A guestbook template for builders to build with Next.js and Fauna.
This Guestbook Single-Page Application (SPA) example shows you how to use Fauna's GraphQL endpoint in your Next.js project.
Deploy the example using Vercel:
By importing a .gql
or .graphql
schema into Fauna (see our sample schema file), Fauna will generate required Indexes and GraphQL resolvers for you -- hands free 👐 (some limitations exist).
Execute create-next-app
with npm, Yarn, or pnpm to bootstrap the example:
npx create-next-app --example with-fauna with-fauna-app # or yarn create next-app --example with-fauna with-fauna-app # or pnpm create next-app --example with-fauna with-fauna-app
You can start with this template using create-next-app
or by downloading the repository manually.
To use a live Fauna database, create a database at dashboard.fauna.com and generate an admin token by going to the Security tab on the left and then click New Key. Give the new key a name and select the 'Admin' Role. Copy the token since the setup script will ask for it. Do not use it in the frontend, it has superpowers which you don't want to give to your users.
The Next.js and Fauna example includes a setup script (npm run setup
). After providing your admin token, the script will:
After the script completes, a .env.local
file will be created for you with the newly generated client token assigned to an Environment Variable.
Install packages, set up if needed, then run the development server:
npm install npm run dev
Your app should be up and running on http://localhost:3000!