Vercel
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.
Add Fauna to your Vercel projects
-
Sign in to your Fauna account
If you do not already have a Fauna account, sign up.
-
Sign in to your Vercel account
Visit: https://vercel.com/
If you do not 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.
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:
https://vercel.com/integrations?category=databases
Then click theFauna
integration. -
Add the Fauna integration to your project
-
Click the Add Integration button.
The Add Fauna dialog is displayed:
-
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 projects should include the Fauna integration. You can choose All Projects or Specific Projects by clicking on the radio buttons.
If you choose Specific Projects, a new dropdown field is displayed that you can search for matching projects by typing into the dropdown field. 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.
-
After completing your project selection, click the ADD INTEGRATION button. A popup window displays:
-
If you are not logged in, the Fauna login screen is displayed. Log in.
-
When you are logged in to Fauna, the Install Vercel/Fauna Connector screen is displayed:
Each project that you have selected is displayed for entering permission to access a 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 want to specify which
Region Group
the database should be created in. -
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 is displayed:
You can manage the integration access, or remove the configuration from here.
-
To confirm that the configuration is 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 theRegion Group
where the associated database resides.Every database connection that your projects use to connect to Fauna must use these environment variables.
-
-
Next step
The next step is to build your web application or microservice and
include FQL queries using the
JavaScript driver
.
See the Vercel documentation for help there. See 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 want to use a Fauna secret in browser-executed code,
you should 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 docs@fauna.com
Thank you for your feedback!