The Fauna integration for Vercel makes it easy to use Fauna as the database for your Vercel sites and serverless functions.
When you add the integration to your Vercel projects, the integration guides you through the process of connecting your project to a specific Fauna database. Once that is complete, your project can access your Fauna database using FQL or GraphQL to create, retrieve, update, and delete documents.
How to add Fauna to your Vercel projects
It only take a few minutes to get setup:
Sign in to your Fauna account
If you do not already have a Fauna account, sign up. It’s free!
Sign in to your Vercel account
If you do not already have a Vercel account, sign up. It’s free!
Create a Vercel project
Skip this step if you already have a project started that should use Fauna.
Use one of the template applications, or start from scratch.
Visit the Fauna integration page
You can also find the Fauna integration by searching the Integration Marketplace:
Then click on the
Add the Fauna integration to your project
Click the Add Integration button.
The Add Fauna dialog appears:
Click the Select a Vercel Scope dropdown, and select the scope to use. The lists shows all of your project scopes.
Click the CONTINUE button.
The dialog updates to show the selected scope, and to ask you to choose which project(s) should include the Fauna integration. You can choose All Projects or Specific Projects by clicking on the respective radio buttons.
If you choose Specific Projects, a new dropdown field appears. You can search for matching projects by typing into the dropdown’s field. When you click a project, it is added to a list that appears below the dropdown:
You can add additional projects that should use the Fauna integration by clicking the dropdown and searching and selecting additional project names. You can click the X button beside a project to remove it from the list.
Once your project selection is complete, click the ADD INTEGRATION button. A popup window appears:
If you are not logged in, the Fauna login screen appears. Log in.
When you are logged in to Fauna, the Install Vercel/Fauna Connector screen appears:
Each project that you have selected appears on this screen asking for permission to access a specific database.
Use the dropdown beside your Vercel project name to choose which database should be connected to your Vercel project, or select Create a New Database which creates a new database named after your Vercel project. When you create a new database, you also need to specify which Region Group the database should be created within.
Click the Install button. It takes a few moments for the Fauna integration to complete its configuration, and then the popup window closes. The integration configuration screen appears:
You can manage the integration’s access, or remove the configuration from here.
To confirm that the configuration has been installed, click the Overview button at the top of the page, click the name of one of the projects that you authorized, click the Settings button at the top of the page, then click the Environment Variables button in the left sidebar. When you scroll to the bottom, you should find two environment variables already defined:
FAUNA_ADMIN_KEY: This is the secret for an admin key that can access the database associated with your project.
FAUNA_DB_DOMAIN: This is the domain of the Region Group containing the associated database.
Every database connection that your project(s) use to connect to Fauna need to use both environment variables.
You’re all done setting up the Fauna integration for Vercel!
See the Vercel documentation for help there. Check out the rest of the Fauna documentation for help writing queries and managing your data.
The admin key created by the integration is directly usable only during Vercel builds, or in serverless functions.
If you need to use a Fauna secret in browser-executed code, we
recommend that you create a serverless function that can call
Is this article helpful?
Tell Fauna how the article can be improved:
Visit Fauna's forums or email firstname.lastname@example.org
Thank you for your feedback!