A quick story first!

When we first built the Pins feature, we were on this little kick like more data on CodePen should be available in real-time. Our approach then was to put the data about Pins into Firestore, a data-storage solution from Google (the successor to Firebase), where real-time connectivity is a first-class feature.

These days, it’s not that we don’t care about real-time features, but we care more about being careful with our technical debt and reigning in the technology we use. We’ve pulled the Pins data back into our own database. We had chucked a few other things in there over the years, and Pins was the last thing we pulled back out, meaning we could turn off Firestore now (which is great for our JavaScript bundle size!).

So we lost the real-time nature of Pins (no real loss, it wasn’t a feature that benefitted much from that) and gained some performance. But we solved some other problems too! The original Pins feature stored information about the Pin right in Firestore. Just the bare minimum of information: the name of the Pin, the ID, and a date of when it was Pinned. To show you your Pins, we just yanked that information back out and showed you. That was very quick to build, but it was under-engineered. This meant that if the item you pinned changed in any way (e.g. the name of it changed) that wouldn’t be reflected in the name of the Pin. Just kinda sloppy work there (my bad). The new system are just pointers to the items, so we have all the data (and data integrity) that come along with the real items. We’ve taken advantage of this a little by showing you the owner of the item and the last time that item was updated, which is more useful than seeing the date it was pinned.

You’ll have to ask Alex sometime how he did the data migration here. It wasn’t exactly straightforward and he might have a gray hair or two from this one. Alex has been a data migration machine lately, doing some serious housecleaning that feels great. Enabled in part by the powerful programming language Go, and you can hear him and Marie talk about that on the podcast.