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 Fauna database. When that is complete, your project can access your Fauna database using FQL to create, retrieve, update, and delete documents.
Create or sign in to your Fauna account
Go to https://dashboard.fauna.com/register, enter your Email and Password, and click the SIGN UP button.
If you already have an account, choose Sign in, enter your Email and Password, and click the SIGN IN button.
Sign in to your Vercel account
If you don’t already have a Vercel account, sign up.
Create a Vercel project
Skip this step if you already have a project started that should use Fauna.
Click the Add New button and choose Project.
Use one of the application templates.
Add the Fauna integration to your project
You can also find the Fauna integration by searching the Integration Marketplace, https://vercel.com/integrations?category=databases, and selecting the
Click the Add Integration button to display the Add Fauna dialog.
In the Select a Vercel Scope dropdown, select the scope you want to use.
Click the CONTINUE button.
Choose which projects should include the Fauna integration by clicking the appropriate All Projects or Specific Projects radio button.
If you choose Specific Projects, a dropdown field is displayed where you can search for matching projects. When you click a project, it is added to a list below the dropdown.
You can add more projects that should use the Fauna integration by clicking the dropdown and searching and selecting more project names. You can click the X button beside a project to remove it from the list.+
Click the Continue button.
Accept the required permissions and click the ADD INTEGRATION button. A popup window displays the project or list of projects you selected in the preceding step, for you to enter a database for the project.
If the Fauna login screen is displayed, first log in.
If you choose Create New Database, enter a database name and choose a Region Group.
If you choose Select Existing Database, choose the Region Group. You are then prompted to select a database in that Region Group.
Click the Install button. It takes a few moments for the Fauna integration to complete its configuration, and then the popup window closes.
You can manage the integration access or remove the configuration from this page.
Note that the
FAUNA_ADMIN_KEYenvironment variable is the secret for an admin key that can access the database associated with your project. Every database connection that your projects use to connect to Fauna must use this environment variables.
The admin key created by the integration is directly usable only during Vercel builds or in serverless functions. If you want to use a Fauna secret in browser-executed code, you should create a serverless function that can log in to generate a token. See Log in and log out. You can then use the token secret in client code. You should also consider applying roles so queries that execute with the token secret have user-defined privileges. See Create user-defined roles.
Is this article helpful?
Tell Fauna how the article can be improved:
Thank you for your feedback!