Andrew Irwin
Andrew Irwin

Reputation: 711

How to backup files in Firebase Cloud Storage (back up Firestore and Cloud Storage)

I just need some advice on the best way to go about this. I've been looking around different articles on how to do this but havent exactly came up with anything.

My scenario is:

I have an app, that contains a disclaimer/waiver form that users can fill out, then at the bottom of the form the user can draw/sign their signature using react-signature-canvas

Once the user submits the form, the data from the form is stored in firestore, the signature is saved in firestorage as a dataURl, and then that downloadUrl is saved in the respective document in firestore containing the form.

I'm making the app for a client, and they said that they would like to have some sort backup of the forms, in case anything was to happen "my system" and they werent able to access/view the disclaimers forms at a later date if there was a dispute with one of their customers. One of the most important things on the form that they always need to know will be there and retrievable is the signature.

Current Implementation

I'm using mui-datatables to display a list of all the forms that are brought back from firestore, then using the "download CSV" built-in feature of mui-datatables to download/export all of the document data to excel. the firestore form data comes in perfect, but the signature comes in as downloadUrl which is what its meant to, as it was saved as a downloadUrl. The thing I am not exactly happy about is that what happens in 6 months if a user opens the excel spreadsheet clicks on the downloadUrl of the signature, but then they get told that there is an error and the signature can not be shown. Ideally I think it would be good if there was some way to download the actual signature image itself along with the firestore form document.

I would really appreciate any suggestions as I am a bit stumped, the backup/download doesnt necessarily need to be excel, but as I said above I think it would be great if it included an actual image of the signature.

Would it be a good idea to just make a back up of the firestore and cloud storage in Google Cloud?

Thank you in advance for any help.

Upvotes: 1

Views: 565

Answers (1)

Frank van Puffelen
Frank van Puffelen

Reputation: 599081

Two common approaches are:

  1. Create a backup of all the source data, and of your application code. That way you can always (with enough effort) rebuild the functionality and the data, in case of a disaster.

  2. Create a backup in a different format, typically PDFs. If you generate a PDF with both the data and the signature of each form, you can then store the PDFs on a backup medium.

Which one you pick is based on personal preference and use-case, but both are employed in plenty of systems.

Upvotes: 1

Related Questions