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.
Set up an integration with Fauna
Section titled “Set up an integration with Fauna”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:
Terminal window Customer.all() -
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:Terminal window npm install fauna -
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.
import { Client, fql } from "fauna";export default {async fetch(request, env) {const fauna = new Client({secret: env.FAUNA_SECRET,});const query = fql`Customer.all()`;const result = await fauna.query(query);return Response.json(result.data);},}; -
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 ↗.
Was this helpful?
- Resources
- API
- New to Cloudflare?
- Products
- Sponsorships
- Open Source
- Support
- Help Center
- System Status
- Compliance
- GDPR
- Company
- cloudflare.com
- Our team
- Careers
- 2025 Cloudflare, Inc.
- Privacy Policy
- Terms of Use
- Report Security Issues
- Trademark