Ch 1: Building a Simple Full Stack Application
Fauna Configuration

Configure Fauna database

  1. Head over to Fauna and create an account if you haven’t done so already.
  2. Next, create a new database. Give your database a name. Select the classic region group and select create.

Info: By default, Fauna allows you to save your data globally closer to your user. However, you can also limit your data's distribution to a specific geographic region group to comply with GDPR and data residency. Learn more about region groups here.

You also have the option to save data into privately distributed nodes with Virtual Private Fauna.

Create a database

  1. Next, select create new collection.

Create a new collection

  1. Create a new Collection called Products.

Create a new Collection called Products

  1. You would require a secret to query your database from your application. Navigate to Security > Keys and select New Key.

New Key

  1. Select Server Role from the dropdown. Give your key a name and select Save. When the key is generated save it into a secure file.

New Key Role

  1. For local development create a new file called .env in the root of your project and add the following code. Make sure you add .env to your git ignore file so it doesn’t get committed.
FAUNA_SECRET=fnAExxxx
  1. Finally, head back to Cloudflare Pages settings and add a new environment variable called FAUNA_SECRET.

Fauna Secret

Last updated on November 30, 2022