This example demonstrates how to use WunderGraph with FaunaDB & Next.js. We are going to make your database accessible through JSON-RPC to your Next.js app.
-
Create a FaunaDB account.
-
Create a database with the following options:
- Name:
test
- Region Group: Choose the one that works best for you.
- Use demo data.
- Name:
-
Create a a secret key under
Security
.- Database:
test
- Role:
Admin
- Key Name:
test
- Database:
-
Write down the secret displayed: if you lose it, you have to create a new one (the secret is only ever displayed once).
-
Rename the file
.env.example
to.env
. -
In
.env
:-
Replace
<replace-with-your-token>
with the secret from step 4. -
If you selected a Region Group other than Classic, replace
https://graphql.fauna.com/graphql
with the GraphQL API endpoint suitable for your selected region group:- EU:
https://graphql.eu.fauna.com/graphql
- US:
https://graphql.us.fauna.com/graphql
- Preview:
https://graphql.fauna-preview.com/graphql
- EU:
-
Install the dependencies and run the complete example in one command:
npm install && npm start
Read the Docs.
Join us on Discord!