Fauna
Fauna ↗ is a true serverless database that combines document flexibility with native relational capabilities, offering auto-scaling, multi-active replication, and HTTPS connectivity.
Database Integrations allow you to connect to a database from your Worker by getting the right configuration from your database provider and adding it as secrets to your Worker.
To set up an integration with Fauna:
-
You need to have an existing Fauna database to connect to. Create a Fauna database with demo data ↗.
-
Once your database is created with demo data, you can query it directly using the Shell tab in the Fauna dashboard:
-
Add the Fauna database integration to your Worker:
- Log in to the Cloudflare dashboard ↗ and select your account.
- In Account Home, select Workers & Pages.
- In Overview, select your Worker.
- Select Integrations > Fauna.
- Follow the setup flow, selecting the database created in step 1.
-
In your Worker, install the
fauna
driver to connect to your database and start manipulating data: -
The following example shows how to make a query to your Fauna database in a Worker. The credentials needed to connect to Fauna have been automatically added as secrets to your Worker through the integration.
-
You can manage the Cloudflare Fauna integration from the Fauna Dashboard ↗:
-
To view Fauna keys for an integrated Cloudflare Worker, select your database and click the Keys tab.
Keys for a Cloudflare Worker integration are prepended with
_cloudflare_key_
.You can delete the key to disable the integration.
-
When you connect a Cloudflare Worker to your database, Fauna creates an OAuth client app in your Fauna account.
To view your account's OAuth apps, go to Account Settings > OAuth Apps in the Fauna Dashboard.
You can delete the app to disable the integration.
-
To learn more about Fauna, refer to Fauna's official documentation ↗.