Daily
Export Firestore to Cloud Storage nightly
Your Firestore data is exported to a dated folder each night, and you are told if an export fails.
- Runs
- Daily
- Apps
- Firebase
- AI
- Not needed
- Access
- datastore scope; service account with Cloud Datastore Import Export Admin plus Storage write on the bucket
Send this to your assistant
Create a ClickRuntime automation: every night at 2am, export my whole Firestore database to gs://acme-firestore-backups in a folder named by date, wait for it to finish, and email me only if it fails.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
A Firestore database holds the real state of an app: customers, orders, settings. A bad deploy, a script that deletes the wrong collection or a developer error in a migration can wipe data in seconds, and Firestore has no undo. Teams often plan to set up exports later, but the first time they need one is the moment they discover there is none. Rebuilding from scratch is not realistic for a live product. Few teams can afford that.
Every night, ClickRuntime starts a Firestore export into a dated folder in Cloud Storage, then polls the long-running operation Google returns until it finishes. It emails you if the export failed, or a short confirmation line if it succeeded.
Startups and small engineering teams without a dedicated operations person benefit most from this routine.
What you get out of it
Recover from accidental deletion
A dated export in Cloud Storage gives you a known-good copy to restore from. A mistaken delete becomes an annoying hour rather than a lost customer base. It limits the damage of a mistake to a single day's changes. A silent failure is the worst kind of backup problem.
Find out about failures the same night
Exports can fail due to permissions or quota changes. An email on failure means you fix it the next morning rather than discovering weeks later that there have been no backups.
Keep a history of dated snapshots
Each export goes into its own dated folder, so you can pick the point in time you want. That helps when a problem was introduced three days ago and went unnoticed. Written proof is more convincing than a verbal assurance in security reviews.
Meet customer and audit expectations
Enterprise customers and auditors ask whether you back up data. Dated exports and a log of results give a clear, verifiable answer, rather than a promise. Reliability like that is hard to get from personal discipline alone.
Free engineers from remembering
Manual exports depend on one person's memory. A nightly schedule makes backups a property of the system, not a habit that lapses during releases or holidays. It stays reliable through releases and holidays.
How it works
What happens, step by step
Every night ClickRuntime starts an export of your Firestore data to a Cloud Storage folder named with the date.
It waits for the export to finish.
If it fails, you get an email with the error. Otherwise you get a short line confirming the backup.
Before it runs live
- Connect Firebase
What you get
Build your own
Need it to work differently?
Your own rules
Conditions, thresholds, filters and exceptions, written the way you'd explain them to a colleague.
Any number of apps
One automation can read from one app and update several others. Over 248 apps are ready, and anything with an API works too.
AI where it helps
Summaries, classification, extraction and drafts use ClickRuntime's built-in AI, with no extra key.
On a schedule or on each event
Runs as often as every 5 minutes, or the moment an app sends an event, and keeps track of what it already handled.
Changes you can ask for
- Run it at a different time, more or less often, or only on weekdays
- Add an AI step, for example to summarize, sort or draft a reply
- Add another app, for example also send it to Slack
- Combine it with other Firebase steps into one automation
Under the hood
The code that runs this automation
import time
from datetime import date
from clickruntime import on_trigger, credentials, http, notify
PROJECT = "acme-prod"
API = "https://firestore.googleapis.com/v1"
@on_trigger
def run(event):
headers = {"Authorization": f"Bearer {credentials.connection('google', 'work')}"}
prefix = f"gs://acme-firestore-backups/{date.today()}"
op = http.post(f"{API}/projects/{PROJECT}/databases/(default):exportDocuments", headers=headers,
json={"outputUriPrefix": prefix}).json()
for _ in range(40):
op = http.get(f"{API}/{op['name']}", headers=headers).json()
if op.get("done"):
break
time.sleep(15)
if not op.get("done") or "error" in op:
notify.email_me("Firestore backup failed", str(op.get("error", "Export did not finish in time")))
return {"ok": False}
return {"ok": True, "prefix": prefix}FAQ
Common questions
What does the export need in Google Cloud?
How do I know the export finished correctly?
Does an export cost anything?
What permissions does it need?
Does it need AI?
How many runs does it use?
Can I change how it works?
Related
You might also like
Get a morning count of new users and orders
Each morning you see how many documents yesterday added to each collection, next to the day before.
See how it worksSee yesterday's new sign-ups each morning
A private email lists the accounts created in the last 24 hours, with how each person signed in and the running total.
See how it worksHear about every new Firestore document
A few minutes after a document lands in the collection you pick, you get its key fields in Slack or email.
See how it worksKeep exploring
Set up “Export Firestore to Cloud Storage nightly” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.