Fauna Integration for Vercel

The Fauna Integration for Vercel makes it easy to use Fauna as the database for your Vercel sites and serverless functions.

Fauna is a serverless cloud database that offers fast global access to data via modern APIs, like GraphQL, without sacrificing data consistency. Ubiquitous, flexible, and secure, Fauna helps modern developers build applications fearlessly. It is an ideal companion for your serverless web applications hosted by Vercel, an excellent choice for web site hosting and development.

Fauna’s pricing model provides a generous free tier, which makes it ideal for developing your web application; you only pay when you exceed the thresholds for free service. See the pricing page for details.

Fauna’s multi-tenancy features make it easy to create and manage per-client databases, which simplifies your application development considerably. Just create a database for a specific client, and create and store a key for that database; when the client logs in, use the stored key to access the client’s database. You don’t need to worry about connection pooling, or data segregation; Fauna is accessed via HTTPS and there is no cross-database data contamination.

How to use the Fauna Integration for Vercel

It only takes a few minutes to get setup. There are three phases:

Fauna setup

  1. Sign in to your Fauna account

  2. Create a database for all of your Vercel projects.

    Skip this step if you have performed it previously.

    • Click the New Database button,

    • Enter vercel as the database name,

    • Click Save.

  3. Create an admin key for the Vercel database

    Skip this step if you have performed it previously.

    • Click Security in the left navigation bar,

    • Click New Key,

    • Ensure that the Database field is set to Vercel,

    • Ensure that the Role field is set to Admin,

    • Enter Vercel into the Key Name field,

    • Click Save,

    • Copy the displayed secret, and store it somewhere safe. The secret is only shown once!

  4. Create a project-specific database for a Vercel project.

    • Click DB Overview in the left navigation bar,

    • Beside the "Child databases" heading, click New Database,

    • Enter faunadb-vercel-sample-app as the database name,

    • Click the "Pre-populate with demo data" checkbox,

    • Click Save.

Vercel setup

  1. Sign up for a Vercel account

    You can skip this step if you already have a Vercel account.

  2. Install the Vercel CLI

    In a terminal window, run these commands:

    npm i -g now
    now login
  3. Add the Fauna integration to your Vercel account

    • Visit https://vercel.com/integrations/faunadb,

    • Click Add,

    • Click which Vercel account to use,

    • Click Add,

    • In the Admin Key Secret field, paste the key that you created in step 3, in the Fauna setup procedure,

    • Click Save Secret,

    • Click the Select a project select box,

    • Enter your project name (faunadb-vercel-sample-app) and press Return,

    • Under Link To Project, click the faunadb-vercel-sample-app button.

App setup

  1. Clone and deploy the sample app

    In a terminal, run these commands:

    git clone https://github.com/fauna/faunadb-zeit-sample-app
    cd faunadb-zeit-sample-app
    now --prod
  2. Navigate to your project’s web page

    The URL is displayed after the previous command completes. It is also copied for you, so you can open a new browser tab/window, and paste the URL into the browser’s location bar.

    You should see the same list of collections that are displayed in the Dashboard.

That’s it!

You’re all done setting up the Fauna Integration for Vercel.

The next step is to build your web application or microservice.

See the Vercel documentation for help there. Check out the rest of the Fauna documentation for help writing queries and managing your data.

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!