I Accidentally Nuked My Startup’s DB After Applying to Y Combinator


Friday, October 13th was the deadline for Y Combinator’s Winter 2024 batch. VeriFi and thousands of other startups submitted applications outlining what they’re building, why they’re building it, and why they believe their company can become “the next big thing”. Despite the fact that Y Combinator has less than a 2% acceptance rate, we believe VeriFi has a pretty good chance of getting accepted.On Monday, October 16th, I accidentally deleted the production database containing all of our user’s profile data and Wi-Fi contributions. One of the worst things I could have possibly done. Here’s how I managed to nuke our production database.Any developer who has worked on a project with actual end users knows that the production environment must be separated from the development environment. Furthermore, developers must be extremely careful and ensure that development changes don’t impact the stability and data of production.As you can see in the above git diff output, I rewrote a Typescript function that deletes all the Firestore collections. The original function (red text) used the Firebase Admin SDK to iterate over the collections and delete all the documents. This worked fine in conjunction with a handful of other functions to essentially delete all the various Firebase resources that I would spin up during my development. This allowed me to run integration tests locally against data similar to what exists in the production environment before publishing an app update.