FaunaDB Integration for ZEIT Now

The FaunaDB Integration for ZEIT Now makes it easy to use FaunaDB as the database for your ZEIT Now sites and serverless functions.

FaunaDB 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, FaunaDB helps modern developers build applications fearlessly. It is an ideal companion for your serverless web applications hosted by ZEIT Now, an excellent choice for web site hosting and development.

FaunaDB’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.

FaunaDB’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; FaunaDB is accessed via HTTPS and there is no cross-database data contamination.

How to use the FaunaDB Integration for ZEIT Now

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

FaunaDB setup

  1. Sign in to your FaunaDB account

  2. Create a database for all of your ZEIT Now projects.

    Skip this step if you have performed it previously.

    • Click the New Database button,

    • Enter zeit_now as the database name,

    • Click Save.

  3. Create an admin key for the ZEIT Now 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 ZEIT Now,

    • Ensure that the Role field is set to Admin,

    • Enter ZEIT Now 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 ZEIT Now project.

    • Click DB Overview in the left navigation bar,

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

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

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

    • Click Save.

ZEIT Now setup

  1. Sign up for a ZEIT Now account

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

  2. Install the ZEIT Now CLI

    In a terminal window, run these commands:

    npm i -g now
    now login
  3. Add the FaunaDB integration to your ZEIT Now account

    • Visit https://zeit.co/integrations/faunadb,

    • Click Add,

    • Click which ZEIT Now account to use,

    • Click Add,

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

    • Click Save Secret,

    • Click the Select a project select box, and select Create new project,

    • Enter faunadb-zeit-sample-app as the project name,

    • Click Create,

    • Under Link To Project, click the faunadb-zeit-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 FaunaDB Console.

That’s it!

You’re all done setting up the FaunaDB Integration for ZEIT Now.

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

See the ZEIT Now documentation for help there. Check out the rest of the FaunaDB documentation for help writing queries and managing your data.

Was this article helpful?

We're sorry to hear that.
Tell us how we can improve! documentation@fauna.com

Thank you for your feedback!