Fauna API offers a powerful serverless database solution for modern applications. Its unique capabilities allow for highly scalable, secure, and flexible data management. With Pipedream, you can harness the power of Fauna to create intricate serverless workflows that react to various triggers, manage data efficiently, and connect seamlessly with other services and APIs to automate complex tasks.
-
Scheduled Data Backups to Cloud Storage: Use Pipedream's scheduled triggers to run a workflow that extracts data from your Fauna database and pushes it to cloud storage solutions like AWS S3 or Google Cloud Storage. This workflow can be set to run at regular intervals, ensuring your backups are always up-to-date.
-
Real-time Data Sync with Third-Party Services: Integrate Fauna with other apps to keep data in sync across platforms. For instance, you could create a workflow that watches for updates in your Fauna database and reflects those changes in a Shopify store, syncing inventory levels or product details automatically.
-
Automated Email Notifications on Data Events: Set up a workflow that sends out email notifications using a service like SendGrid whenever specific data changes occur in your Fauna database. For example, you might notify a user when their order status changes or when a new piece of content is available that fits their preferences.
FaunaDB Event Sources collect data from FaunaDB (for example, changes to a collection) and emits them as individual events. These events can trigger Pipedream workflows, and are accessible as a real-time, private SSE stream, and via REST API.
Watch this video to learn how to create an event source to track changes to documents in a Fauna collection and build a Pipedream workflow to run on every change.
Click here to create this source
The changes-to-collection.mjs source tracks add and remove events to documents in a specific collection. Each time you add or remove a document from this collection, this event source emits an event of the following shape:
Click to expand
{
"ts": 1588738648630000,
"action": "add",
"document": {
"@ref": {
"id": "264744257335591434",
"collection": {
"@ref": {
"id": "test",
"collection": { "@ref": { "id": "collections" } }
}
}
}
}
}If you set the Emit changes as a single event property to true, Pipedream will emit a single event with all the changes since the last time the source ran. That event has the following shape:
Click to expand
[
{
"ts": 1588738648630000,
"action": "add",
"document": {
"@ref": {
"id": "264744257335591434",
"collection": {
"@ref": {
"id": "test",
"collection": { "@ref": { "id": "collections" } }
}
}
}
}
},
{
"ts": 1588739721810000,
"action": "remove",
"document": {
"@ref": {
"id": "264744257335591434",
"collection": {
"@ref": {
"id": "test",
"collection": { "@ref": { "id": "collections" } }
}
}
}
}
}
]Here are a few example workflows you can copy and modify in any way: